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