<oembed><type>rich</type><version>1.0</version><author_name>npub1wtx5qvewc7pd6znlvwktq03mdld05mv3h5dkzfwd3dc30gdmsptsugtuyn</author_name><author_url>https://nostr.ae/npub1wtx5qvewc7pd6znlvwktq03mdld05mv3h5dkzfwd3dc30gdmsptsugtuyn</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2019-10-03&#xA;📝 Original message:Chris Stewart &lt;chris at suredbits.com&gt; writes:&#xA;&#xA;&gt; I do have some concerns about SIGHASH_NOINPUT, mainly that it does&#xA;&gt; introduce another footgun into the bitcoin protocol with address reuse.&#xA;&gt; It&#39;s common practice for bitcoin businesses to re-use addresses. Many&#xA;&gt; exchanges [1] reuse addresses for cold storage with very large sums of&#xA;&gt; money that is stored in these addreses.&#xA;&gt;&#xA;&gt; It is my understanding with this part of BIP118&#xA;&gt;&#xA;&gt;&gt;Using NOINPUT the input containing the signature no longer references a&#xA;&gt; specific output. Any participant can take a transaction and rewrite it by&#xA;&gt; changing the hash reference to the previous output, without invalidating&#xA;&gt; the signatures. This allows transactions to be bound to any output that&#xA;&gt; matches the value committed to in the witness and whose witnessProgram,&#xA;&gt; combined with the spending transaction&#39;s witness returns true.&#xA;&gt;&#xA;&gt; if an exchange were to once produce a digital signature from that cold&#xA;&gt; storage address with a SIGHASH_NOINPUT signature, that signature can be&#xA;&gt; replayed again and again on the blockchain until their wallet is drained.&#xA;&gt; This might be able to mitigated since the signatures commit to outputs,&#xA;&gt; which may be small in value for the transaction that SIGHASH_NOINPUT was&#xA;&gt; used. This means that an exchange could move coins from the address with a&#xA;&gt; larger transaction that spends money to a new output (and presumably pays a&#xA;&gt; higher fee than the smaller transactions).&#xA;&#xA;Thanks for sharing your concerns Chris, I do agree that noinput and&#xA;friends are a very sharp knife that needs to be treated carefully, but&#xA;ultimately it&#39;s exactly its sharpness that makes it useful :-)&#xA;&#xA;&gt; ### Why does this matter?&#xA;&gt;&#xA;&gt; It seems that SIGHASH_NOINPUT will be an extremely useful tool for offchain&#xA;&gt; protocols like Lightning. This gives us the building blocks for enforcing&#xA;&gt; specific offchain states to end up onchain [2].&#xA;&gt;&#xA;&gt; Since this tool is useful, we can presume that it will be integrated into&#xA;&gt; the signing path of large economic entities in bitcoin -- namely exchanges.&#xA;&gt; Many exchanges have specific signing procedures for transactions that are&#xA;&gt; leaving an exchange that is custom software. Now -- presuming wide adoption&#xA;&gt; of off chain protocols -- they will need to have a _second unique signing&#xA;&gt; path that uses SIGHASH_NOINPUT_.&#xA;&gt;&#xA;&gt; It is imperative that this second signing path -- which uses&#xA;&gt; SIGHASH_NOINPUT -- does NOT get mixed up with the first signing path that&#xA;&gt; controls an exchanges onchain funds. If this were to happen, fund lost&#xA;&gt; could occur if the exchange is reusing address, which seems to be common&#xA;&gt; practice.&#xA;&#xA;Totally agreed, and as you point out, BIP118 is careful to mandate&#xA;separate private keys be used for off-chain contracts and that the&#xA;off-chain contract never be mixed with the remainder of your funds. The&#xA;way eltoo uses noinput we selectively open us up to replay attacks&#xA;(because that&#39;s what the update mechanism is after all) by controlling&#xA;the way the transactions can be replayed very carefully, and any other&#xA;use of noinput would need to make sure to have the same guarantees.&#xA;However, once we have separated the two domains, we can simply use a&#xA;separate (hardened) derivation path from a seed key, and never mix them&#xA;afterwards. We never exchange any private keys, so even leaking info&#xA;across derived keys is not an issue here.&#xA;&#xA;&gt; This is stated here in BIP118:&#xA;&gt;&#xA;&gt;&gt;This also means that particular care has to be taken in order to avoid&#xA;&gt; unintentionally enabling this rebinding mechanism. NOINPUT MUST NOT be&#xA;&gt; used, unless it is explicitly needed for the application, e.g., it MUST NOT&#xA;&gt; be a default signing flag in a wallet implementation. Rebinding is only&#xA;&gt; possible when the outputs the transaction may bind to all use the same&#xA;&gt; public keys. Any public key that is used in a NOINPUT signature MUST only&#xA;&gt; be used for outputs that the input may bind to, and they MUST NOT be used&#xA;&gt; for transactions that the input may not bind to. For example an application&#xA;&gt; SHOULD generate a new key-pair for the application instance using NOINPUT&#xA;&gt; signatures and MUST NOT reuse them afterwards.&#xA;&gt;&#xA;&gt; This means we need to encourage onchain hot wallet signing procedures to be&#xA;&gt; kept separate from offchain hot wallet signing procedures, which introduces&#xA;&gt; more complexity for key management (two keychains).&#xA;&#xA;This is already the case: off-chain systems always require access to the&#xA;signing key in real-time in order to be useful. If any state change is&#xA;performed in a channel, even just adjusting fees or receiving a payment,&#xA;requires the signature from the key associated with the channel. With&#xA;high security on-chain systems on the other hand you should never have a&#xA;hot key that automatically signs off on transfers without human&#xA;intervention. So I find it unlikely that mandating the on-chain keys to&#xA;be kept separate from off-chain keys is any harder than what should be&#xA;done with the current systems.&#xA;&#xA;&gt; One (of the few) upsides of the current Lightning penalty mechanism is that&#xA;&gt; fund loss can be contained to balance of the channel. You cannot do&#xA;&gt; something in the current protocol that will effect your funds outside of&#xA;&gt; that channel. With SIGHASH_NOINPUT, that property changes.&#xA;&#xA;Good point, but if the key hygiene is maintained as detailed in BIP118,&#xA;i.e., off-chain keys must be kept separate from on-chain keys, and that&#xA;each off-chain contract instance uses a separate set of keys, that&#xA;property is maintained.&#xA;&#xA;Regards,&#xA;Christian</html></oembed>