Friday, 10 August 2018

PSA: The Bitcoin ABC Bug Disclosed by Corey Fields Would NOT Have Destroyed Bitcoin Cash (Details inside)

Top posts now on /r/btc are about the responsible disclosure of a bug (introduced by code refactoring) found in a release of Bitcoin ABC, the most popular node implementation for Bitcoin Cash. The way the tipster handled his discovery went beyond what anyone would be expected to do, and the BCH community is offering gracious thanks, for good reason. However, it's important, in addition to seeking to learn from the incident, to fully understand the dangers and probable outcomes of exploit. The Medium article somewhat exaggerates this claiming "transacting Bitcoin Cash safely would no longer be possible". That's not right, nor are highly upvoted comments in threads claiming this white hat "saved BCH". Why? Because the EXACT same thing happened to the blockchain now known as Bitcoin BTC or simply Core.

First, a quick recap on the bug. The "SIGHASH_BUG" as the tipster calls it would have allowed an attacker to create a transaction splitting the Bitcoin Cash blockchain into two incompatible chains, due to a validation check apparently removed in the code refactoring. The tipster correctly explains that because blocks are chained together, a difference in any block creates a completely incompatible future chain for any nodes that don't incorporate that change. In other words, all node software must remain in transaction and block lockstep at every point along the way as the blockchain grows. At any point where a difference is introduced, nodes accepting the difference as valid will fork or split from nodes that reject it as invalid. This is not a problem if there are say 100 total nodes and 1 node forks with some difference. The network would hardly notice. However, a substantial number of nodes, say 40 out of 100 would be more disruptive, because a significant part of the network, which underlies a real world economy of users and businesses would suddenly disagree about reality.

As stated the exact same thing happened before. I lived it. I can't recall the exact date, but it was I believe around March 2013. There was only one major Bitcoin blockchain (BTC), and Gavin Andresen was recognized as the lead software developer, along with four others whom he considered his closest peers - Jeff Garzik, Greg Maxwell, Pieter Wuille and Wladimir van der Laan. Mike Hean would have been included in that group but he primarily worked on a separate protocol codebase of his own creation (BitcoinJ). Again, the issue arose from changing the software and issuing a release containing the undiscovered bug. I logged into BitcoinTalk.org to see the community in a fair panic. People were posting memes about the Titanic sinking and popping bubbles. There was an urgent stickied alert from Pieter Wuille IIRC acknowledging the trouble with action items for those running nodes. The scene was chaotic but people found Bitcoin was experiencing its first unintentional "chain split".

It was later discovered how the bug came about. Database code was rewritten in a way nodes running older/upgraded versions of the software would reject blocks seen as perfectly valid by those who upgraded. A large portion of (but not all) miners had upgraded when the split occurred. To resolve the issue Gavin Andresen reached out to miners and asked one side (IIRC) to revert back to the older version. This put the network back into agreement, with the forked blocks forever discarded. Two things made the situation quite a non-issue. The first is that (wisely) a prior rule had been introduced that newly mined coins could not be moved (spent) for 100 blocks, which is about 17 hours. This meant no economic activity could possibly have occurred on the "wrong" chain. Second, Gavin, being the upstanding, generous, caring person he is, gave miners on the losing side bitcoins he had sitting in an early faucet (Gavin invented the idea of faucets). So ultimately no harm was done. This is why it wouldn't have been the case BCH would have "died" either if it had actually gone through a splitting action.

A final thing I'll point out is this is a vote in favor of having more than one software implementation. Gavin later discussed this very thing at an MIT Bitcoin workshop. He reflected on a couple key things in hindsight about that bug. One is that even had he not reached out to miners to manually put them back into consensus he said things would still have been okay, because there would have eventually been a longer chain, which is ultimately what Bitcoin respects. Second, he posited this was why having multiple implementations is a good idea. A bug in one version is unlikely to be present in all versions, so a network well diversified is more bug robust, as there is less chance a critical bug affects a majority of the network. BitcoinABC is adopted by about 60% of the BCH network, and about half had upgraded, meaning had the bug activated then about 30% would have split away. However, even in the case 100% had upgraded and the bug activated, it would mean 60% of the network would disagree with 40% (nodes running other than Bitcoin ABC), so there would still soon be a longer chain. Network participants would then need to decide which software version to adopt to put 100% of the network back into consensus. So, again, disruptive, but clearly not "death" or inability to ever again transact.

submitted by /u/cryptos4pz
[link] [comments]

source https://www.reddit.com/r/btc/comments/967p0s/psa_the_bitcoin_abc_bug_disclosed_by_corey_fields/

No comments:

Post a Comment