Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Questions on SIGHASH_NOINPUT

4 messages, Nov 10 to 15, 2017. Started by Tomas.

Tomas (2), Rusty Russell (2)

Permalink First message in the Wayback Machine

Tomas permalink original

HI,

I have some questions regarding the proposal to use SIGHASH_NOINPUT on the bitcoin-dev mailing list. [1]

1. If I understand correctly, the problem of malleated transactions for LN is limited to the punishment transaction which is the only one that spends an unconfirmed transaction. Does that mean that with SIGHASH_NOINPUT, no other malleability fix would have been needed for LN to work? Am I correct that LN could function with (roughly) the same design without SegWit if SIGHASH_NOINPUT would be in place?

2. On the mailing list, it was argued that SIGHASH_NOINPUT is important to prevent excessive recreation and routing of punishment transaction to 3rd party monitoring services. Is this still important or have other solutions presented itself? Is work in this area still being done?

Thanks, Tomas van der Wansem bitcrust

[1] https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-February/012460.html

Rusty Russell in reply to Tomas permalink original

Tomas <tomas at bitcrust.org> writes:

Quoted text (11 lines)
> HI,
>
> I have some questions regarding the proposal to use  SIGHASH_NOINPUT on
> the bitcoin-dev mailing list. [1]
>
> 1. If I understand correctly, the problem of malleated transactions for
> LN is limited to the punishment transaction which is the only one that
> spends an unconfirmed transaction. Does that mean that with
> SIGHASH_NOINPUT, no other malleability fix would have been needed for LN
> to work? Am I correct that LN could function with (roughly) the same
> design without SegWit if SIGHASH_NOINPUT would be in place?

Malleation is a problem for every commitment transaction: we use HTLC transactions which depend on it. Now, in theory SIGHASH_NOINPUT could be used to work around malleation here too, by allowing you to update the dependent transaction, but you need separate keys on every output to ensure that transactions can't be connected to the wrong outputs.

Quoted text (4 lines)
> 2. On the mailing list, it was argued that SIGHASH_NOINPUT is important
> to prevent excessive recreation and routing of punishment transaction to
> 3rd party monitoring services. Is this still important or have other
> solutions presented itself? Is work in this area still being done?

IIRC it cuts the number of updates down by about a factor of 2 under typical use, more under weird conditions. Basically you can re-attach the HTLC transaction instead of needing a new one.

IMHO SIGHASH_NOINPUT is a generally nice thing to have, though it's extremely dangerous if you reuse keys at all. So, don't do that :)

Cheers, Rusty.

Tomas in reply to Rusty Russell permalink original

Thank you for your feedback,

On Sun, Nov 12, 2017, at 04:04, Rusty Russell wrote:

Quoted text (5 lines)
> Malleation is a problem for every commitment transaction: we use HTLC
> transactions which depend on it.  Now, in theory SIGHASH_NOINPUT could
> be used to work around malleation here too, by allowing you to update
> the dependent transaction, but you need separate keys on every output to
> ensure that transactions can't be connected to the wrong outputs.

But doesn't the current specification already ensure that every key is only used once? At least that is what I am understanding from the key derivation rules at:

https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md

Quoted text (7 lines)
>
> IIRC it cuts the number of updates down by about a factor of 2 under
> typical use, more under weird conditions.  Basically you can re-attach
> the HTLC transaction instead of needing a new one.
>
> IMHO SIGHASH_NOINPUT is a generally nice thing to have, though it's
> extremely dangerous if you reuse keys at all.  So, don't do that :)

If the prescribed key derivation algorithm ensures uniqueness, under what circumstances could the keys be reused? Is it just a faulty implementation here that is the risk?

Thank you, Tomas

Rusty Russell in reply to Tomas permalink original

Tomas <tomas at bitcrust.org> writes:

Quoted text (14 lines)
> Thank you for your feedback,
>
> On Sun, Nov 12, 2017, at 04:04, Rusty Russell wrote:
>> Malleation is a problem for every commitment transaction: we use HTLC
>> transactions which depend on it.  Now, in theory SIGHASH_NOINPUT could
>> be used to work around malleation here too, by allowing you to update
>> the dependent transaction, but you need separate keys on every output to
>> ensure that transactions can't be connected to the wrong outputs.
>
> But doesn't the current specification already ensure that every key is
> only used once? At least that is what I am understanding from the key
> derivation rules at:
>
> https://github.com/lightningnetwork/lightning-rfc/blob/master/03-transactions.md

It's different for different commitment transactions, not not for different HTLC outputs attached to the same transaction.

Quoted text (10 lines)
>> IIRC it cuts the number of updates down by about a factor of 2 under
>> typical use, more under weird conditions.  Basically you can re-attach
>> the HTLC transaction instead of needing a new one.
>>
>> IMHO SIGHASH_NOINPUT is a generally nice thing to have, though it's
>> extremely dangerous if you reuse keys at all.  So, don't do that :)
>
> If the prescribed key derivation algorithm ensures uniqueness, under
> what circumstances could the keys be reused? Is it just a faulty
> implementation here that is the risk?

Yes, if you reuse addresses, a signed SIGHASH_NOINPUT input can be attached to either one. This may (or may not) be a problem, depending on the exact usage.

Cheers, Rusty.