{"type":"rich","version":"1.0","author_name":"npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l","author_url":"https://nostr.ae/npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l","provider_name":"njump","provider_url":"https://nostr.ae","html":"📅 Original date posted:2018-10-11\n📝 Original message:\nGood morning Rusty,\n\nIn BOLT #2 we currently impose a 2^24 satoshi limit on total channel capacity.  Is splicing intended to allow violation of this limit? I do not see it mentioned in the proposal. Can I splice 21 million bitcoins on a 1-satoshi channel?\n\nIt may be good to start brainstorming possible failure modes during splice, and how to recover, and also to indicate the expected behavior in the proposal, as I believe these will be the points where splicing must be designed most precisely. What happens when a splice is ongoing and the communication gets disconnected?  What happens when some channel failure occurs during splicing and we are forced to drop onchain?  And so on.\n\n\nRegards,\nZmnSCPxj\n\n\nSent with ProtonMail Secure Email.\n\n‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐\nOn Wednesday, October 10, 2018 11:45 AM, Rusty Russell \u003crusty at rustcorp.com.au\u003e wrote:\n\n\u003e Hi all!\n\u003e\n\u003e We've had increasing numbers of c-lightning users get upset they\n\u003e can't open multiple channels, so I guess we're most motivated to allow\n\u003e splicing of existing channels. Hence this rough proposal.\n\u003e\n\u003e For simplicity, I've chosen to only allow a single splice at a time.\n\u003e It's still complex :(\n\u003e\n\u003e Feedback welcome!\n\u003e\n\u003e --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\u003e\n\u003e Splice Negotiation:\n\u003e\n\u003e 1.  type: 40 (`splice_add_input`) (`option_splice`)\n\u003e 2.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`8`: `satoshis`]\n\u003e     -   [`32`: `prevtxid`]\n\u003e     -   [`4`: `prevtxoutnum`]\n\u003e     -   [`2`: `scriptlen`]\n\u003e     -   [`scriptlen`: `scriptpubkey`]\n\u003e 3.  type: 41 (`splice_add_output`) (`option_splice`)\n\u003e 4.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`8`: `satoshis`]\n\u003e     -   [`2`: `scriptlen`]\n\u003e     -   [`scriptlen`: `outscript`]\n\u003e 5.  type: 42 (`splice_all_added`) (`option_splice`)\n\u003e 6.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`4`:`feerate_per_kw`]\n\u003e     -   [`4`:`minimum_depth`]\n\u003e\n\u003e         Each side sends 0 or more `splice_add_input` and 0 or more\n\u003e         `splice_add_output` followed by `spice_all_added` to complete the splice\n\u003e         proposal. This is done either to initiate a splice, or to respond to a\n\u003e         `splice_*` from the other party.\n\u003e\n\u003e         `splice_add_input` is checked for the following:\n\u003e\n\u003e\n\u003e -   must not be during a current splice\n\u003e\n\u003e -   scriptpubkey is empty, or of form 'HASH160 \u003c20-byte-script-hash\u003e EQUAL'\n\u003e\n\u003e -   `satoshis` doesn't wrap on addition.\n\u003e\n\u003e -   MAY check that it matches outpoint specified (sig will simply be\n\u003e     invalid if so), and that outpoint is segwit.\n\u003e\n\u003e     `splice_add_output` is checked for the following:\n\u003e\n\u003e -   must not be during a current splice\n\u003e\n\u003e -   `satoshis` is less than or equal to amount owing to proposer, minus\n\u003e     current reserve, and greater than or equal to `dust_limit_satoshis` we\n\u003e     sent in our open_channel/accept_channel ,sg.\n\u003e\n\u003e -   script is one of the approved forms as it is for `shutdown`.\n\u003e\n\u003e     FIXME: Do we disallow splice-out if they specified\n\u003e     option_upfront_shutdown_script?\n\u003e\n\u003e     `splice_all_added` is checked for the following:\n\u003e\n\u003e -   average of `feerate_per_kw` by both sides (round down) is sufficient.\n\u003e\n\u003e -   average of `feerate_per_kw` by both sides not grossly excessive, if we're\n\u003e     paying some of the fees (see below!)\n\u003e\n\u003e -   both sides can afford the fees from their post-splice funds (see\n\u003e     Verification Changes below)\n\u003e\n\u003e -   maximum of the two `minimum_depth` is not grossly excessive.\n\u003e\n\u003e -   There is at least one splice_add_input or splice_add_output.\n\u003e\n\u003e     Splice negotiation, like closing negotiation, does not have persistent\n\u003e     state. Reconnecting forgets previous negotiation.\n\u003e\n\u003e     Splice Signing\n\u003e\n\u003e\n\u003e Once`splice_all_added` is both sent and received, we need to create and\n\u003e sign both the splice tx itself, and the first commitment transaction\n\u003e which spends it (but not in that order!).\n\u003e\n\u003e 1.  One input spends the current funding tx output.\n\u003e 2.  There is one additional input for each splice_add_input.\n\u003e 3.  One output creates the new funding tx.\n\u003e 4.  There is one additional output for each splice_add_output.\n\u003e 5.  The entire transaction is sorted into BIP69 order.\n\u003e 6.  The feerate is the sum of the two `feerate_per_kw` divided by 2,\n\u003e     rounded down.\n\u003e\n\u003e 7.  type: 43 (`splice_commitment_signature`) (`option_splice`)\n\u003e 8.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`64`:`commitment_signature`]\n\u003e     -   [`2`:`num_htlcs`]\n\u003e     -   [`num_htlcs*64`:`htlc_signature`]\n\u003e 9.  type: 44 (`splice_signature`) (`option_splice`)\n\u003e 10.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`64`:`splice_signature`]\n\u003e 11.  type: 45 (`splice_witness`) (`option_splice`)\n\u003e 12.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`2`: `num_witness_elements`\n\u003e     -   [`2`:`len`]\n\u003e     -   [`len`:`witnesses`]\n\u003e\n\u003e         `witnesses` itself is serialized as `num_witness_elements` of:\n\u003e\n\u003e\n\u003e -   `2`:`len`\n\u003e -   `len`: `witness_element`\n\u003e\n\u003e     Each side sends `splice_commitment_signature` and waits to receive and\n\u003e     verify the other side's `splice_commitment_signature` before sending\n\u003e     `splice_signature` and `splice_witness` for each `splice_add_input` it\n\u003e     proposed, in BIP69 input order.\n\u003e\n\u003e     Once a node has sent `splice_commitment_signature` it should remember\n\u003e     the splice proposal across reconnects. Once it has both sent\n\u003e     `splice_signature`, the splice is locked in.\n\u003e\n\u003e     Splice Announcement\n\u003e\n\u003e\n\u003e We have to tell the network about the new channel, otherwise there will\n\u003e be a distruption when it sees the old funding transaction spent. This\n\u003e is inevitable for older nodes who won't understand splicing anyway.\n\u003e\n\u003e We can't send out a `channel_announcement` or `channel_update` for the\n\u003e new channel until after the new funding transaction has 6 confirmations,\n\u003e so we append to the existing `channel_update` for the original channel,\n\u003e using a new `message_flags` field:\n\u003e\n\u003e Bit Position\n\u003e\n\u003e Name\n\u003e\n\u003e Field\n\u003e\n\u003e 0\n\u003e\n\u003e `option_channel_htlc_max`\n\u003e\n\u003e `htlc_maximum_msat`\n\u003e\n\u003e 1\n\u003e\n\u003e `option_channel_moving`\n\u003e\n\u003e `moving_txid\n\u003e\n\u003e The`channel_update` gains the following field:\n\u003e * [`32`: moving_txid`] (option_channel_moving) If a current`channel_update`for a closing channel contains`option_channel_moving`a node SHOULD ignore the channel close for at least 100 blocks iff spent by`moving_txid`. A node SHOULD immediately forward a`channel_update`it sees containing`option_channel_moving`if neither previous`channel_update`for the channel contains`option_channel_moving`.\n\u003e\n\u003e Each side of the splice can send these unilaterally, and SHOULD allow a\n\u003e few minutes for propagation (remember, average propagation from old\n\u003e nodes is still 30 seconds) prior to broadcast of the splice transaction.\n\u003e\n\u003e Message Changes During Splicing\n\u003e\n\u003e ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\u003e\n\u003e Once you've sent `splice_commitment_signature` each commitment\n\u003e transaction is duplicated: one spends the old funding transaction, one\n\u003e spends the splice transaction:\n\u003e\n\u003e 1.  type: 39 (`closing_signed`)\n\u003e 2.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`8`:`fee_satoshis`]\n\u003e     -   [`64`:`signature`]\n\u003e     -   [`64`:`splice_signature`] (`option_splice`)\n\u003e 3.  type: 132 (`commitment_signed`)\n\u003e 4.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`64`:`signature`]\n\u003e     -   [`2`:`num_htlcs`]\n\u003e     -   [`num_htlcs*64`:`htlc_signature`]\n\u003e     -   [`num_htlcs*64`:`htlc_splice_signature`] (`option_splice`)\n\u003e\n\u003e         If a reconnection occurs between between sending and receiving\n\u003e         `splice_commitment_signature`) the peer's status is uncertain (similarly\n\u003e         for closing). This we have a new field in `channel_reestablish` to flag\n\u003e         that we consider ourselves to be splicing:\n\u003e\n\u003e 5.  type: 136 (`channel_reestablish`)\n\u003e 6.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e     -   [`8`:`next_local_commitment_number`]\n\u003e     -   [`8`:`next_remote_revocation_number`]\n\u003e     -   [`32`:`your_last_per_commitment_secret`] (`option_data_loss_protect`)\n\u003e     -   [`33`:`my_current_per_commitment_point`] (`option_data_loss_protect`)\n\u003e     -   [`32`:`splice_txid`] (`option_splice`)\n\u003e\n\u003e         The splice_txid field indicates that this side considers itself to be\n\u003e         splicing.\n\u003e\n\u003e         The sender:\n\u003e\n\u003e\n\u003e -   if it has sent `splice_commitment_signature` and not sent the corresponding\n\u003e     `splice_closed`, MUST set `splice_txid` to the txid of the splice tx.\n\u003e     -   Otherwise MUST NOT.\n\u003e\n\u003e         The recipient:\n\u003e\n\u003e -   if it has sent `splice_commitment_signature` and not sent the corresponding\n\u003e     `splice_closed`:\n\u003e     -   if `splice_txid` does not exist or does not match the current splice:\n\u003e         -   SHOULD fail the channel\n\u003e     -   otherwise:\n\u003e         -   MUST retransmit `splice_signature`\n\u003e -   otherwise:\n\u003e     -   if `splice_txid` field exists and is not all zeroes:\n\u003e         -   MUST send `splice_closed`\n\u003e\n\u003e             Validation Changes During Splicing\n\u003e\n\u003e\n\u003e We track \"post-splice\" values as well as current values during\n\u003e splicing.\n\u003e\n\u003e The post-splice reserve is 1% of post-splice capcacity (rounded down).\n\u003e\n\u003e The fees for the splicing transaction itself are divided into parts by\n\u003e the number of `splice_add_input` plus `splice_add_output`, rounded up.\n\u003e Each side pays as many parts as it proposed `splice_add_input` plus\n\u003e `splice_add_output`.\n\u003e\n\u003e (So if Alice proposes two and Bob proposes one, and the total fee is 1000\n\u003e satoshi, each part is 334 satoshi: Alice pays 668 and Bob pays 334.)\n\u003e\n\u003e Each side's post-splice funds are debited their `splice_add_output`\n\u003e amounts, and credited their `splice_add_input` amounts, a debited the\n\u003e splice tx fees. If any debiting occurs, the funds must be above the\n\u003e post-splice reserve (ie. you can have below reserve, but you can't spend\n\u003e if you're below reserve).\n\u003e\n\u003e All update_add_htlc must be valid for the both the current and\n\u003e post-splice balances.\n\u003e\n\u003e Completing Splicing\n\u003e\n\u003e ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\u003e\n\u003e Once you've seen both side's `minimum_depth` confirmations of the splice\n\u003e transaction (ie. the maximum of the two `minimum_depth` values), you can\n\u003e complete the splice by sending:\n\u003e\n\u003e 1.  type: 46 (`splice_closed`) (`option_splice`)\n\u003e 2.  data:\n\u003e     -   [`32`:`channel_id`]\n\u003e\n\u003e         Once you've sent and received `splice_closed` you can send\n\u003e         `announcement_signatures` for the new channel as per normal rules (ie. 6\n\u003e         confirmations, `announce_channel` bit set).\n\u003e\n\u003e         In addition, you can forget everything about the old channel (including\n\u003e         old HTLCs and revocation requirements).\n\u003e\n\u003e\n\u003e Lightning-dev mailing list\n\u003e Lightning-dev at lists.linuxfoundation.org\n\u003e https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev"}
