<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:2023-05-09&#xA;🗒️ Summary of this message: A proposal to address liquidity griefing attacks in dual funded transactions by not locking UTXOs and using 0-conf channels for single contributors.&#xA;📝 Original message:&#xA;Good morning Matt, and t-bast,&#xA;&#xA;Your proposal basically means &#34;do not dual-fund 0-conf&#34;.&#xA;You might as well use the much simpler openv1 flow in that case, just because it is simpler.&#xA;&#xA;Regards,&#xA;ZmnSCPxj&#xA;&#xA;&#xA;&#xA;&#xA;Sent with Proton Mail secure email.&#xA;&#xA;------- Original Message -------&#xA;On Tuesday, May 9th, 2023 at 5:38 PM, Matt Morehouse &lt;mattmorehouse at gmail.com&gt; wrote:&#xA;&#xA;&#xA;&gt; Hi Bastien,&#xA;&gt; &#xA;&gt; In general, 0-conf is only safe when WE are the only contributor to&#xA;&gt; the channel, otherwise the peer could double spend us.&#xA;&gt; &#xA;&gt; The problem you seem to be describing is that we might double-spend&#xA;&gt; ourselves if we don&#39;t lock our 0-conf UTXOs at some point. I propose&#xA;&gt; that we DO lock our UTXOs after tx_completes have been exchanged IF we&#xA;&gt; are the only contributor. We don&#39;t have to worry about liquidity&#xA;&gt; griefing in this case, since the peer has no tx_signatures to withhold&#xA;&gt; from us. Of course, the opportunistic upgrade of a regular channel to&#xA;&gt; 0-conf won&#39;t work -- we need a way to differentiate 0-conf channels&#xA;&gt; prior to UTXO selection, so that we don&#39;t reuse soft-locked UTXOs.&#xA;&gt; &#xA;&gt; All together, what I propose is:&#xA;&gt; &#xA;&gt; 1) If the channel type has option_zeroconf, select UTXOs that are not&#xA;&gt; soft locked.&#xA;&gt; 2) If the peer adds any inputs to the funding transaction, abort&#xA;&gt; (0-conf is unsafe for us in this case).&#xA;&gt; 3) After tx_complete exchange, TryLock() our UTXO inputs and abort if&#xA;&gt; already locked.&#xA;&gt; 4) Broadcast funding transaction and begin using the 0-conf channel.&#xA;&gt; &#xA;&gt; I think this at least enables the common use case for 0-conf: LSPs can&#xA;&gt; use their own funds to open 0-conf channels for clients.&#xA;&gt; &#xA;&gt; - Matt&#xA;&gt; &#xA;&gt; &#xA;&gt; &#xA;&gt; &#xA;&gt; On Sat, May 6, 2023 at 3:16 AM Bastien TEINTURIER bastien at acinq.fr wrote:&#xA;&gt; &#xA;&gt; &gt; Good morning list,&#xA;&gt; &gt; &#xA;&gt; &gt; One of the challenges created by the introduction of dual funded&#xA;&gt; &gt; transactions [1] in lightning is how to protect against liquidity&#xA;&gt; &gt; griefing attacks from malicious peers [2].&#xA;&gt; &gt; &#xA;&gt; &gt; Let&#39;s start by reviewing this liquidity griefing issue. The dual funding&#xA;&gt; &gt; protocol starts by exchanging data about the utxos each peer adds to the&#xA;&gt; &gt; shared transaction, then exchange signatures and broadcast the resulting&#xA;&gt; &gt; transaction. If peers lock their utxos as soon as they&#39;ve decided to add&#xA;&gt; &gt; them to the shared transaction, the remote node may go silent. If that&#xA;&gt; &gt; happens, the honest node has some liquidity that is locked and unusable.&#xA;&gt; &gt; &#xA;&gt; &gt; This cannot easily be fixed by simply unlocking utxos after detecting&#xA;&gt; &gt; that the remote node is fishy, because the remote node would still have&#xA;&gt; &gt; succeeded at locking your liquidity for a (small) duration, and could&#xA;&gt; &gt; start other instances of that attack with different node_ids.&#xA;&gt; &gt; &#xA;&gt; &gt; An elegant solution to this issue is to never lock utxos used in dual&#xA;&gt; &gt; funded transactions. If a remote node goes silent in the middle of an&#xA;&gt; &gt; instance of the protocol, your utxos will automatically be re-used in&#xA;&gt; &gt; another instance of the protocol. The only drawback with that approach&#xA;&gt; &gt; is that when you have multiple concurrent instances of dual funding with&#xA;&gt; &gt; honest peers, some of them may fail because they are double-spent by one&#xA;&gt; &gt; of the concurrent instances. This is acceptable, since the protocol&#xA;&gt; &gt; should complete fairly quickly when peers are honest, and at worst, it&#xA;&gt; &gt; can simply be restarted when failure is detected.&#xA;&gt; &gt; &#xA;&gt; &gt; But that solution falls short when using 0-conf, because accidentally&#xA;&gt; &gt; double-spending a 0-conf channel (because of concurrent instances) can&#xA;&gt; &gt; result in loss of funds for one of the peers (if payments were made on&#xA;&gt; &gt; that channel before detecting the double-spend). It seems like using&#xA;&gt; &gt; 0-conf forces us to lock utxos to avoid this issue, which means that&#xA;&gt; &gt; nodes offering 0-conf services expose themselves to liquidity griefing.&#xA;&gt; &gt; &#xA;&gt; &gt; Another related issue is that nodes that want to offer 0-conf channels&#xA;&gt; &gt; must ensure that the utxos they use for 0-conf are isolated from the&#xA;&gt; &gt; utxos they use for non 0-conf, otherwise it is not possible to properly&#xA;&gt; &gt; lock utxos, because of the following race scenario:&#xA;&gt; &gt; &#xA;&gt; &gt; - utxoA is selected for a non 0-conf funding attempt and not locked&#xA;&gt; &gt; (to protect against liquidity griefing)&#xA;&gt; &gt; - utxoA is also selected for a 0-conf funding attempt (because it is&#xA;&gt; &gt; found unlocked in the wallet) and then locked&#xA;&gt; &gt; - the funding transaction for the 0-conf channel is successfully&#xA;&gt; &gt; published first and that channel is instantly used for payments&#xA;&gt; &gt; - the funding transaction for the non 0-conf channel is then published&#xA;&gt; &gt; and confirms, accidentally double-spending the 0-conf channel&#xA;&gt; &gt; &#xA;&gt; &gt; This can be fixed by using a &#34;soft lock&#34; when selecting utxos for a non&#xA;&gt; &gt; 0-conf funding attempt. 0-conf funding attempts must ignore soft locked&#xA;&gt; &gt; utxos while non 0-conf funding attempts can (should) reuse soft locked&#xA;&gt; &gt; utxos.&#xA;&gt; &gt; &#xA;&gt; &gt; In eclair, we are currently doing &#34;opportunistic&#34; 0-conf:&#xA;&gt; &gt; &#xA;&gt; &gt; - if we receive `channel_ready` immediately (which means that our peer&#xA;&gt; &gt; trusts us to use 0-conf)&#xA;&gt; &gt; - and we&#39;re the only contributor to the funding transaction (our peer&#xA;&gt; &gt; doesn&#39;t have any input that they could use to double-spend)&#xA;&gt; &gt; - and the transaction hasn&#39;t been RBF-ed yet&#xA;&gt; &gt; &#xA;&gt; &gt; Then we immediately send `channel_ready` as well and start using that&#xA;&gt; &gt; channel (because we know we won&#39;t double spend ourselves). This is nice&#xA;&gt; &gt; because it lets us use 0-conf in a way where only one side of the&#xA;&gt; &gt; channel needs to trust the other side (instead of both sides trusting&#xA;&gt; &gt; each other).&#xA;&gt; &gt; &#xA;&gt; &gt; Unfortunately, we cannot do that anymore when mixing 0-conf and non&#xA;&gt; &gt; 0-conf funding attempts, because the utxos may be soft locked,&#xA;&gt; &gt; preventing us from &#34;upgrading&#34; to 0-conf.&#xA;&gt; &gt; &#xA;&gt; &gt; You have successfully reached the end of this quite technical post,&#xA;&gt; &gt; congrats! My goal with this post is to gather ideas on how we could&#xA;&gt; &gt; improve that situation and offer good enough protections against&#xA;&gt; &gt; liquidity griefing for nodes offering 0-conf services. Please share&#xA;&gt; &gt; your ideas! And yes, I know, 0-conf is a massive implementation pain&#xA;&gt; &gt; point that we would all like to remove from our codebases, but hey,&#xA;&gt; &gt; users like it ¯\(ツ)/¯&#xA;&gt; &gt; &#xA;&gt; &gt; Cheers,&#xA;&gt; &gt; Bastien&#xA;&gt; &gt; &#xA;&gt; &gt; [1] https://github.com/lightning/bolts/pull/851&#xA;&gt; &gt; [2] https://github.com/lightning/bolts/pull/851#discussion_r997537630&#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;&gt; &#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</html></oembed>