<oembed><type>rich</type><version>1.0</version><author_name>npub1w30zwgl8947760cd62fawy9hqmxnq24cga5c8s5j6j7m07w96dnqzjzhn2</author_name><author_url>https://nostr.ae/npub1w30zwgl8947760cd62fawy9hqmxnq24cga5c8s5j6j7m07w96dnqzjzhn2</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2022-10-08&#xA;📝 Original message:Hi Dario,&#xA;&#xA;There aren&#39;t any risks with latest release of bitcoin core. However its not just munn or other things mentioned, even other bitcoin projects could be affected if [#25600][1] is merged.&#xA;&#xA;Anyway I cannot comment anymore, neither in the PR or repository. I tried my best. Peter Todd has ACKed it and it would affect his favorite coinjoin implementation that works with governments.&#xA;&#xA;Replacement policies are a per-node decision as Luke Dashjr said and projects should build upon it.&#xA;&#xA;[1]: https://github.com/bitcoin/bitcoin/pull/25600&#xA;&#xA;/dev/fd0&#xA;&#xA;Sent with [Proton Mail](https://proton.me/) secure email.&#xA;&#xA;------- Original Message -------&#xA;On Friday, October 7th, 2022 at 9:50 PM, Dario Sneidermanis via bitcoin-dev &lt;bitcoin-dev at lists.linuxfoundation.org&gt; wrote:&#xA;&#xA;&gt; Hello list,&#xA;&gt;&#xA;&gt; I&#39;m Dario, from Muun wallet, a mobile non-custodial bitcoin wallet. For the past&#xA;&gt; few days we&#39;ve been reviewing the latest bitcoin core release candidate, and we&#xA;&gt; found some troubling facts related to the opt-in full-RBF deployment.&#xA;&gt;&#xA;&gt; We first learned about the opt-in full-RBF proposal last June when it was&#xA;&gt; announced on the mailing list. Closing the gap between the protocol&#39;s relay&#xA;&gt; policies and the miner incentives is inevitable, so it was a welcomed addition.&#xA;&gt; Furthermore, allowing transaction replacements that remove the opt-in RBF flag&#xA;&gt; was deeply problematic.&#xA;&gt;&#xA;&gt; At the time, we understood we had at least a year from the initial opt-in&#xA;&gt; deployment until opt-out was deployed, giving us enough time to adapt Muun to&#xA;&gt; the new policies. However, when reviewing the 24.0 release candidate just a few&#xA;&gt; days ago, we realized that zero-conf apps (like Muun) must *immediately turn&#xA;&gt; off* their zero-conf features.&#xA;&gt;&#xA;&gt; I understand this wasn&#39;t the intention when designing the opt-in deployment&#xA;&gt; mechanism. Given this new information, do you see a path where we can delay the&#xA;&gt; opt-in deployment and find a safer way to deploy full-RBF?&#xA;&gt;&#xA;&gt; It&#39;d be great for this deployment to be a success so that we can continue fixing&#xA;&gt; the remaining relay policy problems, such as package relay and the RBF rules.&#xA;&gt; Maybe we could go straight to an opt-out deployment locked by code at a certain&#xA;&gt; height in the future to give time to everyone and, at the same time, avoid a&#xA;&gt; huge mempool divergence event?&#xA;&gt;&#xA;&gt; Below is our analysis of how zero-conf apps break with opt-in full-RBF. I hope&#xA;&gt; it helps.&#xA;&gt;&#xA;&gt; Cheers,&#xA;&gt; Dario&#xA;&gt;&#xA;&gt; # How do zero-conf apps work&#xA;&gt;&#xA;&gt; While the workings and trade-offs of zero-conf applications might be known by&#xA;&gt; many in this list, it&#39;s useful to define precisely how they work to understand&#xA;&gt; how they break.&#xA;&gt;&#xA;&gt; We call zero-conf applications to entities that accept on-chain payments from&#xA;&gt; *untrusted parties* and will sometimes deliver the paid-for product or service&#xA;&gt; without waiting for the transaction to be included in a block.&#xA;&gt;&#xA;&gt; Some examples of zero-conf apps:&#xA;&gt;&#xA;&gt; - Muun&#39;s submarine swaps for outgoing lightning payments&#xA;&gt; - Bitrefill&#39;s on-chain payments for gift cards and phone top-ups&#xA;&gt; - Many bitcoin ATMs&#39; on-chain deposits for selling bitcoin for cash (at least&#xA;&gt; the two biggest bitcoin ATM manufacturers support this: Genesis Coin and&#xA;&gt; General Byte)&#xA;&gt;&#xA;&gt; All of these applications are receiving incoming on-chain transactions for which&#xA;&gt; they don&#39;t control the inputs, and performing a risk analysis to decide whether&#xA;&gt; they are ok with accepting the payment without confirmation.&#xA;&gt;&#xA;&gt; In practice, this works because once the bitcoin P2P network has fully&#xA;&gt; propagated a non-RBF transaction, you need the collaboration of a miner to&#xA;&gt; replace it, which isn&#39;t easy to get today. Even though many of the biggest&#xA;&gt; miners offer off-band transaction broadcasting services, they currently won&#39;t&#xA;&gt; process conflicting transactions.&#xA;&gt;&#xA;&gt; Roughly, the risk analysis goes like this:&#xA;&gt;&#xA;&gt; 1. if an incoming transaction is RBF (direct or inherited)&#xA;&gt; --&gt; too risky, wait for 1 conf (or more) since it can be replaced at any time&#xA;&gt; 2. if the payment is for an amount greater than X&#xA;&gt; --&gt; too risky, wait for 1 conf (or more), since the amount is worthy of a&#xA;&gt; sophisticated attacker&#xA;&gt; 3. wait for full(ish) propagation of the incoming transaction&#xA;&gt; 4. if there&#39;s no double-spend attempt&#xA;&gt; --&gt; accept 0-conf&#xA;&gt;&#xA;&gt; As with any other risk analysis, there&#39;s always a false-negative detection rate,&#xA;&gt; leading to an expected loss, which the zero-conf app should be willing to bear.&#xA;&gt; Notice that the expected loss is tunable via the amount X in the above analysis.&#xA;&gt;&#xA;&gt; # Why are zero-conf apps not protected with an opt-in deployment&#xA;&gt;&#xA;&gt; Full-RBF adoption works on three different layers:&#xA;&gt;&#xA;&gt; - The transaction application layer&#xA;&gt; - The transaction relaying layer&#xA;&gt; - The transaction mining layer&#xA;&gt;&#xA;&gt; If an application wants to replace with full-RBF an *outgoing* transaction, it&#xA;&gt; will need:&#xA;&gt;&#xA;&gt; - An upgraded node that opted into full-RBF, from which it can broadcast the&#xA;&gt; replacement transaction&#xA;&gt; - A connected component of upgraded nodes that opted into full-RBF, that can&#xA;&gt; relay the replacement transaction&#xA;&gt; - A miner in that connected component with an upgraded node that opted into&#xA;&gt; full-RBF, that can mine the replacement transaction&#xA;&gt;&#xA;&gt; However, an application cannot control whether a replacement to an *incoming*&#xA;&gt; transaction is relayed via full-RBF. As soon as a single application can&#xA;&gt; generate replacements easily via full-RBF, all other applications have to assume&#xA;&gt; that any incoming transaction from an untrusted party might be replaced via&#xA;&gt; full-RBF. That is, for the application layer this is a forced upgrade.&#xA;&gt;&#xA;&gt; As soon as an unsophisticated attacker can use opt-in full-RBF, the risk&#xA;&gt; analysis performed by zero-conf applications stops working because the&#xA;&gt; transactions to analyze are all incoming transactions from untrusted parties.&#xA;&gt; Since some wallets already implement cancel functionality for opt-in RBF&#xA;&gt; transactions, enabling the same functionality for every transaction wouldn&#39;t&#xA;&gt; require much work, making canceling any unconfirmed transaction a one-click&#xA;&gt; experience. After this, the security model of zero-conf applications goes from&#xA;&gt; &#34;susceptible to attacks from miners&#34; to &#34;anyone can perform an attack, with an&#xA;&gt; easy-to-use interface&#34;.&#xA;&gt;&#xA;&gt; That is, the opt-in deployment of full-RBF doesn&#39;t protect zero-conf&#xA;&gt; applications from having to turn off their zero-conf features very soon after&#xA;&gt; the initial deployment. All mitigations are mostly ineffective against&#xA;&gt; untrusted parties.&#xA;&gt;&#xA;&gt; # Other things we have to fix&#xA;&gt;&#xA;&gt; While it&#39;s clear how full-RBF breaks zero-conf applications, other more subtle&#xA;&gt; things break in *many* wallets (Muun included). If given the opportunity, we&#xA;&gt; would like to fix them before deployment. One could argue that these things&#xA;&gt; were already broken, but they get considerably worse as the network adopts&#xA;&gt; full-RBF (even with an opt-in deployment), so we should fix them.&#xA;&gt;&#xA;&gt; ## Mental model for unconfirmed incoming transactions&#xA;&gt;&#xA;&gt; Many wallets with support for on-chain payments (Muun included) show incoming&#xA;&gt; external transactions in some way to their users before they confirm. This is a&#xA;&gt; common practice because not showing them leads users to worry that their money&#xA;&gt; disappeared (exchanges doing this is the #1 issue we have to deal with in our&#xA;&gt; customer support channels).&#xA;&gt;&#xA;&gt; With full-RBF, wallets should make it extremely clear to users that unconfirmed&#xA;&gt; funds are not theirs (yet). Otherwise, protocol-unaware users that are&#xA;&gt; transacting on-chain with untrusted parties can be easily scammed if they don&#39;t&#xA;&gt; know they have to wait for a confirmation. Eg. in Argentina, it&#39;s pretty common&#xA;&gt; to meet someone in person to buy bitcoin P2P for cash, even for newcomers.&#xA;&gt;&#xA;&gt; ## Block explorers as payment receipts&#xA;&gt;&#xA;&gt; Most wallets with support for on-chain payments (Muun included) use the&#xA;&gt; transaction view of a block explorer as a shareable payment receipt. The sender&#xA;&gt; of an on-chain transaction usually shares this link with the receiver to let&#xA;&gt; them know they made a payment. Protocol-unaware receivers sometimes take this&#xA;&gt; link as proof of payment.&#xA;&gt;&#xA;&gt; Most explorers currently don&#39;t track payment replacements and, more importantly,&#xA;&gt; don&#39;t warn users that unconfirmed funds are not theirs (yet). With full-RBF,&#xA;&gt; wallets should either stop relying on explorers for this functionality or wait&#xA;&gt; for them to support it explicitly.&#xA;&gt;&#xA;&gt; # Impact at Muun&#xA;&gt;&#xA;&gt; Work to transition Muun from using zero-conf submarine swaps to using payment&#xA;&gt; channels is ongoing, but we are still several months away from being production&#xA;&gt; ready. This means we would have to turn off outgoing lightning payments for&#xA;&gt; +100k monthly active users, which is a good chunk of all users making&#xA;&gt; non-custodial lightning payments today.&#xA;&gt;&#xA;&gt; Furthermore, the more subtle fixes imply non-trivial amounts of product work&#xA;&gt; that we cannot reasonably deploy before they start affecting users.&#xA;&gt;&#xA;&gt; While I cannot talk for other applications, there are many impacted in one way&#xA;&gt; or another, and none of the ones I checked with were aware of this change, or&#xA;&gt; its implications.&#xA;-------------- next part --------------&#xA;An HTML attachment was scrubbed...&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20221008/1ee7b850/attachment-0001.html&gt;</html></oembed>