Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Anchor transaction for no expiration channels without segwit

11 messages, Feb 6 to 10, 2017. Started by Nicolas Dorier.

Nicolas Dorier (6), Tier Nolan (4), Christopher Jämthagen

Permalink First message in the Wayback Machine

Nicolas Dorier permalink original

I think you do not need the second timeout.

TX2 would be signed by Bob only once he could get back the second Output of TX1. So Bob does not have to worry about Alice closing the channel with TX2.

Nicolas,

Tier Nolan in reply to Nicolas Dorier permalink original

On Mon, Feb 6, 2017 at 4:32 PM, Nicolas Dorier <nicolas.dorier at gmail.com> wrote:

Quoted text (5 lines)
> I think you do not need the second timeout.
>
> TX2 would be signed by Bob only once he could get back the second Output
> of  TX1.
>

Alice must have a fully signed version of TX2 before the timeout finishes.

If she doesn't, then Bob can reclaim TX1/1 once the timeout expires and then refuse to sign TX2.

If Alice has a signed version of TX2, then she can broadcast it and immediately close the channel (claiming TX1/0).

Once that has been accepted, she can then claim TX1/1.

Quoted text (10 lines)
> So Bob does not have to worry about Alice closing the channel with TX2.
>
> Nicolas,
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Nicolas Dorier in reply to Tier Nolan permalink original

Good point, actually, a simpler way to do it, is for TX2 to be nTimelocked after bounty's expiration. If Alice see bob not signing it, she can reclaim the bounty fast. If bob sign it, Alice can't broadcast it immediately.

On Tue, Feb 7, 2017 at 5:02 AM, Tier Nolan <tier.nolan at gmail.com> wrote:

Quoted text (34 lines)
>
>
> On Mon, Feb 6, 2017 at 4:32 PM, Nicolas Dorier <nicolas.dorier at gmail.com>
> wrote:
>
>> I think you do not need the second timeout.
>>
>> TX2 would be signed by Bob only once he could get back the second Output
>> of  TX1.
>>
>
> Alice must have a fully signed version of TX2 before the timeout finishes.
>
> If she doesn't, then Bob can reclaim TX1/1 once the timeout expires and
> then refuse to sign TX2.
>
> If Alice has a signed version of TX2, then she can broadcast it and
> immediately close the channel (claiming TX1/0).
>
> Once that has been accepted, she can then claim TX1/1.
>
>
>
>> So Bob does not have to worry about Alice closing the channel with TX2.
>>
>> Nicolas,
>>
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>>
>
Tier Nolan in reply to Nicolas Dorier permalink original

On Tue, Feb 7, 2017 at 2:39 AM, Nicolas Dorier <nicolas.dorier at gmail.com> wrote:

Quoted text (3 lines)
> Good point, actually, a simpler way to do it, is for TX2 to be nTimelocked
> after bounty's expiration.
>

That works too and keeps the transaction smaller.

I think a symmetrically funded channel needs 4 1BTC outputs, so it is pretty much two single funded channels. It would be slightly smaller than 2 transactions to open the channel.

TX1

Input 2 from Alice 2 from Bob

Output 1: (Alice + Bob) OR (Bob + AliceSecret) 1: (Alice + Bob) OR (Alice + BobSecret) 1: (Bob + timeout(now + T)) OR (Alice + AliceSecret) 1: (Alice + timeout(now + T)) OR (Bob + BobSecret)

TX2 locktime: now + 2T

Input TX1/0: signed by (Alice + Bob) TX1/1: signed by (Alice + Bob) Output Initial channel paying Alice & Bob 1BTC each

---------------------------------------

Alice and Bob create TX1, sign it and share the result.

Alice and Bob create TX2, sign it and share the result.

Abort for those 2 steps: * If one signs and the other doesn't then the signer should spend their inputs to be safe. * If TX1 is broadcast, then they can both spend their timeouts to recover their funds, so it is safe.

Once they both have signed versions of TX1 and TX2, they should broadcast TX1. This initializes the channel.

If TX1 is mutated, then they should both abort and spend their timeouts and recover their funds.

Nicolas Dorier in reply to Tier Nolan permalink original

With this solution, is there any problem left without Segwit outside no third party channel monitoring and channel establishment which need to wait Bob bounty expiration ?

On Tue, Feb 7, 2017 at 9:02 PM, Tier Nolan <tier.nolan at gmail.com> wrote:

Quoted text (58 lines)
> On Tue, Feb 7, 2017 at 2:39 AM, Nicolas Dorier <nicolas.dorier at gmail.com>
> wrote:
>
>> Good point, actually, a simpler way to do it, is for TX2 to be
>> nTimelocked after bounty's expiration.
>>
>
> That works too and keeps the transaction smaller.
>
> I think a symmetrically funded channel needs 4 1BTC outputs, so it is
> pretty much two single funded channels.  It would be slightly smaller than
> 2 transactions to open the channel.
>
> TX1
>
> Input
> 2 from Alice
> 2 from Bob
>
> Output
> 1:  (Alice + Bob) OR (Bob + AliceSecret)
> 1:  (Alice + Bob) OR (Alice + BobSecret)
> 1:  (Bob + timeout(now + T)) OR (Alice + AliceSecret)
> 1:  (Alice + timeout(now + T)) OR (Bob + BobSecret)
>
> TX2
> locktime:  now + 2T
>
> Input
> TX1/0: signed by (Alice + Bob)
> TX1/1: signed by (Alice + Bob)
> Output
> Initial channel paying Alice & Bob 1BTC each
>
> ---------------------------------------
>
> Alice and Bob create TX1, sign it and share the result.
>
> Alice and Bob create TX2, sign it and share the result.
>
> Abort for those 2 steps:
> *  If one signs and the other doesn't then the signer should spend their
> inputs to be safe.
> *  If TX1 is broadcast, then they can both spend their timeouts to recover
> their funds, so it is safe.
>
> Once they both have signed versions of TX1 and TX2, they should broadcast
> TX1.  This initializes the channel.
>
> If TX1 is mutated, then they should both abort and spend their timeouts
> and recover their funds.
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Nicolas Dorier in reply to Nicolas Dorier permalink original

Tadge had an idea so we do not need any nTimeLock:

TX1

Input: 1 BTC From Alice 1 BTC From Bob Output: 1 BTC Alice+Bob OR Bob+AliceSecret1 1 BTC Bob+Timeout OR Alice+AliceSecret1 OR Bob+AliceSecret2 (aka the bounty)

TX2

Input: TX1:0 using Alice+Bob Output: 1 BTC Alice+Bob+100 CSV OR Bob+AliceSecret1

So basically, if Alice try to broadcast TX2 and claim TX1:1 with Alice+AliceSecret1, Bob can claim TX2:0 with Bob+AliceSecret1. The condition Bob+AliceSecret2 in TX1:1 is useful such that Bob can claim the bounty without having to wait the Timeout.

Channel establishment will basically take twice more time than a normal channel with expiration.

On Wed, Feb 8, 2017 at 1:16 PM, Nicolas Dorier <nicolas.dorier at gmail.com> wrote:

Quoted text (65 lines)
> With this solution, is there any problem left without Segwit outside no
> third party channel monitoring and channel establishment which need to wait
> Bob bounty expiration ?
>
> On Tue, Feb 7, 2017 at 9:02 PM, Tier Nolan <tier.nolan at gmail.com> wrote:
>
>> On Tue, Feb 7, 2017 at 2:39 AM, Nicolas Dorier <nicolas.dorier at gmail.com>
>> wrote:
>>
>>> Good point, actually, a simpler way to do it, is for TX2 to be
>>> nTimelocked after bounty's expiration.
>>>
>>
>> That works too and keeps the transaction smaller.
>>
>> I think a symmetrically funded channel needs 4 1BTC outputs, so it is
>> pretty much two single funded channels.  It would be slightly smaller than
>> 2 transactions to open the channel.
>>
>> TX1
>>
>> Input
>> 2 from Alice
>> 2 from Bob
>>
>> Output
>> 1:  (Alice + Bob) OR (Bob + AliceSecret)
>> 1:  (Alice + Bob) OR (Alice + BobSecret)
>> 1:  (Bob + timeout(now + T)) OR (Alice + AliceSecret)
>> 1:  (Alice + timeout(now + T)) OR (Bob + BobSecret)
>>
>> TX2
>> locktime:  now + 2T
>>
>> Input
>> TX1/0: signed by (Alice + Bob)
>> TX1/1: signed by (Alice + Bob)
>> Output
>> Initial channel paying Alice & Bob 1BTC each
>>
>> ---------------------------------------
>>
>> Alice and Bob create TX1, sign it and share the result.
>>
>> Alice and Bob create TX2, sign it and share the result.
>>
>> Abort for those 2 steps:
>> *  If one signs and the other doesn't then the signer should spend their
>> inputs to be safe.
>> *  If TX1 is broadcast, then they can both spend their timeouts to
>> recover their funds, so it is safe.
>>
>> Once they both have signed versions of TX1 and TX2, they should broadcast
>> TX1.  This initializes the channel.
>>
>> If TX1 is mutated, then they should both abort and spend their timeouts
>> and recover their funds.
>>
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>>
>
Tier Nolan in reply to Nicolas Dorier permalink original

On Wed, Feb 8, 2017 at 9:32 AM, Nicolas Dorier <nicolas.dorier at gmail.com> wrote:

Quoted text (2 lines)
> Tadge had an idea so we do not need any nTimeLock:
>

I think the nLocktime for TX2 is basically costless. It just prevents channel fast initial channel close.

Once an unchanged version of TX1 is in the blockchain, all further updates of the channel can exclude the nLocktime..

Quoted text (2 lines)
> 1 BTC Bob+Timeout OR Alice+AliceSecret1 OR Bob+AliceSecret2 (aka the
bounty)

This is so that Alice can unlock the bounty once the channel is setup, as a courtesy?

Nicolas Dorier in reply to Tier Nolan permalink original

The locktime is basically useless. The reason for the locktime was to give bob time to reclaim the bounty before Alice can broadcast TX2. But with AliceSecret1 in TX2, if alice ever broadcast and take the bounty, Bob can confiscate TX2:0.

AliceSecret2 is courtesy of Alice, so bob can get the bouncy back. It is unsafe to Bob to start using the channel before he could reclaim the bounty with some confirmation.

On Wed, Feb 8, 2017 at 7:25 PM, Tier Nolan <tier.nolan at gmail.com> wrote:

Quoted text (24 lines)
> On Wed, Feb 8, 2017 at 9:32 AM, Nicolas Dorier <nicolas.dorier at gmail.com>
> wrote:
>
>> Tadge had an idea so we do not need any nTimeLock:
>>
>
> I think the nLocktime for TX2 is basically costless.  It just prevents
> channel fast initial channel close.
>
> Once an unchanged version of TX1 is in the blockchain, all further updates
> of the channel can exclude the nLocktime..
>
> > 1 BTC Bob+Timeout OR Alice+AliceSecret1 OR Bob+AliceSecret2 (aka the
> bounty)
>
> This is so that Alice can unlock the bounty once the channel is setup, as
> a courtesy?
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Tier Nolan in reply to Nicolas Dorier permalink original

On Wed, Feb 8, 2017 at 11:20 AM, Nicolas Dorier <nicolas.dorier at gmail.com> wrote:

Quoted text (2 lines)
> The locktime is basically useless.
>

It solves the problem at (almost) zero cost. The disadvantage is that it sets a minimum delay for a forced channel close, but using CSV also does that, and is slightly larger.

Having a way to cooperatively reclaim the deposit is a good idea.

Christopher Jämthagen in reply to Nicolas Dorier permalink original
Nicolas Dorier in reply to Christopher Jämthagen permalink original

Well two transactions to be confirmed is not too bad. Approximately 30 minutes. Compare that to the time it takes to apply for a prepaid debit card.

So we have two possibilities so far without segwit: one transaction to be confirmed but definite channel lifetime. Or two transactions to be confirmed but indefinite channel lifetime.

Not sure yet what is the best from user perspective as channel renewal can be done in the background.

On Fri, Feb 10, 2017 at 2:51 AM, "Christopher Jämthagen" <cjamthagen at gmx.com

Quoted text (80 lines)
> wrote:

> Two-layer HTLCs still need a malleability fix or some other workaround to
> avoid excessive timeouts.
>
> /Christopher
>
> *Sent:* Wednesday, February 08, 2017 at 5:16 AM
> *From:* "Nicolas Dorier" <nicolas.dorier at gmail.com>
> *To:* "Tier Nolan" <tier.nolan at gmail.com>
> *Cc:* lightning-dev at lists.linuxfoundation.org
> *Subject:* Re: [Lightning-dev] Anchor transaction for no expiration
> channels without segwit
> With this solution, is there any problem left without Segwit outside no
> third party channel monitoring and channel establishment which need to wait
> Bob bounty expiration ?
>
> On Tue, Feb 7, 2017 at 9:02 PM, Tier Nolan <tier.nolan at gmail.com> wrote:
>>
>> On Tue, Feb 7, 2017 at 2:39 AM, Nicolas Dorier <nicolas.dorier at gmail.com>
>> wrote:
>>
>>> Good point, actually, a simpler way to do it, is for TX2 to be
>>> nTimelocked after bounty's expiration.
>>>
>>
>> That works too and keeps the transaction smaller.
>>
>> I think a symmetrically funded channel needs 4 1BTC outputs, so it is
>> pretty much two single funded channels.  It would be slightly smaller than
>> 2 transactions to open the channel.
>>
>> TX1
>>
>> Input
>> 2 from Alice
>> 2 from Bob
>>
>> Output
>> 1:  (Alice + Bob) OR (Bob + AliceSecret)
>> 1:  (Alice + Bob) OR (Alice + BobSecret)
>> 1:  (Bob + timeout(now + T)) OR (Alice + AliceSecret)
>> 1:  (Alice + timeout(now + T)) OR (Bob + BobSecret)
>>
>> TX2
>> locktime:  now + 2T
>>
>> Input
>> TX1/0: signed by (Alice + Bob)
>> TX1/1: signed by (Alice + Bob)
>> Output
>> Initial channel paying Alice & Bob 1BTC each
>>
>> ---------------------------------------
>>
>> Alice and Bob create TX1, sign it and share the result.
>>
>> Alice and Bob create TX2, sign it and share the result.
>>
>> Abort for those 2 steps:
>> *  If one signs and the other doesn't then the signer should spend their
>> inputs to be safe.
>> *  If TX1 is broadcast, then they can both spend their timeouts to
>> recover their funds, so it is safe.
>>
>> Once they both have signed versions of TX1 and TX2, they should broadcast
>> TX1.  This initializes the channel.
>>
>> If TX1 is mutated, then they should both abort and spend their timeouts
>> and recover their funds.
>>
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>
> _______________________________________________ Lightning-dev mailing
> list Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>