Major Bug In The Bitcoin Software Tests The Community And The Exchange Rate

Catastrophe has been averted, but accounting schism illustrates some serious flaws

Illustration of graph chart showing downward trend

Bitcoin went into crisis mode early this morning. This time, the threat wasn’t from hackers tampering with poorly secured virtual wallets. It was Bitcoin’s own code that was causing the trouble.

A compatibility issue between the two most recent versions of the cryptocurrency’s core software has resulted in a split in the Bitcoin blockchain, causing the currency to grow in two different directions at once. What does this mean? The biggest problem that two competing Bitcoin chains could breed is someone trying to spend the same coins on each chain. Bitcoin was explicitly designed to resolve such an occurrence—called “double spending”—and the mere possibility has thrown the validity of some recent Bitcoin transactions into question.

While, no one is at risk of losing any coins that they owned before the problem occurred, fixing it will require that many of the most recently generated coins (an estimated 600 of them) be abandoned.

Mt Gox, the largest online Bitcoin exchange, suspended Bitcoin deposits late last night after the problem was announced on an online Bitcoin forum. The exchange rate dropped 23 percent shortly after the news, but rebounded slightly and is now trading at US $43, only six dollars shy of the all time high reached last week.

The problem now seems to be under control, and Mt. Gox has resumed taking Bitcoin deposits. But it will take a while to fully correct the situation and there will be some lasting effects. Moreover, it’s a reminder of just how experimental Bitcoin is in nature—a reminder that some of the developers say they didn’t really need.

“This sort of thing illustrates the dangers of Bitcoin and is perhaps one reason the developers tend to be more conservative about it than others,” says Mike Hearn, one of the developers who have been working on the Bitcoin software and tending to its growth. “We know this sort of thing can happen.”

According to Hearn, here’s the detailed version of what happened.

Bitcoin works by publicly broadcasting a massive transaction log over a peer-to-peer network. Each time coins are spent or received, bundled transactions get tacked onto an ever-growing database called the Bitcoin blockchain. In order to secure transactions, everyone who shares the database—specifically those involved in editing it (called miners)must agree on the contents of each block that gets added on. If they don’t agree, an alternate copy of the chain will splinter off carrying a slightly different version of the transaction log. This is what was discovered late on Monday.

“There is a potential for catastrophic consensus failure—a so-called ‘hard fork,’” Hearn explained in an email. “If there is disagreement on the rules, then some nodes accept a block and other nodes reject it. If some of the nodes that reject it are miners, they will start to build a parallel block chain which is almost but not quite the same as the other one. This opens up the potential for double spending and other bad things.”

The seeds of the problem were sown in February, when the development team put out version 0.8. of the Bitcoin software. One of the improvements (ironically, the one that would ultimately cause the fork) was a switch in the software that manages the core database. Hearn wasn’t satisfied with the management software put in there by Bitcoin founder Satoshi Nakamoto, so he found something better.

“Last summer, I prototyped an upgrade to a newer library that does the same thing, which was built by some of the best engineers at Google. It’s based on the code to BigTable, which runs virtually all of Google’s databases. This new thing is called LevelDB.”

And when they incorporated it, LevelDB did make Bitcoin work better. But not every node in the network made the switch to Bitcoin 0.8 simultaneously. The fork was created when some nodes, operating on Bitcoin 0.7, encountered an extremely large block of transactions. And as their programming dictated, they just dumped the block and moved on. Meanwhile, the nodes running Bitcoin 0.8 processed the block just fine. At that point, the chain bifurcated and the two separate chains began growing in tandem. 

Now that their mathematical consensus has broken down, Bitcoiners are resorting to social consensus. Nearly every node will have to agree to work on the same version of the block chain, or the chaos will continue. It’s a very interesting situation for a community composed primarily of cryptoanarchists and libertarians—whose intent was to build a completely new currency based on the eradication of trust—to find themselves in.

“I think what will happen now is going to be a good test of the community,” says Hearn. “We have to get as many people upgraded to 0.8 as possible, as fast as possible, and then go through a deliberate hard fork much earlier than we had planned.”

So, for the record, that means that general Bitcoin users and merchants should be upgrading to version 0.8. Miners, however, should revert to 0.7 until a new version of Bitcoin has been written that is compatible with the older version.

The Tech Alert Newsletter

Receive latest technology science and technology news & analysis from IEEE Spectrum every Thursday.

About the Tech Talk blog

IEEE Spectrum’s general technology blog, featuring news, analysis, and opinions about engineering, consumer electronics, and technology and society, from the editorial staff and freelance contributors.