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