<oembed><type>rich</type><version>1.0</version><author_name>npub1zlxd3xlzjhq2ue03e5m5p2w6mp8v3dkhq5r39flsftjjsje04wvsdd2k4w</author_name><author_url>https://nostr.ae/npub1zlxd3xlzjhq2ue03e5m5p2w6mp8v3dkhq5r39flsftjjsje04wvsdd2k4w</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-10-10&#xA;📝 Original message:&#xA;Dear Rusty,&#xA;&#xA;thanks for the initiative. You suggested in your paragraph &#34;messages&#xA;changes during splicing&#34; during splicing to duplicate each commitment&#xA;transaction. One which spends the old funding tx and one which spends the&#xA;spliced tx. I believe this can be simplified. Though I think my workflow&#xA;pretty much resembles what you have written in &#34;Splice Signing&#34; from point&#xA;1. to 6. Maybe I might have misunderstood some parts of your suggestion.&#xA;&#xA;I will not write this down as formal as your proposal as I believe we are&#xA;currently in the feedback and discussion phase. Maybe you already had&#xA;&#34;those details&#34; that I am suggesting in mind. In that case sorry for my&#xA;mail.&#xA;&#xA;So let us take the example of Splicing in:&#xA;* The situation before splicing is that we have one output in our funding&#xA;tx that is being spent with each commitment tx. (actually if the channel&#xA;was spliced before we have more inputs but that should not change anything)&#xA;* Splice in would create one additional output that can be spent in future&#xA;commitment tx.&#xA;* I propose while splicing in this output should be spent by a special&#xA;commitment tx which goes to the funder of the splicing operation. This&#xA;should happen before the actual funding takes place. The other commitment&#xA;tx spending the original output continues to operate (assuring non blocking&#xA;splice in operation).&#xA;* Once we have enough confirmations we merge the channels (either&#xA;automatically or with the next channel update). A new commitment tx is&#xA;being created which now spends each output of each of the two funding tx&#xA;and assigns the channel balance to the channel partners accordingly to the&#xA;two independent channels. The old commitment txs are being invalidated.&#xA;* The disadvantage is that while splicing is not completed and if the&#xA;funder of the splicing tx is trying to publish an old commitment tx the&#xA;node will only be punished by sending all the funds of the first funding tx&#xA;to the partner as the special commitment tx of the 2nd output has no newer&#xA;state yet.&#xA;&#xA;I believe splicing out is even safer:&#xA;* One just creates a spent of the funding tx which has two outputs. One&#xA;output goes to the recipient of the splice out operation and the second&#xA;output acts as a new funding transaction for the newly spliced channel.&#xA;Once signatures for the new commitment transaction are exchanged (basically&#xA;following the protocol to open a channel) the splicing operation can be&#xA;broadcasted.&#xA;* The old channel MUST NOT be used anymore but the new channel can be&#xA;operational right away without blockchain confirmation. In case someone&#xA;tries to publish an old state of the old channel it will be a double spent&#xA;of the splicing operation and in the worst case will be punished and the&#xA;splicing was not successful. if one publishes an old state of the new&#xA;channel everything will just work as normal even if the funding tx is not&#xA;yet mined. It could only be replaced with an old state of the previous&#xA;channel (which as we saw is not a larger risk than the usual operation of a&#xA;lightning node)&#xA;&#xA;As mentioned maybe you had this workflow already in your mind but I don&#39;t&#xA;see why we need to send around all the messages twice with my workflow. We&#xA;only need to maintain double state but only until it is fair / safe to do&#xA;so. I would also believe that with my approach it should be possible (but&#xA;not really necessary) to have multiple splicing operations in parallel.&#xA;&#xA;One other question: What happens to the short_channel_id of a channel to&#xA;which founds have been spliced in?&#xA;&#xA;best Rene&#xA;&#xA;On Wed, Oct 10, 2018 at 5:46 AM Rusty Russell &lt;rusty at rustcorp.com.au&gt; wrote:&#xA;&#xA;&gt; Hi all!&#xA;&gt;&#xA;&gt;         We&#39;ve had increasing numbers of c-lightning users get upset they&#xA;&gt; can&#39;t open multiple channels, so I guess we&#39;re most motivated to allow&#xA;&gt; splicing of existing channels.  Hence this rough proposal.&#xA;&gt;&#xA;&gt; For simplicity, I&#39;ve chosen to only allow a single splice at a time.&#xA;&gt; It&#39;s still complex :(&#xA;&gt;&#xA;&gt; Feedback welcome!&#xA;&gt; --&#xA;&gt; Splice Negotiation:&#xA;&gt;&#xA;&gt; 1. type: 40 (`splice_add_input`) (`option_splice`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`8`: `satoshis`]&#xA;&gt;    * [`32`: `prevtxid`]&#xA;&gt;    * [`4`: `prevtxoutnum`]&#xA;&gt;    * [`2`: `scriptlen`]&#xA;&gt;    * [`scriptlen`: `scriptpubkey`]&#xA;&gt;&#xA;&gt; 1. type: 41 (`splice_add_output`) (`option_splice`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`8`: `satoshis`]&#xA;&gt;    * [`2`: `scriptlen`]&#xA;&gt;    * [`scriptlen`: `outscript`]&#xA;&gt;&#xA;&gt; 1. type: 42 (`splice_all_added`) (`option_splice`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`4`:`feerate_per_kw`]&#xA;&gt;    * [`4`:`minimum_depth`]&#xA;&gt;&#xA;&gt; Each side sends 0 or more `splice_add_input` and 0 or more&#xA;&gt; `splice_add_output` followed by `spice_all_added` to complete the splice&#xA;&gt; proposal.  This is done either to initiate a splice, or to respond to a&#xA;&gt; `splice_*` from the other party.&#xA;&gt;&#xA;&gt; `splice_add_input` is checked for the following:&#xA;&gt; - must not be during a current splice&#xA;&gt; - scriptpubkey is empty, or of form &#39;HASH160 &lt;20-byte-script-hash&gt; EQUAL&#39;&#xA;&gt; - `satoshis` doesn&#39;t wrap on addition.&#xA;&gt; - MAY check that it matches outpoint specified (sig will simply be&#xA;&gt;   invalid if so), and that outpoint is segwit.&#xA;&gt;&#xA;&gt; `splice_add_output` is checked for the following:&#xA;&gt; - must not be during a current splice&#xA;&gt; - `satoshis` is less than or equal to amount owing to proposer, minus&#xA;&gt;   current reserve, and greater than or equal to `dust_limit_satoshis` we&#xA;&gt;   sent in our open_channel/accept_channel ,sg.&#xA;&gt; - script is one of the approved forms as it is for `shutdown`.&#xA;&gt;&#xA;&gt; FIXME: Do we disallow splice-out if they specified&#xA;&gt;        option_upfront_shutdown_script?&#xA;&gt;&#xA;&gt; `splice_all_added` is checked for the following:&#xA;&gt; - average of `feerate_per_kw` by both sides (round down) is sufficient.&#xA;&gt; - average of `feerate_per_kw` by both sides not grossly excessive, if we&#39;re&#xA;&gt;   paying some of the fees (see below!)&#xA;&gt; - both sides can afford the fees from their post-splice funds (see&#xA;&gt;   Verification Changes below)&#xA;&gt; - maximum of the two `minimum_depth` is not grossly excessive.&#xA;&gt; - There is at least one splice_add_input or splice_add_output.&#xA;&gt;&#xA;&gt; Splice negotiation, like closing negotiation, does not have persistent&#xA;&gt; state.  Reconnecting forgets previous negotiation.&#xA;&gt;&#xA;&gt;&#xA;&gt; Splice Signing&#xA;&gt; --------------&#xA;&gt;&#xA;&gt; Once `splice_all_added` is both sent and received, we need to create and&#xA;&gt; sign both the splice tx itself, and the first commitment transaction&#xA;&gt; which spends it (but not in that order!).&#xA;&gt;&#xA;&gt; 1. One input spends the current funding tx output.&#xA;&gt; 2. There is one additional input for each splice_add_input.&#xA;&gt; 3. One output creates the new funding tx.&#xA;&gt; 4. There is one additional output for each splice_add_output.&#xA;&gt; 5. The entire transaction is sorted into BIP69 order.&#xA;&gt; 6. The feerate is the sum of the two `feerate_per_kw` divided by 2,&#xA;&gt;    rounded down.&#xA;&gt;&#xA;&gt; 1. type: 43 (`splice_commitment_signature`) (`option_splice`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`64`:`commitment_signature`]&#xA;&gt;    * [`2`:`num_htlcs`]&#xA;&gt;    * [`num_htlcs*64`:`htlc_signature`]&#xA;&gt;&#xA;&gt; 1. type: 44 (`splice_signature`) (`option_splice`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`64`:`splice_signature`]&#xA;&gt;&#xA;&gt; 1. type: 45 (`splice_witness`) (`option_splice`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`2`: `num_witness_elements`&#xA;&gt;    * [`2`:`len`]&#xA;&gt;    * [`len`:`witnesses`]&#xA;&gt;&#xA;&gt; `witnesses` itself is serialized as `num_witness_elements` of:&#xA;&gt; * `2`:`len`&#xA;&gt; * `len`: `witness_element`&#xA;&gt;&#xA;&gt; Each side sends `splice_commitment_signature` and waits to receive and&#xA;&gt; verify the other side&#39;s `splice_commitment_signature` before sending&#xA;&gt; `splice_signature` and `splice_witness` for each `splice_add_input` it&#xA;&gt; proposed, in BIP69 input order.&#xA;&gt;&#xA;&gt; Once a node has sent `splice_commitment_signature` it should remember&#xA;&gt; the splice proposal across reconnects.  Once it has both sent&#xA;&gt; `splice_signature`, the splice is locked in.&#xA;&gt;&#xA;&gt;&#xA;&gt; Splice Announcement&#xA;&gt; -------------------&#xA;&gt;&#xA;&gt; We have to tell the network about the new channel, otherwise there will&#xA;&gt; be a distruption when it sees the old funding transaction spent.  This&#xA;&gt; is inevitable for older nodes who won&#39;t understand splicing anyway.&#xA;&gt;&#xA;&gt; We can&#39;t send out a `channel_announcement` or `channel_update` for the&#xA;&gt; new channel until after the new funding transaction has 6 confirmations,&#xA;&gt; so we append to the existing `channel_update` for the original channel,&#xA;&gt; using a new `message_flags` field:&#xA;&gt;&#xA;&gt; | Bit Position  | Name                      | Field&#xA;&gt;     |&#xA;&gt; | ------------- | ------------------------- |&#xA;&gt; -------------------------------- |&#xA;&gt; | 0             | `option_channel_htlc_max` | `htlc_maximum_msat`&#xA;&gt;     |&#xA;&gt; | 1             | `option_channel_moving`   | `moving_txid&#xA;&gt;      |&#xA;&gt;&#xA;&gt; The `channel_update` gains the following field:&#xA;&gt;     * [`32`: moving_txid`] (option_channel_moving)&#xA;&gt;&#xA;&gt; If a current `channel_update` for a closing channel contains&#xA;&gt; `option_channel_moving` a node SHOULD ignore the channel close for at&#xA;&gt; least 100 blocks iff spent by `moving_txid`.&#xA;&gt;&#xA;&gt; A node SHOULD immediately forward a `channel_update` it sees containing&#xA;&gt; `option_channel_moving` if neither previous `channel_update` for the&#xA;&gt; channel contains `option_channel_moving`.&#xA;&gt;&#xA;&gt; Each side of the splice can send these unilaterally, and SHOULD allow a&#xA;&gt; few minutes for propagation (remember, average propagation from old&#xA;&gt; nodes is still 30 seconds) prior to broadcast of the splice transaction.&#xA;&gt;&#xA;&gt;&#xA;&gt; Message Changes During Splicing&#xA;&gt; -------------------------------&#xA;&gt; Once you&#39;ve sent `splice_commitment_signature` each commitment&#xA;&gt; transaction is duplicated: one spends the old funding transaction, one&#xA;&gt; spends the splice transaction:&#xA;&gt;&#xA;&gt; 1. type: 39 (`closing_signed`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`8`:`fee_satoshis`]&#xA;&gt;    * [`64`:`signature`]&#xA;&gt;    * [`64`:`splice_signature`] (`option_splice`)&#xA;&gt;&#xA;&gt; 1. type: 132 (`commitment_signed`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`64`:`signature`]&#xA;&gt;    * [`2`:`num_htlcs`]&#xA;&gt;    * [`num_htlcs*64`:`htlc_signature`]&#xA;&gt;    * [`num_htlcs*64`:`htlc_splice_signature`] (`option_splice`)&#xA;&gt;&#xA;&gt; If a reconnection occurs between between sending and receiving&#xA;&gt; `splice_commitment_signature`) the peer&#39;s status is uncertain (similarly&#xA;&gt; for closing).  This we have a new field in `channel_reestablish` to flag&#xA;&gt; that we consider ourselves to be splicing:&#xA;&gt;&#xA;&gt; 1. type: 136 (`channel_reestablish`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;    * [`8`:`next_local_commitment_number`]&#xA;&gt;    * [`8`:`next_remote_revocation_number`]&#xA;&gt;    * [`32`:`your_last_per_commitment_secret`] (`option_data_loss_protect`)&#xA;&gt;    * [`33`:`my_current_per_commitment_point`] (`option_data_loss_protect`)&#xA;&gt;    * [`32`:`splice_txid`] (`option_splice`)&#xA;&gt;&#xA;&gt; The splice_txid field indicates that this side considers itself to be&#xA;&gt; splicing.&#xA;&gt;&#xA;&gt; The sender:&#xA;&gt; - if it has sent `splice_commitment_signature` and not sent the&#xA;&gt; corresponding&#xA;&gt;   `splice_closed`, MUST set `splice_txid` to the txid of the splice tx.&#xA;&gt;    - Otherwise MUST NOT.&#xA;&gt;&#xA;&gt; The recipient:&#xA;&gt; - if it has sent `splice_commitment_signature` and not sent the&#xA;&gt; corresponding&#xA;&gt;   `splice_closed`:&#xA;&gt;   - if `splice_txid` does not exist or does not match the current splice:&#xA;&gt;     - SHOULD fail the channel&#xA;&gt;   - otherwise:&#xA;&gt;     - MUST retransmit `splice_signature`&#xA;&gt; - otherwise:&#xA;&gt;   - if `splice_txid` field exists and is not all zeroes:&#xA;&gt;     - MUST send `splice_closed`&#xA;&gt;&#xA;&gt;&#xA;&gt; Validation Changes During Splicing&#xA;&gt; ----------------------------------&#xA;&gt; We track &#34;post-splice&#34; values as well as current values during&#xA;&gt; splicing.&#xA;&gt;&#xA;&gt; The post-splice reserve is 1% of post-splice capcacity (rounded down).&#xA;&gt;&#xA;&gt; The fees for the splicing transaction itself are divided into parts by&#xA;&gt; the number of `splice_add_input` plus `splice_add_output`, rounded up.&#xA;&gt; Each side pays as many parts as it proposed `splice_add_input` plus&#xA;&gt; `splice_add_output`.&#xA;&gt;&#xA;&gt; (So if Alice proposes two and Bob proposes one, and the total fee is 1000&#xA;&gt; satoshi, each part is 334 satoshi: Alice pays 668 and Bob pays 334.)&#xA;&gt;&#xA;&gt; Each side&#39;s post-splice funds are debited their `splice_add_output`&#xA;&gt; amounts, and credited their `splice_add_input` amounts, a debited the&#xA;&gt; splice tx fees.  If any debiting occurs, the funds must be above the&#xA;&gt; post-splice reserve (ie. you can have below reserve, but you can&#39;t spend&#xA;&gt; if you&#39;re below reserve).&#xA;&gt;&#xA;&gt; All update_add_htlc must be valid for the *both* the current and&#xA;&gt; post-splice balances.&#xA;&gt;&#xA;&gt; Completing Splicing&#xA;&gt; -------------------&#xA;&gt; Once you&#39;ve seen both side&#39;s `minimum_depth` confirmations of the splice&#xA;&gt; transaction (ie. the maximum of the two `minimum_depth` values), you can&#xA;&gt; complete the splice by sending:&#xA;&gt;&#xA;&gt; 1. type: 46 (`splice_closed`) (`option_splice`)&#xA;&gt; 2. data:&#xA;&gt;    * [`32`:`channel_id`]&#xA;&gt;&#xA;&gt; Once you&#39;ve sent and received `splice_closed` you can send&#xA;&gt; `announcement_signatures` for the new channel as per normal rules (ie. 6&#xA;&gt; confirmations, `announce_channel` bit set).&#xA;&gt;&#xA;&gt; In addition, you can forget everything about the old channel (including&#xA;&gt; old HTLCs and revocation requirements).&#xA;&gt; _______________________________________________&#xA;&gt; Lightning-dev mailing list&#xA;&gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#xA;&gt;&#xA;&#xA;&#xA;-- &#xA;https://www.rene-pickhardt.de&#xA;&#xA;Skype: rene.pickhardt&#xA;&#xA;mobile: +49 (0)176 5762 3618&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20181011/d0a500b9/attachment-0001.html&gt;</html></oembed>