<div>Hi Lisa and all,<br></div><div><div><br></div></div><div>Given the discussion about utxos snooping, I wondered if there was any obvious drawbacks of using a transaction chain construction ?<br></div><div><div><br></div></div><div>Since the obvious target of the probing is the accepter, it seems that the opener needs to at least have something at stake in order to be revealed some of the accepter's utxos.<br></div><div>Thus, the opener giving the accepter a signed transaction commited to the channel opening is one way of avoiding the opener to probe gratuitously. I was thinking of something like:<br></div><div><div><br></div></div><div>A is opener, B is accepter.<br></div><div>A could sign the first input (and accordingly the 2of2 output) with SIGHASH_SINGLE|SIGHASH_ANYONECANPAY. Unfortunately this doesn't handle A's change, but it can be solved using a chain of transaction.<br></div><div>A creates a first transaction txA1:<br></div><pre><code>txA1 (SIGHASH_ALL)
 _________________ __________________________
| A's input 1    | A's channel participation |
|----------------|---------------------------
| A's input 2    | A's change                |
|----------------|---------------------------
| A's input n    |
|________________|
</code><br></pre><div>And then creates /signs the funding transaction out of the first output of txA1:<br></div><div><div><br></div></div><pre><code>txA2 (SIGHASH_SINGLE|SIGHASH_ANYONECANPAY)
 _________________ _______________
| txA1 vout 0    | 2of2 with B    |
|________________|________________</code><br></pre><div><div><br></div></div><div>Since txA2 is signed with SINGLE|ANYONECANPAY, B can add inputs to fulfill the value requirement of the 2of2, and add outputs for its own change.<br></div><div><div><br></div></div><div>This comes at the cost of more setup fees opener-side, but avoids the accepter to be gratuitously probed, so this is arguably a far lesser evil.<br></div><div>Is there any other downside I'm missing here ?<br></div><div><div><br></div></div><div>Antoine<br></div><div><div><br></div></div><div><br></div><div>‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐<br></div><div> Le mardi, janvier 28, 2020 2:51 AM, lisa neigut <niftynei@gmail.com> a écrit :<br></div><div> <br></div><blockquote class="protonmail_quote" type="cite"><div dir="ltr"><span><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">Some of the feedback I received from the check-in for the dual-funding proposal this past Monday was along the lines that we look at simplifying for breaking it into smaller, more manageable chunks.</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">The biggest piece of the dual-funding protocol update is definitely the move from a single peer </span></span></span></span><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">constructing a transaction to two participants. We're also going to likely want to reuse this </span></span></span></span><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">portion of the protocol for batched closings and splicing. To that extent, it seemed useful </span></span></span></span><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">to highlight it in a separate email.</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">This is a change from the existing proposal in the dual-funding </span></span></span></span><a href="https://github.com/lightningnetwork/lightning-rfc/pull/524" style="text-decoration-line:none"><span style="background-color:transparent"><span style="font-family:Arial"><span style="font-size:11pt">PR #524</span></span></span></a><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt"> -- it allows for </span></span></span></span><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">the removal of inputs and outputs.</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">The set of messages are as follows.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt"></span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">Note that the 'initiation' of this protocol will be </span></span></span></span><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">different depending on the case of the transaction (open, close or splice):</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. type:   440 `tx_add_input`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`32*byte`:`channel_identifier`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u64`:`sats`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`sha256`:`prevtx_txid`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u32`:`prevtx_vout`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`prevtx_scriptpubkey_len`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`prevtx_scriptpubkey_len*byte`:`prevtx_scriptpubkey`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`max_witness_len`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`scriptlen`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`scriptlen*byte`:`script`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`byte`:`signal_rbf`]</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. type: 442 `tx_add_output`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`32*byte`:`channel_identifier`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u64`:`sats`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`scriptlen`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`scriptlen*byte`:`script`]</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. type: 444 `tx_remove_input`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`32*byte`:`channel_identifier`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`sha256`:`prevtx_txid`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u32`:`prevtx_vout`]</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. type: 446 `tx_remove_output`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`32*byte`:`channel_identifier`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u64`:`sats`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`scriptlen`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`scriptlen*byte`:`script`]</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. type: 448 `tx_complete`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`32*byte`:`channel_identifier`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`num_inputs`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`num_outputs`]</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. type:  448 `tx_sigs`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`channel_id`:`channel_identifier`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`num_witnesses`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`num_witnesses*witness_stack`:`witness_stack`]</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. subtype: `witness_stack`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`sha256`:`prevtx_txid`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u32`:`prevtx_vout`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`num_input_witness`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`num_input_witness*witness_element`:`witness_element`]</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">1. subtype: `witness_element`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`u16`:`len`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    * [`len*byte`:`witness`]</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">## General Notes</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Validity of inputs/outputs is not checked until both peers have sent consecutive `tx_complete`</span></span></span></span><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  messages.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Duplicate inputs or outputs is a protocol error.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Feerate is set by the initiator, or in the case of a closing transaction, negotiated  before the transaction construction is initiated.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Every peer pays fees for the inputs + outputs they contribute, plus enough to cover the maximum estimate of their witnesses. Overpayment of fees is permissible.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Initiator is responsible for contributing the output/input in question, i.e. the </span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  funding output in the case of an opening, or the funding input in the case of a close. </span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  (This means that the opener will pay for the opening output). In the case of a splice,</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  the initiator of the splice pays for the funding tx's inclusion as an input and the</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  new 'funding tx' output.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Any contributor may signal that their input is RBF'able. The nSequence for this input should be set to 0xFEFF FFFF, 0xFFFFFFFF otherwise.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- The initiating peer is understood to be paying the fee for the shared transaction fields (nVersion [4], segwit marker + flag [2], input + output counts [2-18], witness count [1-9], nLocktime [4]; total [13-40bytes])</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Inputs MUST be segwit compatible (PW* or P2SH-PW*)</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- All output scripts must be standard</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- nLocktime is always set to 0x00000000.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- The `num_inputs` and `num_outputs` in `tx_complete` is a count of that peer’s final input and output contributions, net any removals.</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Either peer may add or remove inputs and outputs until both peers have successfully</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  exchanged a `tx_complete` message in succession.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Either peer may only add or remove their own input or output.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- In the case that a `tx_complete` agreement cannot be reached, either peer may</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  fail the channel or open protocol (whatever is reasonable for the particular case)</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  - In the case of a splice, this would be a soft error (channel returns to normal operation until      </span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">    otherwise failed or closed.)</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  - In the case of an open, this would be a failure to open the channel.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">  - In the case of a close, a failed collaborative close would result in an error and a unilateral close.</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">### Considering the Simple Open case (2 parties)</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Both peers signal `opt_dual_fund`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Opener initiates a channel open with `open_channel2` message, indicating the feerate for the opening transaction</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Accepter signals acceptance of channel open as proposed, including proposed feerate, via `accept_channel2`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Opener sends `tx_add_output`, with the funding output for the sum of both peer’s funding_amount</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Opener sends `tx_add_input` for each input the wish to add to the funding transaction</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Opener sends `tx_add_output` for their change </span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Opener sends `tx_complete`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Accepter sends `tx_add_input` for each input they wish to add to the funding transaction</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Accepter sends `tx_add_output` for their change.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Accepter sends `tx_complete`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Opener sends `tx_complete`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Opener and accepter exchange commitment signatures; etc.</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">### Considering the Splice case:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Both peers signal `opt_splice_ok`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- One peer initiates a splice, also signaling the feerate for the transaction. Exact protocol unspecified herein.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Initiator sends `tx_add_input` with the original funding output</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Initiator sends `tx_add_output` with the new, post-splice funding output</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Initiator sends `tx_add_input/output` as needed to add all desired inputs + outputs</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Initiator sends `tx_complete`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Peer sends `tx_add_input/output` as needed to add all desired inputs + outputs</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Initiator sends `tx_complete`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Peer sends `tx_complete`</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Initiator + peer exchange commitment signatures, etc.</span></span></span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">### Considering the Close case:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Both peers signal `opt_collaborative_close` in their `node_announcement`.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- A peer initiates a close sending a `shutdown`, as per usual. </span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- A feerate is negotiated. Out of band for this particular portion of the protocol.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">-The closing initiator (peer which first sent `shutdown`), sends `tx_add_input` to spend the funding output and `tx_add_output` to add their output for the channel closure.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- The peer responds with `tx_add_output`, adding their output to the close transaction.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- If `option_upfront_shutdown_script` is flagged but no such output with a value at or within a reasonable feerate gap of the peer's funding output is present, then the peer must fail the channel. </span></span></span></span><br></p><div><br></div><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">## Updating a collaborative transaction with RBF:</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- If any input is flagged as RBF’able, then the transaction is considered eligible for RBF</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- RBF can be initiated by either party, and serves as an initiation for another round of transaction composition, as outlined above.</span></span></span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="background-color:transparent"><span style="color:rgb(0, 0, 0)"><span style="font-family:Arial"><span style="font-size:11pt">- Note that this section has been cribbed and re-purposed from the original RBF proposal for splicing, see </span></span></span></span><a href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-November/001621.html" style="text-decoration-line:none"><span style="background-color:transparent"><span style="font-family:Arial"><span style="font-size:11pt">https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-November/001621.html</span></span></span></a><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">1. type: 45 (`init_rbf`) (`option_collaborative_rbf`)</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">2. data:</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">   * [`32`:`channel_id`]</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">   * [`4`:`fee_step`]</span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">Each `fee_step` adds 1/4 (rounded down) to the initial </span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">transaction feerate. eg. if the initial feerate was 512 satoshis per kiloweight, `fee_step` 1</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">is  512 + 512 / 4 = 640, `fee_step` 2 is 640 + 640 / 4 = 800.</span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">The sender:</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">  - MUST set `fee_step` greater than zero and greater than any prior `fee_step`.</span></span><br></p><div><br></div><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">The recipient:</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">  - if the new fee exceeds the sender's current balance minus reserve</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">    after it is applied to the splice transaction:</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">    - MUST error.</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">  </span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">NOTES:</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">1. 1/4 is a reasonable minimal RBF, but as each one requires more</span></span><br></p><p dir="ltr" style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">   tracking by the recipient, serves to limit the number you can create.</span></span><br></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">2. Rule 4 of BIP125 requires a feerate increase to at least surpass the minimum transaction relay setting. Ratcheting by 25% should satisfy this requirement</span></span><br></p><p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="font-family:Arial"><span style="font-size:11pt">3. An additional rule will be added to the checks of an RBF transaction that it must include at least one identical, replaceable input as the original transaction.</span></span><br></p></span></div></blockquote><div><br></div>