<div dir="ltr">Happy New Year Lightning Developers,<br><br><div>I've recently been closely looking at the dual funding proposal [1] because it uses a DLEQ proof (PoDLE) which we are also working on specifying as part of DLC ECDSA adaptor signatures [2].</div><div>While reading it I had some queries and ideas that I thought were worth sharing (even though they are very very late).<br></div><div><br></div><div># Background</div><div><br></div>Lisa posted a draft proposal [1] which includes the PoDLE and explained it in [3] along with a good list of its weaknesses.<br>The original discussion thread where the idea was conceived is [4] and there is an excellent summary in the following optech [5] which I post below:<br><br>> Another proposal was to use PoDLE, which was originally developed for JoinMarket based on a suggestion by Gregory Maxwell. This protocol allows an initiating user such as Mallory to commit to a UTXO in a way that prevents anyone from identifying that UTXO. The participating user, such as Bob, publishes the commitment across the network (e.g. the JoinMarket network) so that nobody else will start a session with Mallory while she’s using that particular UTXO. Then Bob asks Mallory to identify her UTXO and, if it’s a valid UTXO that matches her commitment, Bob discloses his UTXO to Mallory so that they can proceed with the protocol (e.g. a coinjoin). If Mallory aborts the protocol before completion, the commitment previously published across the network prevents her from being able to start a new session with any other user and so learn their UTXO. Mallory’s only option is to spend her coins from herself to herself in order to generate a new UTXO—a process that costs her money and so limits her ability to spy on users. (Note, though, that PoDLE as implemented in JoinMarket allows Mallory up to three retries by default so honest users aren’t penalized for occasional accidental failures, such as a loss of network connectivity.) The idea is to adapt this protocol for LN in order to prevent attackers from learning which available UTXOs are controlled by LN users.<br><br>Especially relevant to this post is the idea posted by Darosior here [6] which was summarized as follows:<br><br>> One proposal to fix this would require the person proposing to open the channel (e.g. Mallory) to provide their UTXO(s) in a ready-to-spend state so that probing would cost money (e.g. transaction fees). A downside of this approach is that the construction proposed would be easily identifiable by block chain analysis, making it easy to determine when a dual-funded channel was opened<br><br>The goals of this post is to (i) see if I understand the PoDLE idea correctly, to (ii) refine Darosior's idea and to (iii) propose a minimal alternative idea.<br><br><div>#  Requirements</div><br>Informally, here are the desirable properties I came up with for a dual funding protocol:<br><br>1. If a malicious initiator learns a peer UTXO, then the initiator should have to spend their UTXOs before reusing them against the next peer (should be forced to spend them to repeat attack -- *if attacking sequentially*).<br>2. A malicious initiator should not be able to use the same UTXOs in parallel with multiple peers (to learn the UTXOs of multiple makers with a single UTXO).<br>3. An honest initiator should not have to spend their UTXOs if they execute with a malicious peer.<br>4. dual-funded opening transactions should not have any distinguishing features (i.e. sighash flags).<br>5. An honest but intermittently failing initiator should not have their UTXO details sent by an honest peer to other parties.<br><br>Note I am going to ignore property (2) because of proposals below can turn their protection against sequential attacks (1) into protection against parallel attacks (2) by having the peer choose a random time delay and see if anything is gossiped to them that would indicate malicious behavior by the initiator in some other channel.<br> <br># PoDLEs<br><br>To solve this problem in JoinMarket, Waxwing had the idea [8] of turning knowledge of a secret key for a particular UTXO into a kind of unlinkable credential.<br><div>Given a UTXO public key P1, the initiator projects their private key onto a different generator J to produce P2.</div><div>P2 is unlinkable to P1 (without a proof) but is fully determined by P1.</div><div>This allows participants to maintain a blacklist of P2s without learning the P1s.</div><div>Having the P1s in the blacklist would make the blacklist itself useful for chain analysis because it contains a list of UTXOs that tried to open channels (but perhaps accidentally failed).<br></div><br>The idea is like this:<br>1. Taker asks some maker's if they want to do a coinjoin and sends them all SHA256(P2)<br>2. When they find the maker they want to proceed with they reveal P2 and prove DLEQ((P1, G), (P2, J)) i.e. P1 and P2 have the same private key just different base points.<br>3. If they haven't received SHA256(P2)from the gossip network 
 (i.e. it's not in the blacklist), the maker then sends their own UTXO data AND gossips SHA256(P2)<br>4. They carry on the protocol.<br><div><br></div>The current lightning proposal [1] follows the same logic except that it only gossips SHA256(P2) in case of malicious behavior (this seems sensible).<br><div>
If I understood it correctly, then it achieves properties (1,4,5).</div><div><br></div>The main downside is that it introduces a new gossip message. The difficulties associated with this are listed in [3].<br>Notably it is missing property (3) - protection against malicious peers who gossip SHA256(P2) even when there was no wrongdoing.<br><br>A question I have is why is SHA256(P2) sent up front? I think that P2 can just be sent along with the proof later on in the case of dual funding.<br>Waxwing gave an explanation of it in the case of joinmarket in [7] but I didn't grasp it.<br><br># Darosior's SIGHASH_SINGLE|SIGHASH_ANYONECANPAY<br><br>The proposal from Darosior [6] is to have the taker provide their inputs in a ready to broadcast state using SIGHASH_SIGNLE|SIGHASH_ANYONECANPAY.<br>This way the peer never needs to send their inputs directly to the initiator (the initiator will only find out about them when the transaction is broadcast).<br>I encourage the reader to look at [6] which has nice diagrams and is very short and to the point.<br>This achieves all properties except for (4 - distinguishable on-chain) which is why it was dismissed.<br><br>I think it is possible to extend the idea to achieve (4) and therefore obtain all desired properties.<br>Simply put peers can just use the SINGLE|ANYONECANPAY signature as back ups in case of abort. Here's how it could work in my mind:<br><br>1. Initiator requests dual-funding and provides a TX_temp spending their input set to a main output and a change output (does not sign it yet). They also provide a sighash SIGNLE|ANYONECANPAY signature on the main output spending into TX_backup-fund and a signature on the first commitment transaction spending from TX_backup-fund (exactly as in [6]).<br>2. Peer responds with commitment TX signature for TX_backup-fund.<br>3. Initiator responds with the signatures for TX_temp.<br>*Peer now has a fully functional transaction chain with which to open the channel -- now they can attempt to upgrade to a SIGHASH_ALL opening*. <br>4. Peer (if possible) checks there are no existing transactions in the chain or mempool spending from the taker's inputs. If not it responds with its inputs, change and commitment tx signature for a SIGHASH_ALL TX_fund.<br>5. Initiator responds with commitment TX signature and TX_fund input signatures.<br>6. Peer broadcasts TX_fund.<br>*If at any point after step 3 Initiator does not respond for ~2 seconds they broadcast TX_temp and TX_backup-funding*<br><br>We have (4) because the SINGLE|ANYONECANPAY signature only appears on-chain in case of abort (i.e. TX_backup-funding makes it on-chain).<br>It appears to be pretty close to the ideal solution in terms of privacy and security.<br>If the malicious initiator learns an output they will always have to spend one of their inputs otherwise they will quickly get hit by the TX_temp + TX_backup-funding.<br>Note that it is possible the node is just slow in which case even if step TX_backup-funding makes it in both parties should just carry on with the channel.<br><br>The downsides are that it involves six rounds of communication and cannot use the "interactive tx building" protocol developed for the original proposal<br><br># Signaling Transactions<br><br>Finally I present a simple but unintuitive protocol that achieves roughly the same properties as the PoDLE protocol but without lightning gossip messages.<br><br>Whenever the initiator adds an input in the interactive tx building they provide signatures on a "signaling" transaction spending that input (and any inputs they have added so far).<br>The signaling transactions will typically spend the funds back to the initiator's wallet.<br>Before revealing any of their inputs, the peer checks that none of the inputs added by the initiator are in their mempool/chain.<br>If the initiator aborts the protocol after learning one of the peer's inputs the peer broadcasts one of the signaling transactions. <br><br>Like the PoDLE proposal this doesn't achieve (3) since a malicious peer could broadcast the signaling transaction making the honest initiator pay a transaction fee before using the input in another session.<br>To mitigate this a bit, the transactions could be RBF and have a 1 sat-per-byte feerate to give the initiator a decent amount of time to use their input productively before the tx confirms (and paying a low fee if it ever does confirm).<br><div><br></div><div>
The advantages of signaling transactions over PoDLE is that it doesn't involve any wonky crypto or new gossip messages. 

</div>The advantage of the PoDLE proposal over this is that a malicious peer can only blacklist the UTXO (not necessarily force you to spend it).<br><br># Summary<br><br>The preference of protocol depends on how you weigh the importance of a malicious non-initiating peer griefing the initiator.<br>To protect fully, the extended version of Darosior's protocol does not allow griefing.<br>There is always a lot to be said for ruling out a class of attack even if it costs you a few rounds of communication.<br><br>Is griefing a real concern though? Layer-2 is full of opportunities to grief your counterparty and the ones presented here are hardly the worst.<br>If you're opening channels with someone who wants to grief you, you are already in trouble.<br>PoDLEs have very weak griefing in the form of unfairly adding your UTXO to the blacklist but comes at the cost of complexity and a few difficult to answer questions.<br><div>I think the simplicity of signaling transactions may be worth the extra griefing capabilities it offers a malicious peer given they are hardly as bad as the griefing capabilities they will have if you open a channel to them!</div><br>Cheers,<br><br>LL<br><br>[1] <a href="https://github.com/lightningnetwork/lightning-rfc/pull/524" target="_blank">https://github.com/niftynei/lightning-rfc/pull/1</a><br>[2] <a href="https://github.com/discreetlogcontracts/dlcspecs/pull/114" target="_blank">https://github.com/discreetlogcontracts/dlcspecs/pull/114</a><br>[3] <a href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-February/002516.html" target="_blank">https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-February/002516.html</a><br>[4] <a href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-January/002466.html" target="_blank">https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-January/002466.html</a><br>[5] <a href="https://bitcoinops.org/en/newsletters/2020/02/05/#interactive-construction-of-ln-funding-transactions" target="_blank">https://bitcoinops.org/en/newsletters/2020/02/05/#interactive-construction-of-ln-funding-transactions</a><br>[6] <a href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-January/002475.html" target="_blank">https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-January/002475.html</a><br><div>[7] <a href="https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-February/002522.html" target="_blank">https://lists.linuxfoundation.org/pipermail/lightning-dev/2020-February/002522.html</a></div><div>[8] <a href="https://joinmarket.me/blog/blog/poodle/">https://joinmarket.me/blog/blog/poodle/</a></div></div>