Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Lightning, the death of BIP62, and Segregated Witness

18 messages, Nov 19 to 22, 2015. Started by Rusty Russell.

Tadge Dryja (3), Rusty Russell (2), Pierre (2), Matt Corallo (2), CJP, sickpig, Glenn Tarbox, PhD, Greg Sanders, +5 more

Permalink First message in the Wayback Machine

Rusty Russell permalink original

Hi all!

        As you know, I designed a lightning variant which used only
non-experimental, in-planning BIPs[1].  One assumption was BIP62: in
particular, that anchor malleability wouldn't be an issue.  This was
flawed; BIP62 will never be deployed.
        There are several options from here:
1) Ignore it.  Malleated txs are non-standard.
2) Add a timeout to the anchor.  Limits the lifetime of the channel, and
   still means if it does happen you have to wait for the timeout.
3) Propose a reduced BIP62 which (say) only protects P2PKH, for a
   specific transaction version.
4) Take a leap of faith and assume Segregated Witness fixes all
   malleability.

I was debating between #1 and #3 for a while, but eventually settled on #4. Here's why:

1) While still pre-BIP, Pieter Wuille is working on a prototype now
   (Luke Jr came up with a sanish way of softforking it in).
2) Other parts of the lightning code (in particular, watching bitcoin
   transactions) become significantly simpler if malleability is
   ignored.
3) It's the right thing for Bitcoin; all smart contract systems want
   this.

This result is NOP for lightning in the short term; assuming SW is the same as pretending malleability doesn't exist. But if we need to add malleability support later, it's going to be painful, since handling it correctly in all the places it's missing will be hard.

Cheers,
Rusty.
PS.  Remember, every project has 3 major disasters.  Just wait until you
     see the next two!
[1] https://github.com/ElementsProject/lightning/blob/master/doc/deployable-lightning.pdf
CJP in reply to Rusty Russell permalink original

Wow, that was unexpected.

Is there a place where I can see the discussion that concluded in withdrawing BIP62? The only thing I found with a quick search was this:

https://github.com/bitcoin/bips/commit/916142e742b4256686c26b15a0bf943aea3f5ef9

All of BIP62's (including the only-new-transactions) are currently enforced as standardness rules, but it seems hard to push it further. Every new type of complex transaction may require new extra rules, and some important types of malleability cannot be addressed by it (for example, a single participant in a multisig spend creating a new signature with a different nonce). It seems wiser to pursue normalized txid or segregated witness-based solutions, which do solve this problem more fundamentally.

The reasoning seems to assume that "normalized txid or segregated witness-based solutions" will become available in the future. Aren't these features harder to introduce (hard fork)? Is there a backup plan for when these somehow don't get implemented? That could be e.g. un-withdrawing BIP62. If miners / pool operators see value in reducing tx malleability, I don't see how the core developers could stop such a movement.

BIP62 may not solve all cases (and is, in that sense, inferior to more fundamental solutions), but from what I can see, it was already good enough for certain types of smart contract constructions. I think the Amiko Pay "HTLC emulation" design would be secure against malleability under the conditions that * BIP62 is in effect * Every channel is only funded by one of the two sides (so e.g. the "New signatures by the sender" case can't be abused)

CJP

Rusty Russell schreef op do 19-11-2015 om 13:23 [+1030]:

Quoted text (43 lines)
> Hi all!
>
>         As you know, I designed a lightning variant which used only
> non-experimental, in-planning BIPs[1].  One assumption was BIP62: in
> particular, that anchor malleability wouldn't be an issue.  This was
> flawed; BIP62 will never be deployed.
>
>         There are several options from here:
>
> 1) Ignore it.  Malleated txs are non-standard.
> 2) Add a timeout to the anchor.  Limits the lifetime of the channel, and
>    still means if it does happen you have to wait for the timeout.
> 3) Propose a reduced BIP62 which (say) only protects P2PKH, for a
>    specific transaction version.
> 4) Take a leap of faith and assume Segregated Witness fixes all
>    malleability.
>
> I was debating between #1 and #3 for a while, but eventually settled on
> #4.  Here's why:
>
> 1) While still pre-BIP, Pieter Wuille is working on a prototype now
>    (Luke Jr came up with a sanish way of softforking it in).
> 2) Other parts of the lightning code (in particular, watching bitcoin
>    transactions) become significantly simpler if malleability is
>    ignored.
> 3) It's the right thing for Bitcoin; all smart contract systems want
>    this.
>
> This result is NOP for lightning in the short term; assuming SW is the
> same as pretending malleability doesn't exist.  But if we need to add
> malleability support later, it's going to be painful, since handling it
> correctly in all the places it's missing will be hard.
>
> Cheers,
> Rusty.
> PS.  Remember, every project has 3 major disasters.  Just wait until you
>      see the next two!
>
> [1] https://github.com/ElementsProject/lightning/blob/master/doc/deployable-lightning.pdf
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
Pierre in reply to CJP permalink original

Hi guys,

Do you know of any available resources on "segregated witness" ? I couldn't find any.

Cheers,

Pierre

sickpig in reply to Pierre permalink original

Hi Pierre

you could start here

https://github.com/ElementsProject/elementsproject.github.io#segregated-witness https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf https://github.com/ElementsProject/elements

On Thu, Nov 19, 2015 at 1:29 PM, Pierre <pm+lists at acinq.fr> wrote:

Quoted text (13 lines)
> Hi guys,
>
> Do you know of any available resources on "segregated witness" ? I
> couldn't find any.
>
> Cheers,
>
> Pierre
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
Glenn Tarbox, PhD in reply to sickpig permalink original

On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com <sickpig at gmail.com> wrote:

Quoted text (8 lines)
> Hi Pierre
>
> you could start here
>
>
> https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
> https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
> https://github.com/ElementsProject/elements

There was a brief blip on Reddit:

https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh

Its weird how little information there is on Segregated Witness. I'm guessing its a simple concept and those working on it (sipa / gmaxwell) haven't felt the need to write it up.

That it "apparently" can be done with a soft fork similar to P2SH is good news... I guess...

Greg Sanders in reply to Glenn Tarbox, PhD permalink original

The hardfork variant is quite simple, if I understood it correctly. You just stick the signatures in another parallel merkle tree. So if you don't want to validate signatures, just don't download them, and validate everything else. TXIDs don't use the signature at all. Nothing to malleate, AFAIK. Not sure what the softfork plan is, but it will be a talk at Scaling Bitcoin HK.

On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD <glenn at tarbox.org> wrote:

Quoted text (38 lines)
>
> On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com <sickpig at gmail.com>
> wrote:
>
>> Hi Pierre
>>
>> you could start here
>>
>>
>> https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>>
>> https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>> https://github.com/ElementsProject/elements
>
>
> There was a brief blip on Reddit:
>
>
> https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>
> Its weird how little information there is on Segregated Witness.  I'm
> guessing its a simple concept and those working on it (sipa / gmaxwell)
> haven't felt the need to write it up.
>
> That it "apparently" can be done with a soft fork similar to P2SH is good
> news... I guess...
>
>
> --
> Glenn H. Tarbox, PhD
>  =]|[=
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Pierre in reply to Greg Sanders permalink original
Quoted text (1 line)
> it will be a talk at Scaling Bitcoin HK.

That's great news! Looking forward to it

Mark F in reply to Greg Sanders permalink original

The basic idea of the soft-fork plan is very simple --- have the scriptPubKey be just the 20-byte hash of the redeem script. The scriptSig of the spending input is empty. The actual scriptSig, with the redeem script and signatures, is contained in a separate Merkle tree committed to elsewhere in the block (e.g. in the last output of the coinbase, or the last output of the last transaction).

On Thu, Nov 19, 2015 at 7:31 AM, Greg Sanders <gsanders87 at gmail.com> wrote:

Quoted text (55 lines)
> The hardfork variant is quite simple, if I understood it correctly. You
> just stick the signatures in another parallel merkle tree. So if you don't
> want to validate signatures, just don't download them, and validate
> everything else. TXIDs don't use the signature at all. Nothing to malleate,
> AFAIK. Not sure what the softfork plan is, but it will be a talk at Scaling
> Bitcoin HK.
>
> On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD <glenn at tarbox.org>
> wrote:
>
>>
>> On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com <sickpig at gmail.com>
>> wrote:
>>
>>> Hi Pierre
>>>
>>> you could start here
>>>
>>>
>>> https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>>>
>>> https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>>> https://github.com/ElementsProject/elements
>>
>>
>> There was a brief blip on Reddit:
>>
>>
>> https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>>
>> Its weird how little information there is on Segregated Witness.  I'm
>> guessing its a simple concept and those working on it (sipa / gmaxwell)
>> haven't felt the need to write it up.
>>
>> That it "apparently" can be done with a soft fork similar to P2SH is good
>> news... I guess...
>>
>>
>> --
>> Glenn H. Tarbox, PhD
>>  =]|[=
>>
>> _______________________________________________
>> 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
>
>
Tadge Dryja in reply to Mark F permalink original

I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses many vectors for txid malleability, but maybe there are more. And more importantly, it addresses 3rd party malleability. It's not helpful in the context of lightning channel creation because ECDSA sigs are inherently malleable. You can always re-sign the same message with a different k-value and get a different signature.

The functionality that's needed is to be able to reliably spend from unconfirmed transactions. Segregated witness can accomplish that, but it quite a large hard-fork change. sighash_noinput can also accomplish that: as input txids are not signed, if they change, the spending transaction can be modified while leaving counterparty signatures intact.

I'm hoping to start a new "testnet-L" similar to testnet3, with this sighash type so that we can test malleability mitigation out.

(Oh also, hi mailing list, sorry I have not posted till now! But I will start posting!)

-Tadge

On Thu, Nov 19, 2015 at 9:56 AM, Mark Friedenbach <mark at friedenbach.org> wrote:

Quoted text (72 lines)
> The basic idea of the soft-fork plan is very simple --- have the
> scriptPubKey be just the 20-byte hash of the redeem script. The scriptSig
> of the spending input is empty. The actual scriptSig, with the redeem
> script and signatures, is contained in a separate Merkle tree committed to
> elsewhere in the block (e.g. in the last output of the coinbase, or the
> last output of the last transaction).
>
> On Thu, Nov 19, 2015 at 7:31 AM, Greg Sanders <gsanders87 at gmail.com>
> wrote:
>
>> The hardfork variant is quite simple, if I understood it correctly. You
>> just stick the signatures in another parallel merkle tree. So if you don't
>> want to validate signatures, just don't download them, and validate
>> everything else. TXIDs don't use the signature at all. Nothing to malleate,
>> AFAIK. Not sure what the softfork plan is, but it will be a talk at Scaling
>> Bitcoin HK.
>>
>> On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD <glenn at tarbox.org>
>> wrote:
>>
>>>
>>> On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com <sickpig at gmail.com>
>>> wrote:
>>>
>>>> Hi Pierre
>>>>
>>>> you could start here
>>>>
>>>>
>>>> https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>>>>
>>>> https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>>>> https://github.com/ElementsProject/elements
>>>
>>>
>>> There was a brief blip on Reddit:
>>>
>>>
>>> https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>>>
>>> Its weird how little information there is on Segregated Witness.  I'm
>>> guessing its a simple concept and those working on it (sipa / gmaxwell)
>>> haven't felt the need to write it up.
>>>
>>> That it "apparently" can be done with a soft fork similar to P2SH is
>>> good news... I guess...
>>>
>>>
>>> --
>>> Glenn H. Tarbox, PhD
>>>  =]|[=
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
zaki in reply to Tadge Dryja permalink original

sighhash_noinput is the miner chooses which which utxo is consumed assuming there are multiple candidates variant of the idea?

On Thu, Nov 19, 2015 at 11:12 AM, Tadge Dryja <tadge at lightning.network> wrote:

Quoted text (103 lines)
> I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses many
> vectors for txid malleability, but maybe there are more.  And more
> importantly, it addresses 3rd party malleability.  It's not helpful in the
> context of lightning channel creation because ECDSA sigs are inherently
> malleable.  You can always re-sign the same message with a different
> k-value and get a different signature.
>
> The functionality that's needed is to be able to reliably spend from
> unconfirmed transactions.  Segregated witness can accomplish that, but it
> quite a large hard-fork change.  sighash_noinput can also accomplish that:
> as input txids are not signed, if they change, the spending transaction can
> be modified while leaving counterparty signatures intact.
>
> I'm hoping to start a new "testnet-L" similar to testnet3, with this
> sighash type so that we can test malleability mitigation out.
>
> (Oh also, hi mailing list, sorry I have not posted till now!  But I will
> start posting!)
>
> -Tadge
>
> On Thu, Nov 19, 2015 at 9:56 AM, Mark Friedenbach <mark at friedenbach.org>
> wrote:
>
>> The basic idea of the soft-fork plan is very simple --- have the
>> scriptPubKey be just the 20-byte hash of the redeem script. The scriptSig
>> of the spending input is empty. The actual scriptSig, with the redeem
>> script and signatures, is contained in a separate Merkle tree committed to
>> elsewhere in the block (e.g. in the last output of the coinbase, or the
>> last output of the last transaction).
>>
>> On Thu, Nov 19, 2015 at 7:31 AM, Greg Sanders <gsanders87 at gmail.com>
>> wrote:
>>
>>> The hardfork variant is quite simple, if I understood it correctly. You
>>> just stick the signatures in another parallel merkle tree. So if you don't
>>> want to validate signatures, just don't download them, and validate
>>> everything else. TXIDs don't use the signature at all. Nothing to malleate,
>>> AFAIK. Not sure what the softfork plan is, but it will be a talk at Scaling
>>> Bitcoin HK.
>>>
>>> On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD <glenn at tarbox.org>
>>> wrote:
>>>
>>>>
>>>> On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com <sickpig at gmail.com>
>>>> wrote:
>>>>
>>>>> Hi Pierre
>>>>>
>>>>> you could start here
>>>>>
>>>>>
>>>>> https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>>>>>
>>>>> https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>>>>> https://github.com/ElementsProject/elements
>>>>
>>>>
>>>> There was a brief blip on Reddit:
>>>>
>>>>
>>>> https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>>>>
>>>> Its weird how little information there is on Segregated Witness.  I'm
>>>> guessing its a simple concept and those working on it (sipa / gmaxwell)
>>>> haven't felt the need to write it up.
>>>>
>>>> That it "apparently" can be done with a soft fork similar to P2SH is
>>>> good news... I guess...
>>>>
>>>>
>>>> --
>>>> Glenn H. Tarbox, PhD
>>>>  =]|[=
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
Tadge Dryja in reply to zaki permalink original

With sighash_noinput, signers don't include their input's txid and index. An even more powerful version would not even sign the pubkeyscript of the input, which would allow some cool constructions.

In the case that there are multiple utxo outpoints which would be satisfied by a single signature, miners can decide. It can be dangerous for this reason if you re-use pubkeys. So don't! Especially in a multisig setting, it seems unlikely to be a problem.

-Tadge

On Thu, Nov 19, 2015 at 11:15 AM, zaki at manian.org <zaki at manian.org> wrote:

Quoted text (112 lines)
> sighhash_noinput is the miner chooses which which utxo is consumed
> assuming there are multiple candidates variant of the idea?
>
>
>
> On Thu, Nov 19, 2015 at 11:12 AM, Tadge Dryja <tadge at lightning.network>
> wrote:
>
>> I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses many
>> vectors for txid malleability, but maybe there are more.  And more
>> importantly, it addresses 3rd party malleability.  It's not helpful in the
>> context of lightning channel creation because ECDSA sigs are inherently
>> malleable.  You can always re-sign the same message with a different
>> k-value and get a different signature.
>>
>> The functionality that's needed is to be able to reliably spend from
>> unconfirmed transactions.  Segregated witness can accomplish that, but it
>> quite a large hard-fork change.  sighash_noinput can also accomplish that:
>> as input txids are not signed, if they change, the spending transaction can
>> be modified while leaving counterparty signatures intact.
>>
>> I'm hoping to start a new "testnet-L" similar to testnet3, with this
>> sighash type so that we can test malleability mitigation out.
>>
>> (Oh also, hi mailing list, sorry I have not posted till now!  But I will
>> start posting!)
>>
>> -Tadge
>>
>> On Thu, Nov 19, 2015 at 9:56 AM, Mark Friedenbach <mark at friedenbach.org>
>> wrote:
>>
>>> The basic idea of the soft-fork plan is very simple --- have the
>>> scriptPubKey be just the 20-byte hash of the redeem script. The scriptSig
>>> of the spending input is empty. The actual scriptSig, with the redeem
>>> script and signatures, is contained in a separate Merkle tree committed to
>>> elsewhere in the block (e.g. in the last output of the coinbase, or the
>>> last output of the last transaction).
>>>
>>> On Thu, Nov 19, 2015 at 7:31 AM, Greg Sanders <gsanders87 at gmail.com>
>>> wrote:
>>>
>>>> The hardfork variant is quite simple, if I understood it correctly. You
>>>> just stick the signatures in another parallel merkle tree. So if you don't
>>>> want to validate signatures, just don't download them, and validate
>>>> everything else. TXIDs don't use the signature at all. Nothing to malleate,
>>>> AFAIK. Not sure what the softfork plan is, but it will be a talk at Scaling
>>>> Bitcoin HK.
>>>>
>>>> On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD <glenn at tarbox.org>
>>>> wrote:
>>>>
>>>>>
>>>>> On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com <sickpig at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hi Pierre
>>>>>>
>>>>>> you could start here
>>>>>>
>>>>>>
>>>>>> https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>>>>>>
>>>>>> https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>>>>>> https://github.com/ElementsProject/elements
>>>>>
>>>>>
>>>>> There was a brief blip on Reddit:
>>>>>
>>>>>
>>>>> https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>>>>>
>>>>> Its weird how little information there is on Segregated Witness.  I'm
>>>>> guessing its a simple concept and those working on it (sipa / gmaxwell)
>>>>> haven't felt the need to write it up.
>>>>>
>>>>> That it "apparently" can be done with a soft fork similar to P2SH is
>>>>> good news... I guess...
>>>>>
>>>>>
>>>>> --
>>>>> Glenn H. Tarbox, PhD
>>>>>  =]|[=
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>>
>>>>
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
Douglas Roark in reply to Pierre permalink original

On 2015/11/19 04:29, Pierre wrote:

Quoted text (2 lines)
> Do you know of any available resources on "segregated witness" ? I
> couldn't find any.

On top of what others have posted, it looks like Pieter has posted code for a hard fork version over at alpha (https://github.com/ElementsProject/elements/commit/663e9bd32965008a43a0 8d1d26ea09cbb14e83aa). I doubt it's everything you need but I think this will give you an idea of the nuts & bolts for the hard fork version. I'm not aware of any public soft fork code.

Doug

Matt Corallo in reply to Tadge Dryja permalink original

Nope, Luke came up with a way to do it in a soft-fork.

On 11/19/15 19:12, Tadge Dryja wrote:

Quoted text (106 lines)
> I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses
> many vectors for txid malleability, but maybe there are more.  And more
> importantly, it addresses 3rd party malleability.  It's not helpful in
> the context of lightning channel creation because ECDSA sigs are
> inherently malleable.  You can always re-sign the same message with a
> different k-value and get a different signature.
>
> The functionality that's needed is to be able to reliably spend from
> unconfirmed transactions.  Segregated witness can accomplish that, but
> it quite a large hard-fork change.  sighash_noinput can also accomplish
> that: as input txids are not signed, if they change, the spending
> transaction can be modified while leaving counterparty signatures intact.
>
> I'm hoping to start a new "testnet-L" similar to testnet3, with this
> sighash type so that we can test malleability mitigation out.
>
> (Oh also, hi mailing list, sorry I have not posted till now!  But I will
> start posting!)
>
> -Tadge
>
> On Thu, Nov 19, 2015 at 9:56 AM, Mark Friedenbach <mark at friedenbach.org
> <mailto:mark at friedenbach.org>> wrote:
>
>     The basic idea of the soft-fork plan is very simple --- have the
>     scriptPubKey be just the 20-byte hash of the redeem script. The
>     scriptSig of the spending input is empty. The actual scriptSig, with
>     the redeem script and signatures, is contained in a separate Merkle
>     tree committed to elsewhere in the block (e.g. in the last output of
>     the coinbase, or the last output of the last transaction).
>
>     On Thu, Nov 19, 2015 at 7:31 AM, Greg Sanders <gsanders87 at gmail.com
>     <mailto:gsanders87 at gmail.com>> wrote:
>
>         The hardfork variant is quite simple, if I understood it
>         correctly. You just stick the signatures in another parallel
>         merkle tree. So if you don't want to validate signatures, just
>         don't download them, and validate everything else. TXIDs don't
>         use the signature at all. Nothing to malleate, AFAIK. Not sure
>         what the softfork plan is, but it will be a talk at Scaling
>         Bitcoin HK.
>
>         On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD
>         <glenn at tarbox.org <mailto:glenn at tarbox.org>> wrote:
>
>
>             On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com
>             <mailto:sickpig at gmail.com> <sickpig at gmail.com
>             <mailto:sickpig at gmail.com>> wrote:
>
>                 Hi Pierre
>
>                 you could start here
>
>                 https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>                 https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>                 https://github.com/ElementsProject/elements
>
>
>             There was a brief blip on Reddit:
>
>             https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>
>             Its weird how little information there is on Segregated
>             Witness.  I'm guessing its a simple concept and those
>             working on it (sipa / gmaxwell) haven't felt the need to
>             write it up.
>
>             That it "apparently" can be done with a soft fork similar to
>             P2SH is good news... I guess...
>
>
>             --
>             Glenn H. Tarbox, PhD
>               =]|[=
>
>             _______________________________________________
>             Lightning-dev mailing list
>             Lightning-dev at lists.linuxfoundation.org
>             <mailto:Lightning-dev at lists.linuxfoundation.org>
>             https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
>
>         _______________________________________________
>         Lightning-dev mailing list
>         Lightning-dev at lists.linuxfoundation.org
>         <mailto:Lightning-dev at lists.linuxfoundation.org>
>         https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
>
>     _______________________________________________
>     Lightning-dev mailing list
>     Lightning-dev at lists.linuxfoundation.org
>     <mailto: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
>
Tadge Dryja in reply to Matt Corallo permalink original

Cool, I had not seen that, I'll take a look. I'm all for anything that allows reliable spends from unconfirmed txs. If SW can get in easier, sounds good.

-Tadge

On Thu, Nov 19, 2015 at 11:38 AM, Matt Corallo <lf-lists at mattcorallo.com> wrote:

Quoted text (115 lines)
> Nope, Luke came up with a way to do it in a soft-fork.
>
> On 11/19/15 19:12, Tadge Dryja wrote:
>
>> I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses
>> many vectors for txid malleability, but maybe there are more.  And more
>> importantly, it addresses 3rd party malleability.  It's not helpful in
>> the context of lightning channel creation because ECDSA sigs are
>> inherently malleable.  You can always re-sign the same message with a
>> different k-value and get a different signature.
>>
>> The functionality that's needed is to be able to reliably spend from
>> unconfirmed transactions.  Segregated witness can accomplish that, but
>> it quite a large hard-fork change.  sighash_noinput can also accomplish
>> that: as input txids are not signed, if they change, the spending
>> transaction can be modified while leaving counterparty signatures intact.
>>
>> I'm hoping to start a new "testnet-L" similar to testnet3, with this
>> sighash type so that we can test malleability mitigation out.
>>
>> (Oh also, hi mailing list, sorry I have not posted till now!  But I will
>> start posting!)
>>
>> -Tadge
>>
>> On Thu, Nov 19, 2015 at 9:56 AM, Mark Friedenbach <mark at friedenbach.org
>> <mailto:mark at friedenbach.org>> wrote:
>>
>>     The basic idea of the soft-fork plan is very simple --- have the
>>     scriptPubKey be just the 20-byte hash of the redeem script. The
>>     scriptSig of the spending input is empty. The actual scriptSig, with
>>     the redeem script and signatures, is contained in a separate Merkle
>>     tree committed to elsewhere in the block (e.g. in the last output of
>>     the coinbase, or the last output of the last transaction).
>>
>>     On Thu, Nov 19, 2015 at 7:31 AM, Greg Sanders <gsanders87 at gmail.com
>>     <mailto:gsanders87 at gmail.com>> wrote:
>>
>>         The hardfork variant is quite simple, if I understood it
>>         correctly. You just stick the signatures in another parallel
>>         merkle tree. So if you don't want to validate signatures, just
>>         don't download them, and validate everything else. TXIDs don't
>>         use the signature at all. Nothing to malleate, AFAIK. Not sure
>>         what the softfork plan is, but it will be a talk at Scaling
>>         Bitcoin HK.
>>
>>         On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD
>>         <glenn at tarbox.org <mailto:glenn at tarbox.org>> wrote:
>>
>>
>>             On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com
>>             <mailto:sickpig at gmail.com> <sickpig at gmail.com
>>             <mailto:sickpig at gmail.com>> wrote:
>>
>>                 Hi Pierre
>>
>>                 you could start here
>>
>>
>> https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>>
>> https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>>                 https://github.com/ElementsProject/elements
>>
>>
>>             There was a brief blip on Reddit:
>>
>>
>> https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>>
>>             Its weird how little information there is on Segregated
>>             Witness.  I'm guessing its a simple concept and those
>>             working on it (sipa / gmaxwell) haven't felt the need to
>>             write it up.
>>
>>             That it "apparently" can be done with a soft fork similar to
>>             P2SH is good news... I guess...
>>
>>
>>             --
>>             Glenn H. Tarbox, PhD
>>               =]|[=
>>
>>             _______________________________________________
>>             Lightning-dev mailing list
>>             Lightning-dev at lists.linuxfoundation.org
>>             <mailto:Lightning-dev at lists.linuxfoundation.org>
>>
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>>
>>
>>         _______________________________________________
>>         Lightning-dev mailing list
>>         Lightning-dev at lists.linuxfoundation.org
>>         <mailto:Lightning-dev at lists.linuxfoundation.org>
>>         https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>>
>>
>>     _______________________________________________
>>     Lightning-dev mailing list
>>     Lightning-dev at lists.linuxfoundation.org
>>     <mailto: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
>>
>>
Matt Corallo in reply to Tadge Dryja permalink original

Its still a huge code change that hasnt been significantly discussed publicly, so I think opinions on what to do have yet to solidify, but (at the risk of putting words in other people's mouths) I think a part of retracting BIP62 is because Pieter wants to push this forward.

On 11/19/15 19:40, Tadge Dryja wrote:

Quoted text (159 lines)
> Cool, I had not seen that, I'll take a look.  I'm all for anything that
> allows reliable spends from unconfirmed txs.  If SW can get in easier,
> sounds good.
>
> -Tadge
>
> On Thu, Nov 19, 2015 at 11:38 AM, Matt Corallo <lf-lists at mattcorallo.com
> <mailto:lf-lists at mattcorallo.com>> wrote:
>
>     Nope, Luke came up with a way to do it in a soft-fork.
>
>     On 11/19/15 19:12, Tadge Dryja wrote:
>
>         I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses
>         many vectors for txid malleability, but maybe there are more.
>         And more
>         importantly, it addresses 3rd party malleability.  It's not
>         helpful in
>         the context of lightning channel creation because ECDSA sigs are
>         inherently malleable.  You can always re-sign the same message
>         with a
>         different k-value and get a different signature.
>
>         The functionality that's needed is to be able to reliably spend from
>         unconfirmed transactions.  Segregated witness can accomplish
>         that, but
>         it quite a large hard-fork change.  sighash_noinput can also
>         accomplish
>         that: as input txids are not signed, if they change, the spending
>         transaction can be modified while leaving counterparty
>         signatures intact.
>
>         I'm hoping to start a new "testnet-L" similar to testnet3, with this
>         sighash type so that we can test malleability mitigation out.
>
>         (Oh also, hi mailing list, sorry I have not posted till now!
>         But I will
>         start posting!)
>
>         -Tadge
>
>         On Thu, Nov 19, 2015 at 9:56 AM, Mark Friedenbach
>         <mark at friedenbach.org <mailto:mark at friedenbach.org>
>         <mailto:mark at friedenbach.org <mailto:mark at friedenbach.org>>> wrote:
>
>              The basic idea of the soft-fork plan is very simple ---
>         have the
>              scriptPubKey be just the 20-byte hash of the redeem script. The
>              scriptSig of the spending input is empty. The actual
>         scriptSig, with
>              the redeem script and signatures, is contained in a
>         separate Merkle
>              tree committed to elsewhere in the block (e.g. in the last
>         output of
>              the coinbase, or the last output of the last transaction).
>
>              On Thu, Nov 19, 2015 at 7:31 AM, Greg Sanders
>         <gsanders87 at gmail.com <mailto:gsanders87 at gmail.com>
>              <mailto:gsanders87 at gmail.com
>         <mailto:gsanders87 at gmail.com>>> wrote:
>
>                  The hardfork variant is quite simple, if I understood it
>                  correctly. You just stick the signatures in another
>         parallel
>                  merkle tree. So if you don't want to validate
>         signatures, just
>                  don't download them, and validate everything else.
>         TXIDs don't
>                  use the signature at all. Nothing to malleate, AFAIK.
>         Not sure
>                  what the softfork plan is, but it will be a talk at Scaling
>                  Bitcoin HK.
>
>                  On Thu, Nov 19, 2015 at 10:28 AM, Glenn Tarbox, PhD
>                  <glenn at tarbox.org <mailto:glenn at tarbox.org>
>         <mailto:glenn at tarbox.org <mailto:glenn at tarbox.org>>> wrote:
>
>
>                      On Thu, Nov 19, 2015 at 4:33 AM, sickpig at gmail.com
>         <mailto:sickpig at gmail.com>
>                      <mailto:sickpig at gmail.com
>         <mailto:sickpig at gmail.com>> <sickpig at gmail.com
>         <mailto:sickpig at gmail.com>
>                      <mailto:sickpig at gmail.com
>         <mailto:sickpig at gmail.com>>> wrote:
>
>                          Hi Pierre
>
>                          you could start here
>
>         https://github.com/ElementsProject/elementsproject.github.io#segregated-witness
>         https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf
>         https://github.com/ElementsProject/elements
>
>
>                      There was a brief blip on Reddit:
>
>         https://www.reddit.com/r/Bitcoin/comments/3ngtx5/could_the_segregated_witness_part_of_the/cwnthlh
>
>                      Its weird how little information there is on Segregated
>                      Witness.  I'm guessing its a simple concept and those
>                      working on it (sipa / gmaxwell) haven't felt the
>         need to
>                      write it up.
>
>                      That it "apparently" can be done with a soft fork
>         similar to
>                      P2SH is good news... I guess...
>
>
>                      --
>                      Glenn H. Tarbox, PhD
>                        =]|[=
>
>                      _______________________________________________
>                      Lightning-dev mailing list
>         Lightning-dev at lists.linuxfoundation.org
>         <mailto:Lightning-dev at lists.linuxfoundation.org>
>                      <mailto:Lightning-dev at lists.linuxfoundation.org
>         <mailto:Lightning-dev at lists.linuxfoundation.org>>
>         https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
>
>                  _______________________________________________
>                  Lightning-dev mailing list
>         Lightning-dev at lists.linuxfoundation.org
>         <mailto:Lightning-dev at lists.linuxfoundation.org>
>                  <mailto:Lightning-dev at lists.linuxfoundation.org
>         <mailto:Lightning-dev at lists.linuxfoundation.org>>
>         https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
>
>              _______________________________________________
>              Lightning-dev mailing list
>         Lightning-dev at lists.linuxfoundation.org
>         <mailto:Lightning-dev at lists.linuxfoundation.org>
>              <mailto:Lightning-dev at lists.linuxfoundation.org
>         <mailto:Lightning-dev at lists.linuxfoundation.org>>
>         https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
>
>
>         _______________________________________________
>         Lightning-dev mailing list
>         Lightning-dev at lists.linuxfoundation.org
>         <mailto: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
>
Bryan Bishop in reply to Pierre permalink original

On Thu, Nov 19, 2015 at 6:29 AM, Pierre <pm+lists at acinq.fr> wrote:

Quoted text (3 lines)
> Do you know of any available resources on "segregated witness" ? I
> couldn't find any.
>

http://gnusha.org/bitcoin-wizards/2015-11-19.log http://gnusha.org/bitcoin-wizards/2015-11-08.log

http://diyhpl.us/wiki/transcripts/gmaxwell-sidechains-elements/ https://github.com/ElementsProject/elementsproject.github.io#segregated-witness https://people.xiph.org/~greg/blockstream.gmaxwell.elements.talk.060815.pdf

- Bryan http://heybryan.org/ • ••• ••• ••••

Rusty Russell in reply to Tadge Dryja permalink original

Tadge Dryja <tadge at lightning.network> writes:

Quoted text (6 lines)
> I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses many
> vectors for txid malleability, but maybe there are more.  And more
> importantly, it addresses 3rd party malleability.  It's not helpful in the
> context of lightning channel creation because ECDSA sigs are inherently
> malleable.  You can always re-sign the same message with a different
> k-value and get a different signature.

Yeah, that's why the deployable lightning model used single-sided funding (the escape tx model also works).

Quoted text (3 lines)
> The functionality that's needed is to be able to reliably spend from
> unconfirmed transactions.  Segregated witness can accomplish that, but it
> quite a large hard-fork change.

The excitement is because the proposal is to soft-forked it in. Seems like it might work, but I'll have to see how ugly it is.

Quoted text (3 lines)
> sighash_noinput can also accomplish that:
> as input txids are not signed, if they change, the spending transaction can
> be modified while leaving counterparty signatures intact.

I was trying to a new OP_CHECKSIG2, because I'm fairly sure we're going to take years to winnow down the set of features. I expect it will logjam on "new sig flags" "schnorr!" "scriptable signature parts" etc...

Quoted text (5 lines)
> I'm hoping to start a new "testnet-L" similar to testnet3, with this
> sighash type so that we can test malleability mitigation out.
>
> (Oh also, hi mailing list, sorry I have not posted till now!  But I will
> start posting!)

Welcome :)

Cheers, Rusty.

Peter Todd in reply to Tadge Dryja permalink original

On Thu, Nov 19, 2015 at 11:12:24AM -0800, Tadge Dryja wrote:

Quoted text (10 lines)
> I've joked that BIP62 is the "whack-a-mole" BIP in that it addresses many
> vectors for txid malleability, but maybe there are more.  And more
> importantly, it addresses 3rd party malleability.  It's not helpful in the
> context of lightning channel creation because ECDSA sigs are inherently
> malleable.  You can always re-sign the same message with a different
> k-value and get a different signature.
>
> The functionality that's needed is to be able to reliably spend from
> unconfirmed transactions.  Segregated witness can accomplish that, but it
> quite a large hard-fork change.  sighash_noinput can also accomplish that:

It's definitely not a hard-fork change.

In fact, I'll point out that in general it's actually pretty hard to come up with features that absolutely must be implemented as hard fork changes.