<oembed><type>rich</type><version>1.0</version><author_name>npub1m230cem2yh3mtdzkg32qhj73uytgkyg5ylxsu083n3tpjnajxx4qqa2np2</author_name><author_url>https://nostr.ae/npub1m230cem2yh3mtdzkg32qhj73uytgkyg5ylxsu083n3tpjnajxx4qqa2np2</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2015-06-19&#xA;📝 Original message:Yesterday F2Pool, currently the largest pool with 21% of the hashing&#xA;power, enabled full replace-by-fee (RBF) support after discussions with&#xA;me. This means that transactions that F2Pool has will be replaced if a&#xA;conflicting transaction pays a higher fee. There are no requirements for&#xA;the replacement transaction to pay addresses that were paid by the&#xA;previous transaction.&#xA;&#xA;&#xA;I&#39;m a user. What does this mean for me?&#xA;---------------------------------------&#xA;&#xA;In the short term, very little. Wallet software aimed at average users&#xA;has no ability to reliably detect conditions where an unconfirmed&#xA;transaction may be double-spent by the sender. For example, Schildbach&#39;s&#xA;Bitcoin Wallet for Android doesn&#39;t even detect double-spends of&#xA;unconfirmed transactions when connected to a RBF or Bitcoin XT nodes&#xA;that propagate them. The least sophisticated double-spend attack&#xA;possibly - simply broadcasting two conflicting transactions at the same&#xA;time - has about 50% probability of success against these wallets.&#xA;&#xA;Additionally, SPV wallets based on bitcoinj can&#39;t even detect invalid&#xA;transactions reliably, instead trusting the full node(s) it is connected&#xA;too over the unauthenticated, unencrypted, P2P protocol to do validation&#xA;for them. For instance due to a unfixed bug¹ Bitcoin XT nodes will relay&#xA;double-spends that spend the output of the conflicting transaction. I&#39;ve&#xA;personally tested this with Schildbach&#39;s Bitcoin Wallet for Android,&#xA;which shows such invalid transactions as standard, unconfirmed,&#xA;transactions.&#xA;&#xA;Users should continue to assume that unconfirmed transactions could be&#xA;trivially reversed by the sender until the first confirmation. In&#xA;general, only the sender can reverse a transaction, so if you do trust&#xA;the sender feel free to assume an unconfirmed transaction will&#xA;eventually confirm. However, if you do not trust the sender and/or have&#xA;no other recourse if they double-spend you, wait until at least the&#xA;first confirmation before assuming the transaction will go through.&#xA;&#xA;In the long term, miner support of full RBF has a number of advantages&#xA;to users, allowing you to more efficiently make transactions, paying&#xA;lower fees. However you&#39;ll need a wallet supporting these features; none&#xA;exist yet.&#xA;&#xA;&#xA;I&#39;m a business. What does this mean for me?&#xA;-------------------------------------------&#xA;&#xA;If you use your own node to verify transactions, you probably are in a&#xA;similar situation as average users, so again, this means very little to&#xA;you.&#xA;&#xA;If you use a payment processor/transaction API such as BitPay, Coinbase,&#xA;BlockCypher, etc. you may or may not be accepting unconfirmed&#xA;transactions, and they may or may not be &#34;guaranteed&#34; by your payment&#xA;processor even if double-spent. If like most merchants you&#39;re using the&#xA;API such that confirmations are required prior to accepting orders (e.g.&#xA;taking a meaningful loss such as shipping a product if the tx is&#xA;reversed) nothing changes for you. If not I recommend you contact your&#xA;payment processor.&#xA;&#xA;&#xA;I&#39;m a miner. Why should I support replace-by-fee?&#xA;-------------------------------------------------&#xA;&#xA;Whether full or first-seen-safe⁵ RBF support (along with&#xA;child-pays-for-parent) is an important step towards a fully functioning&#xA;transaction fee market that doesn&#39;t lead to users&#39; transactions getting&#xA;mysteriously &#34;stuck&#34;, particularly during network flooding&#xA;events/attacks. A better functioning fee market will help reduce&#xA;pressure to increase the blocksize, particularly from the users creating&#xA;the most valuable transactions.&#xA;&#xA;Full RBF also helps make use of the limited blockchain space more&#xA;efficiently, with up to 90%+ transaction size savings possible in some&#xA;transaction patterns. (e.g. long payment chains⁶) More users in less&#xA;blockchain space will lead to higher overall fees per block.&#xA;&#xA;Finally as we&#39;ll discuss below full RBF prevents a number of serious&#xA;threats to the existing level playing field that miners operate in.&#xA;&#xA;&#xA;Why can&#39;t we make accepting unconfirmed txs from untrusted people safe?&#xA;-----------------------------------------------------------------------&#xA;&#xA;For a decentralized wallet, the situation is pretty bleak. These wallets&#xA;only have a handful of connections to the network, with no way of&#xA;knowing if those connections give an accurate view of what transactions&#xA;miners actually know about.&#xA;&#xA;The only serious attempt to fix this problem for decentralized wallets&#xA;that has been actually deployed is Andresen/Harding&#39;s double-spend&#xA;relaying, implemented in Bitcoin XT. It relays up to one double-spend&#xA;transaction per double-spent txout, with the intended effect to warn&#xA;recipients. In practice however this functionality makes it easier to&#xA;double-spend rather than harder, by giving an efficient and easy way to&#xA;get double-spends to miners after the fact. Notably my RBF&#xA;implementation even connects to Bitcoin XT nodes, reserving a % of all&#xA;incoming and outgoing connection slots for them.&#xA;&#xA;Additionally Bitcoin XT&#39;s double-spend relaying is subject to attacks&#xA;include bandwidth exhaustion, sybil attacks, and Gervais&#39;s non-sybil&#xA;interactive attacks⁷ among many others.&#xA;&#xA;&#xA;What about centralised wallets?&#xA;-------------------------------&#xA;&#xA;Here the solutions being deployed, planned, and proposed are harmful,&#xA;and even represent serious threats to Bitcoin&#39;s decentralization.&#xA;&#xA;&#xA;Confidence factors&#xA;------------------&#xA;&#xA;Many services such as BlockCypher² have attempted to predict the&#xA;probability that unconfirmed transactions will be mined, often&#xA;guaranteeing merchants payment³ even in the event of a double-spend. The&#xA;key component of these predictions is to sybil attack the P2P network as&#xA;a whole, connecting to as many nodes as possible to measure transaction&#xA;propagation. Additionally these services connect to pools directly via&#xA;the getblocktemplate protocol, repeatedly downloading via GBT the lists&#xA;of transactions in the to-be-mined blocks to determine what transactions&#xA;miners are attempting to mine.&#xA;&#xA;None of these measures scale, wasting significant network and miner&#xA;resources; in one instance a sybil attack by Chainalysis even completely&#xA;blocked the users of the SPV wallet Breadwallet⁴ from accessing the&#xA;network. These measures also don&#39;t work very well, giving double-spend&#xA;attackers incentives to sybil attack miners themselves.&#xA;&#xA;&#xA;Transaction processing contracts with miners&#xA;--------------------------------------------&#xA;&#xA;The next step after measuring propagation fails is to contract with&#xA;miners directly, signing contracts with as much of the hashing power as&#xA;possible to get the transactions they want mined and double-spends&#xA;rejected. The miners/pools would then provide an authenticated API&#xA;endpoint for exclusive use of this service that would allow the service&#xA;to add and remove specific transactions to the mempool on demand.&#xA;&#xA;There&#39;s a number of serious problems with this:&#xA;&#xA;1) Mining contracts can be used to double-spend&#xA;&#xA;...even when they&#39;re being used &#34;honestly&#34;.&#xA;&#xA;Suppose Alice is a merchant using CoinPayCypher, who has contracts with&#xA;75% of the hashing power. Bob, another merchant, meanwhile uses a&#xA;decentralized Bitcoin Core backend for payments to his website.&#xA;&#xA;Mallory wants to double-spend Bob&#39;s to buy his expensive products. He&#xA;can do this by creating a transaction, tx1, that pays Alice, followed by&#xA;a second transaction, tx2, that pays Bob. In any circumstance when&#xA;Mallory can convince Bob to accept tx2, but prevent Bob from seeing tx1,&#xA;the chance of Malory&#39;s double-spend succeeding becomes ~75% because&#xA;CoinPayCypher&#39;s contracts with mining ensure the transaction paying&#xA;Alice will get mined.&#xA;&#xA;Of course, dishonest use and/or compromise makes double-spending&#xA;trivial: Malory can use the API credentials to ask miners to reject&#xA;Bob&#39;s payment at any time.&#xA;&#xA;&#xA;2) They still don&#39;t work, without 51% attacking other miners&#xA;&#xA;Even if CoinPayCypher has 75% of the hashing power on contract, that&#39;s&#xA;still a potentially 75% chance of being double-spent. The 25% of miners&#xA;who haven&#39;t signed contracts have no _decentralized_ way of ensuring&#xA;they don&#39;t create blocks with double-spends, let alone at low cost. If&#xA;those miners won&#39;t or can&#39;t sign contracts with CoinPayCypher the only&#xA;next step available is to reject their blocks entirely.&#xA;&#xA;&#xA;3) Legal contracts give the advantage to non-anonymous miners in&#xA;   Western jurisdictions&#xA;&#xA;Suppose CoinPayCypher is a US company, and you&#39;re a miner with 1%&#xA;hashing power located in northern China. The barriers to you succesfully&#xA;negotiating a contract with CoinPayCypher are significant. You don&#39;t&#xA;speak the same langauge, you&#39;re in a completely different jurisdiction&#xA;so enforcing the legal contract is difficult, and being just 1%,&#xA;CoinPayCypher sees you as insignificant.&#xA;&#xA;Who&#39;s going to get the profitable hashing power contracts first, if at&#xA;all? Your English speaking competitors in the west. This is inherently a&#xA;pressure towards centralization of mining.&#xA;&#xA;&#xA;Why isn&#39;t this being announced on the bitcoin-security list first?&#xA;------------------------------------------------------------------&#xA;&#xA;I&#39;ve had repeated discussions with services vulnerable to double-spends;&#xA;they have been made well aware of the risk they&#39;re taking. If they&#39;ve&#xA;followed my own and others&#39; advice they&#39;ll at minimum have constant&#xA;monitoring of the rate of double-spends both on their own services and&#xA;on the P2P network in general.&#xA;&#xA;If you choose to take a risk you should accept the consequences.&#xA;&#xA;&#xA;How do I actually use full RBF?&#xA;-------------------------------&#xA;&#xA;First get the full-RBF patch to v0.10.2:&#xA;&#xA;    https://github.com/petertodd/bitcoin/tree/replace-by-fee-v0.10.2&#xA;&#xA;The above implementation of RBF includes additional code to find and&#xA;preferentially connect to other RBF nodes, as well as Bitcoin XT nodes.&#xA;Secondly, try out my replace-by-fee-tools at:&#xA;&#xA;    https://github.com/petertodd/replace-by-fee-tools&#xA;&#xA;You can watch double-spends on the network here:&#xA;&#xA;    http://respends.thinlink.com/&#xA;&#xA;&#xA;References&#xA;----------&#xA;&#xA;1) &#34;Replace-by-fee v0.10.2 - Serious DoS attack fixed! - Also novel&#xA;    variants of existing attacks w/ Bitcoin XT and Android Bitcoin Wallet&#34;,&#xA;   Peter Todd, May 23rd 2015, Bitcoin-development mailing list,&#xA;   http://www.mail-archive.com/bitcoin-development@lists.sourceforge.net/msg07795.html&#xA;&#xA;2) &#34;From Zero to Hero: Bitcoin Transactions in 8 Seconds&#34;,&#xA;   June 2nd, 2014, Erik Voorhees,&#xA;   https://medium.com/blockcypher-blog/from-zero-to-hero-bitcoin-transactions-in-8-seconds-7c9edcb3b734&#xA;&#xA;3) Coinbase Merchant API, Accessed Jun 19th 2015,&#xA;   https://developers.coinbase.com/docs/merchants/callbacks#confirmations&#xA;&#xA;4) &#34;Chainalysis CEO Denies &#39;Sybil Attack&#39; on Bitcoin&#39;s Network&#34;,&#xA;   March 14th 2015, Grace Caffyn, Coindesk,&#xA;   http://www.coindesk.com/chainalysis-ceo-denies-launching-sybil-attack-on-bitcoin-network/&#xA;&#xA;5) &#34;First-Seen-Safe Replace-by-Fee&#34;,&#xA;   May 25th 2015, Peter Todd, Bitcoin-development mailing list,&#xA;   http://www.mail-archive.com/bitcoin-development%40lists.sourceforge.net/msg07829.html&#xA;&#xA;6) &#34;Cost savings by using replace-by-fee, 30-90%&#34;,&#xA;   May 25th 2015, Peter Todd, Bitcoin-development mailing list,&#xA;   http://www.mail-archive.com/bitcoin-development@lists.sourceforge.net/msg07813.html&#xA;&#xA;7) &#34;Tampering with the Delivery of Blocks and Transactions in Bitcoin&#34;,&#xA;    Arthur Gervais and Hubert Ritzdorf and Ghassan O. Karame and Srdjan Capkun,&#xA;    Cryptology ePrint Archive: Report 2015/578, Jun 10th 2015,&#xA;    http://eprint.iacr.org/2015/578&#xA;&#xA;-- &#xA;&#39;peter&#39;[:-1]@petertodd.org&#xA;0000000000000000070a2bb3b92c20d5c2c971e6e1a7abe55cdbbe6a2dd9a5ad&#xA;-------------- next part --------------&#xA;A non-text attachment was scrubbed...&#xA;Name: signature.asc&#xA;Type: application/pgp-signature&#xA;Size: 650 bytes&#xA;Desc: Digital signature&#xA;URL: &lt;http://lists.linuxfoundation.org/pipermail/bitcoin-dev/attachments/20150619/fa3a7c7a/attachment.sig&gt;</html></oembed>