<oembed><type>rich</type><version>1.0</version><author_name>npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l</author_name><author_url>https://nostr.ae/npub1g5zswf6y48f7fy90jf3tlcuwdmjn8znhzaa4vkmtxaeskca8hpss23ms3l</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-10-17&#xA;📝 Original message:&#xA;Good morning lisa,&#xA;&#xA;This is a good observation.&#xA;&#xA;Before, I&#39;d already considered the rationale, for why channels have a single 2-of-2 UTXO as funding output.  And it seems I should have considered this, prior to accepting the &#34;parallel&#34; construction as feasible.&#xA;&#xA;For sake of posterity, I leave the below writeup as a tangential to the design of splice (and to the design of Lightning having a single 2-of-2 UTXOs):&#xA;&#xA;# 0-conf is Unsafe, Yet Lightning is Safe; Why?&#xA;&#xA;To accept a 0-conf transaction output, is known to be unsafe.  Replace-by-fee is always a possibility, regardless of whether the transaction opts in to RBF or not: a rational miner will always accept the higher feerate, disregarding any &#34;opt-in&#34; flag that is set or not set on the transaction.  Thus we reject any advice that claims that 0-conf is tenable, even for tiny amounts.&#xA;&#xA;Yet when viewed solely in terms of transactions, Lightning protocol uses transactions that are not on any block (are kept offchain).  Since they are not in a block, they are indistinguishable from 0-conf transactions, which are accepted by the receiver, yet are also not on any block.  One might argue the distinction, that a &#34;real&#34; 0-conf transaction exists on some mempool somewhere, and thus has a chance to be on a block in the future, but mempools have no consensus, and the existence of a transaction on some mempool is not a safe assurance of it existing in the mempool of the next winning miner.&#xA;&#xA;So why is Lightning safe, when 0-conf transactions are in general not safe?&#xA;&#xA;Again, we should focus on why 0-conf transactions in general are not safe: transaction replacement.  Thus, 0-conf transactions can be made safe, if you are somehow able to ensure that replacement transactions cannot be made.&#xA;&#xA;For example, if you are part of an n-of-n federation that signs the transaction, you can always safely accept a 0-conf transaction from that federation paying only to you, because you can always veto any replacement (by simply refusing to sign) that is not in your interests.&#xA;&#xA;This is in fact how Lightning works: a 2-of-2 federation (the channel counterparties) are the signatories of the 0-conf transactions that are the commitment transactions of the Lightning protocol.  Replacement of the commitment transactions is strictly guided by the protocol; both sides have veto rights, since the source transaction output is 2-of-2.&#xA;&#xA;Thus, Lightning, though it uses 0-conf transactions, is safe, because it prevents the replacement of a 0-conf transaction without the receiver allowing it, by the simple expedient of including the receiver in the 2-of-2 multisig guarding its single funding TXO.&#xA;&#xA;##  The Implications for Splice Proposals&#xA;&#xA;Some splice proposals involve creating the equivalent of multiple funding TXOs for a single channel.  Such constructions are unsafe-by-default on Poon-Dryja.&#xA;&#xA;In reality, every commitment transaction (or update transaction in Decker-Osuntokun-Russell) is replaceable by any other commitment (or update) transaction for that channel.  Under Poon-Dryja older transactions are revoked (and hence one side risks loss of their collateral) while under Decker-Osuntokun-Russell older transactions may be &#34;gainsaid&#34; (i.e. newer update transactions may be reanchored to consume the TXO of the older update transaction, thus preventing that update from truly being committed to).&#xA;&#xA;This is relevant since before a splice, the channel has a single funding TXO, while after the splice, the channel has multiple.&#xA;&#xA;In particular, a commitment (or update) transaction, that has multiple inputs (to consume the multiple funding TXOs), can be replaced with a commitment (or update) transaction that was created before the splice.  Under Poon-Dryja, such a commitment transaction may be revoked, but this leaves the other funding TXOs unuseable.  Under Decker-Osuntokun-Russell, as long as the sequence number is preserved across the splice, it is possible for a later update transaction with multiple inputs to simply gainsay the old single-input update with the new multiple-input update transaction. (I suppose, that this is another advantage that Decker-Osuntokun-Russell has).&#xA;&#xA;Regards,&#xA;ZmnSCPxj&#xA;&#xA;Sent with [ProtonMail](https://protonmail.com) Secure Email.&#xA;&#xA;‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐&#xA;On Wednesday, October 17, 2018 9:09 AM, lisa neigut &lt;niftynei at gmail.com&gt; wrote:&#xA;&#xA;&gt; To add some context to this, if you start accepting HTLC&#39;s for the new balance after the parallel commitment is made, but before the re-anchor is buried, there&#39;s the potential for a race condition between a unilateral close (or any revoked commitment transaction) and the re-anchoring commitment transaction, that spends the &#39;pre-committed&#39; UTXO of splicing in funds and the original funding transaction.&#xA;&gt;&#xA;&gt; You can get around this by waiting until both the pre-commitment UTXO and the re-anchor have cleared a minimum depth before accepting HTLC&#39;s for the new balance totals, but that&#39;s twice as long of a wait as the first, synchronized re-commitment scheme that Rusty originally proposed.&#xA;&gt;&#xA;&gt; It also makes leaving the original funding transaction &#39;exposed&#39; (ie Rene&#39;s version of parallel splice) untenable, as there&#39;s always the risk of an old state being published to consume that input. This foobars your current HTLC commitments.&#xA;&gt;&#xA;&gt; On Tue, Oct 16, 2018 at 3:31 PM Rusty Russell &lt;rusty at rustcorp.com.au&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; Rusty Russell &lt;rusty at rustcorp.com.au&gt; writes:&#xA;&gt;&gt;&gt; If we&#39;re going to do side splice-in like this, I would use a very&#xA;&gt;&gt;&gt; different protocol: the reason for this protocol was to treat splice-in&#xA;&gt;&gt;&gt; and splice-out the same, and inline splice-in requires wait time.  Since&#xA;&gt;&gt;&gt; splice-out doesn&#39;t, we don&#39;t need this at all.&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; It would look much more like:&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; 1. Prepare any output with script of specific form. eg:&#xA;&gt;&gt;&gt;         OP_DEPTH 3 OP_EQUAL OP_IF&#xA;&gt;&gt;&gt;                 &lt;funding_pubkey1&gt; &lt;funding_pubkey2&gt; OP_CHECKMULTISIG&#xA;&gt;&gt;&gt;         OP_ELSE&#xA;&gt;&gt;&gt;                 &lt;blockheight&gt; OP_CHECKLOCKTIMEVERIFY OP_DROP&#xA;&gt;&gt;&gt;                 &lt;myrescue_pubkey&gt; OP_CHECKSIG&#xA;&gt;&gt;&gt;         OP_ENDIF&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; 1. type: 40 (`splice_in`) (`option_splice`)&#xA;&gt;&gt;&gt; 2. data:&#xA;&gt;&gt;&gt;    * [`32`:`channel_id`]&#xA;&gt;&gt;&gt;    * [`8`: `satoshis`]&#xA;&gt;&gt;&gt;    * [`32`: `txid`]&#xA;&gt;&gt;&gt;    * [`4`: `txoutnum`]&#xA;&gt;&gt;&gt;    * [`4`: `blockheight`]&#xA;&gt;&gt;&gt;    * [`33`: `myrescue_pubkey`]&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; 1. type: 137 (`update_splice_in_accept`) (`option_splice`)&#xA;&gt;&gt;&gt;    data:&#xA;&gt;&gt;&gt;    * [`32`:`channel_id`]&#xA;&gt;&gt;&gt;    * [`32`: `txid`]&#xA;&gt;&gt;&gt;    * [`4`: `txoutnum`]&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; 1. type: 138 (`update_splice_in_reject`) (`option_splice`)&#xA;&gt;&gt;&gt;    data:&#xA;&gt;&gt;&gt;    * [`32`:`channel_id`]&#xA;&gt;&gt;&gt;    * [`32`: `txid`]&#xA;&gt;&gt;&gt;    * [`2`:`len`]&#xA;&gt;&gt;&gt;    * [`len`:`errorstr`]&#xA;&gt;&gt;&gt;&#xA;&gt;&gt;&gt; The recipient of `splice_in` checks that it&#39;s happy with the&#xA;&gt;&gt;&gt; `blockheight` (far enough in future).  Once it sees the tx referred to&#xA;&gt;&gt;&gt; buried to its own `minimum_depth`, it checks output is what they&#xA;&gt;&gt;&gt; claimed, then sends `update_splice_in_accept`; it&#39;s followed up&#xA;&gt;&gt;&gt; `commitment_signed` like normal, but from this point onwards, all&#xA;&gt;&gt;&gt; commitment txs signatures have one extra sig.&#xA;&gt;&gt;&#xA;&gt;&gt; Lisa started asking pointed questions, and so I noticed that parallel&#xA;&gt;&gt; splice doesn&#39;t work with Poon-Dryja channels.&#xA;&gt;&gt;&#xA;&gt;&gt; The counterparty can spend the old funding txout with a revoked spend.&#xA;&gt;&gt; Sure, I can take all the money from that, but what about the spliced&#xA;&gt;&gt; input?&#xA;&gt;&gt;&#xA;&gt;&gt; I came up with increasingly elaborate workarounds, but nothing stuck.&#xA;&gt;&gt;&#xA;&gt;&gt; Back to Plan A...&#xA;&gt;&gt; Rusty.&#xA;&gt;&gt; _______________________________________________&#xA;&gt;&gt; Lightning-dev mailing list&#xA;&gt;&gt; Lightning-dev at lists.linuxfoundation.org&#xA;&gt;&gt; https://lists.linuxfoundation.org/mailman/listinfo/lightning-dev&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/lightning-dev/attachments/20181017/aa172a58/attachment-0001.html&gt;</html></oembed>