Differences between database library modules from Oracle and Google temporarily sent Bitcoin market into chaos
On Tuesday, the Bitcoin (BTC) exchange rate suddenly dropped from over $48 to around $36. The virtual currency lost a quarter of its value, prompting Mt. Gox, the leading Bitcoin exchange, to suspend all transactions shortly afterwards.
Paul Ducklin, head of technology at enterprise security company Sophos, explains that it was the differences in versions of Bitcoin “mining” software that led to an error in a supposedly fool-proof system.
The problem emerged because of incompatibilities of different Bitcoin versions. Until version 0.7, Bitcoin coders used the Oracle Berkeley DB database library module, but this was unable to handle very long “blockchains”, the proof of value in Bitcoin. Version 0.8 switched to a different database library, Google’s LevelDB, which had no such problems. As a result, some of the network accepted newly “mined” bitcoins, while some didn’t.
No bitcoins were actually lost due to the error, except for those mined during a few hours on Tuesday.
Blame the miners
Bitcoins make up a decentralised virtual currency traditionally used among people interested in keeping their transactions secret. However, recently, a number of major online businesses have started to accept BTC as a form of payment, improving its reputation.
Bitcoin is based on an open-source, peer-to-peer Internet protocol introduced by an anonymous developer in 2009, and is not tied to any real money, but traded on various electronic exchanges to establish its price.
It relies on blockchains – cryptographic records of Bitcoin creation and use – to verify all transactions. According to Ducklin, a blockchain forms “a sort of transaction log” that allows “other players in the Bitcoin world to verify your solution to the cryptographic puzzle”. Every solution counts as one Bitcoin.
New solutions can only be produced through an intensive cryptography process that requires a lot of time and computational resources, called “mining”. As it turns out, it was the mining software that caused the value of Bitcoin to crash on Tuesday.
“It seems that version 0.7 of the Bitcoin mining software – the program that does the cryptographic guessing, and exchanges blockchains over its peer-to-peer network – had a fatal but unknown flaw,” writes Ducklin.
“This flaw was inherited from a database library module known as Oracle Berkeley DB that was used by Bitcoin coders until version 0.7; in version 0.8, they switched to a different database library, created by Google, known as LevelDB.”
A bug in Berkeley DB made it “choke” on blockchains bigger than a certain size, while LevelDB handled them just fine. As a result, half the network accepted the newly minted virtual coins, and the other half rejected them, wreaking chaos on the BTC market.
As a solution, Bitcoin developers have forced artificial limits on the size of the blockchains in the 0.8 software, and asked miners to promptly downgrade back to 0.7.
“After some emergency discussion on #bitcoin-dev, it seems best to try to get the majority mining power back on the ‘old’ chain, that is, the one which 0.7 accepts,” wrote Bitcoin developer Pieter Wuille in an e-mail.
Bitcoin exchange rate crashes have happened in the past: in 2011, Mt. Gox was hacked, causing the value of Bitcoins to plunge. While only about $1,000 worth of Bitcoins were stolen, the irregular trading that resulted from the incident dropped the price of one BTC from around £11 to under a penny.
And in 2012, four former customers sued the virtual currency exchange Bitcoinica, claiming that it owes them $460,457 (£293,080) in funds they previously deposited. This happened after the service was hacked twice, with attackers stealing over $177,000 worth of bitcoins.
“This time, it wasn’t the surrounding ecosystem that turned out to have feet of clay, but the software behind Bitcoin itself,” wrote Ducklin. “It reminds us how difficult it is to carry out a comprehensive code review on software that relies on third-party libraries, even if they are open source.”
At the time of writing, Bitcoin had recovered and is trading at around $47.
What do you know about Tech stocks and shares? Take our quiz!