<oembed><type>rich</type><version>1.0</version><title>lisa neigut [ARCHIVE] wrote</title><author_name>lisa neigut [ARCHIVE] (npub1sp…s64t2)</author_name><author_url>https://yabu.me/npub1sprhp66c693av0c0n9had046hcdcckp2th25fnmphwstc5e4wg9qxs64t2</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2020-01-27&#xA;📝 Original message:&#xA;Some of the feedback I received from the check-in for the dual-funding&#xA;proposal this past Monday was along the lines that we look at simplifying&#xA;for breaking it into smaller, more manageable chunks.&#xA;&#xA;The biggest piece of the dual-funding protocol update is definitely the&#xA;move from a single peer constructing a transaction to two participants.&#xA;We&#39;re also going to likely want to reuse this portion of the protocol for&#xA;batched closings and splicing. To that extent, it seemed useful to&#xA;highlight it in a separate email.&#xA;&#xA;This is a change from the existing proposal in the dual-funding PR #524&#xA;&lt;https://github.com/lightningnetwork/lightning-rfc/pull/524&gt; -- it allows&#xA;for the removal of inputs and outputs.&#xA;&#xA;The set of messages are as follows.&#xA;&#xA;&#xA;Note that the &#39;initiation&#39; of this protocol will be different depending on&#xA;the case of the transaction (open, close or splice):&#xA;&#xA;1. type:   440 `tx_add_input`&#xA;&#xA;2. data:&#xA;&#xA;    * [`32*byte`:`channel_identifier`]&#xA;&#xA;    * [`u64`:`sats`]&#xA;&#xA;    * [`sha256`:`prevtx_txid`]&#xA;&#xA;    * [`u32`:`prevtx_vout`]&#xA;&#xA;    * [`u16`:`prevtx_scriptpubkey_len`]&#xA;&#xA;    * [`prevtx_scriptpubkey_len*byte`:`prevtx_scriptpubkey`]&#xA;&#xA;    * [`u16`:`max_witness_len`]&#xA;&#xA;    * [`u16`:`scriptlen`]&#xA;&#xA;    * [`scriptlen*byte`:`script`]&#xA;&#xA;    * [`byte`:`signal_rbf`]&#xA;&#xA;1. type: 442 `tx_add_output`&#xA;&#xA;2. data:&#xA;&#xA;    * [`32*byte`:`channel_identifier`]&#xA;&#xA;    * [`u64`:`sats`]&#xA;&#xA;    * [`u16`:`scriptlen`]&#xA;&#xA;    * [`scriptlen*byte`:`script`]&#xA;&#xA;1. type: 444 `tx_remove_input`&#xA;&#xA;2. data:&#xA;&#xA;    * [`32*byte`:`channel_identifier`]&#xA;&#xA;    * [`sha256`:`prevtx_txid`]&#xA;&#xA;    * [`u32`:`prevtx_vout`]&#xA;&#xA;1. type: 446 `tx_remove_output`&#xA;&#xA;2. data:&#xA;&#xA;    * [`32*byte`:`channel_identifier`]&#xA;&#xA;    * [`u64`:`sats`]&#xA;&#xA;    * [`u16`:`scriptlen`]&#xA;&#xA;    * [`scriptlen*byte`:`script`]&#xA;&#xA;1. type: 448 `tx_complete`&#xA;&#xA;2. data:&#xA;&#xA;    * [`32*byte`:`channel_identifier`]&#xA;&#xA;    * [`u16`:`num_inputs`]&#xA;&#xA;    * [`u16`:`num_outputs`]&#xA;&#xA;1. type:  448 `tx_sigs`&#xA;&#xA;2. data:&#xA;&#xA;    * [`channel_id`:`channel_identifier`]&#xA;&#xA;    * [`u16`:`num_witnesses`]&#xA;&#xA;    * [`num_witnesses*witness_stack`:`witness_stack`]&#xA;&#xA;1. subtype: `witness_stack`&#xA;&#xA;2. data:&#xA;&#xA;    * [`sha256`:`prevtx_txid`]&#xA;&#xA;    * [`u32`:`prevtx_vout`]&#xA;&#xA;    * [`u16`:`num_input_witness`]&#xA;&#xA;    * [`num_input_witness*witness_element`:`witness_element`]&#xA;&#xA;1. subtype: `witness_element`&#xA;&#xA;2. data:&#xA;&#xA;    * [`u16`:`len`]&#xA;&#xA;    * [`len*byte`:`witness`]&#xA;&#xA;&#xA;&#xA;## General Notes&#xA;&#xA;- Validity of inputs/outputs is not checked until both peers have sent&#xA;consecutive `tx_complete`  messages.&#xA;&#xA;- Duplicate inputs or outputs is a protocol error.&#xA;&#xA;- Feerate is set by the initiator, or in the case of a closing transaction,&#xA;negotiated before the transaction construction is initiated.&#xA;&#xA;- Every peer pays fees for the inputs + outputs they contribute, plus&#xA;enough to cover the maximum estimate of their witnesses. Overpayment of&#xA;fees is permissible.&#xA;&#xA;- Initiator is responsible for contributing the output/input in question,&#xA;i.e. the&#xA;&#xA;  funding output in the case of an opening, or the funding input in the&#xA;case of a close.&#xA;&#xA;  (This means that the opener will pay for the opening output). In the case&#xA;of a splice,&#xA;&#xA;  the initiator of the splice pays for the funding tx&#39;s inclusion as an&#xA;input and the&#xA;&#xA;  new &#39;funding tx&#39; output.&#xA;&#xA;- Any contributor may signal that their input is RBF&#39;able. The nSequence&#xA;for this input should be set to 0xFEFF FFFF, 0xFFFFFFFF otherwise.&#xA;&#xA;- The initiating peer is understood to be paying the fee for the shared&#xA;transaction fields (nVersion [4], segwit marker + flag [2], input + output&#xA;counts [2-18], witness count [1-9], nLocktime [4]; total [13-40bytes])&#xA;&#xA;- Inputs MUST be segwit compatible (PW* or P2SH-PW*)&#xA;&#xA;- All output scripts must be standard&#xA;&#xA;- nLocktime is always set to 0x00000000.&#xA;&#xA;- The `num_inputs` and `num_outputs` in `tx_complete` is a count of that&#xA;peer’s final input and output contributions, net any removals.&#xA;&#xA;- Either peer may add or remove inputs and outputs until both peers have&#xA;successfully&#xA;&#xA;  exchanged a `tx_complete` message in succession.&#xA;&#xA;- Either peer may only add or remove their own input or output.&#xA;&#xA;- In the case that a `tx_complete` agreement cannot be reached, either peer&#xA;may&#xA;&#xA;  fail the channel or open protocol (whatever is reasonable for the&#xA;particular case)&#xA;&#xA;  - In the case of a splice, this would be a soft error (channel returns to&#xA;normal operation until&#xA;&#xA;    otherwise failed or closed.)&#xA;&#xA;  - In the case of an open, this would be a failure to open the channel.&#xA;&#xA;  - In the case of a close, a failed collaborative close would result in an&#xA;error and a unilateral close.&#xA;&#xA;### Considering the Simple Open case (2 parties)&#xA;&#xA;- Both peers signal `opt_dual_fund`&#xA;&#xA;- Opener initiates a channel open with `open_channel2` message, indicating&#xA;the feerate for the opening transaction&#xA;&#xA;- Accepter signals acceptance of channel open as proposed, including&#xA;proposed feerate, via `accept_channel2`&#xA;&#xA;- Opener sends `tx_add_output`, with the funding output for the sum of both&#xA;peer’s funding_amount&#xA;&#xA;- Opener sends `tx_add_input` for each input the wish to add to the funding&#xA;transaction&#xA;&#xA;- Opener sends `tx_add_output` for their change&#xA;&#xA;- Opener sends `tx_complete`&#xA;&#xA;- Accepter sends `tx_add_input` for each input they wish to add to the&#xA;funding transaction&#xA;&#xA;- Accepter sends `tx_add_output` for their change.&#xA;&#xA;- Accepter sends `tx_complete`&#xA;&#xA;- Opener sends `tx_complete`&#xA;&#xA;- Opener and accepter exchange commitment signatures; etc.&#xA;&#xA;### Considering the Splice case:&#xA;&#xA;- Both peers signal `opt_splice_ok`&#xA;&#xA;- One peer initiates a splice, also signaling the feerate for the&#xA;transaction. Exact protocol unspecified herein.&#xA;&#xA;- Initiator sends `tx_add_input` with the original funding output&#xA;&#xA;- Initiator sends `tx_add_output` with the new, post-splice funding output&#xA;&#xA;- Initiator sends `tx_add_input/output` as needed to add all desired inputs&#xA;+ outputs&#xA;&#xA;- Initiator sends `tx_complete`&#xA;&#xA;- Peer sends `tx_add_input/output` as needed to add all desired inputs +&#xA;outputs&#xA;&#xA;- Initiator sends `tx_complete`&#xA;&#xA;- Peer sends `tx_complete`&#xA;&#xA;- Initiator + peer exchange commitment signatures, etc.&#xA;&#xA;### Considering the Close case:&#xA;&#xA;- Both peers signal `opt_collaborative_close` in their `node_announcement`.&#xA;&#xA;- A peer initiates a close sending a `shutdown`, as per usual.&#xA;&#xA;- A feerate is negotiated. Out of band for this particular portion of the&#xA;protocol.&#xA;&#xA;-The closing initiator (peer which first sent `shutdown`), sends&#xA;`tx_add_input` to spend the funding output and `tx_add_output` to add their&#xA;output for the channel closure.&#xA;&#xA;- The peer responds with `tx_add_output`, adding their output to the close&#xA;transaction.&#xA;&#xA;- If `option_upfront_shutdown_script` is flagged but no such output with a&#xA;value at or within a reasonable feerate gap of the peer&#39;s funding output is&#xA;present, then the peer must fail the channel.&#xA;&#xA;&#xA;## Updating a collaborative transaction with RBF:&#xA;&#xA;- If any input is flagged as RBF’able, then the transaction is considered&#xA;eligible for RBF&#xA;&#xA;- RBF can be initiated by either party, and serves as an initiation for&#xA;another round of transaction composition, as outlined above.&#xA;&#xA;- Note that this section has been cribbed and re-purposed from the original&#xA;RBF proposal for splicing, see&#xA;https://lists.linuxfoundation.org/pipermail/lightning-dev/2018-November/001621.html&#xA;&#xA;1. type: 45 (`init_rbf`) (`option_collaborative_rbf`)&#xA;&#xA;2. data:&#xA;&#xA;   * [`32`:`channel_id`]&#xA;&#xA;   * [`4`:`fee_step`]&#xA;&#xA;Each `fee_step` adds 1/4 (rounded down) to the initial&#xA;&#xA;transaction feerate. eg. if the initial feerate was 512 satoshis per&#xA;kiloweight, `fee_step` 1&#xA;&#xA;is  512 + 512 / 4 = 640, `fee_step` 2 is 640 + 640 / 4 = 800.&#xA;&#xA;The sender:&#xA;&#xA;  - MUST set `fee_step` greater than zero and greater than any prior&#xA;`fee_step`.&#xA;&#xA;The recipient:&#xA;&#xA;  - if the new fee exceeds the sender&#39;s current balance minus reserve&#xA;&#xA;    after it is applied to the splice transaction:&#xA;&#xA;    - MUST error.&#xA;&#xA;&#xA;&#xA;NOTES:&#xA;&#xA;1. 1/4 is a reasonable minimal RBF, but as each one requires more&#xA;&#xA;   tracking by the recipient, serves to limit the number you can create.&#xA;&#xA;2. Rule 4 of BIP125 requires a feerate increase to at least surpass the&#xA;minimum transaction relay setting. Ratcheting by 25% should satisfy this&#xA;requirement&#xA;&#xA;3. An additional rule will be added to the checks of an RBF transaction&#xA;that it must include at least one identical, replaceable input as the&#xA;original transaction.&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20200127/ca2e504d/attachment-0001.html&gt;</html></oembed>