Experiments · Nobody Owns Money · Chapter 4
184 billion out of nothing
Bitcoin’s 2010 value overflow bug (CVE-2010-5139)
Everything is computed in your browser; nothing is sent anywhere.
About this experiment
On 15 August 2010, three months after the pizza, block 74,638 carried a transaction that created 184 billion bitcoins out of nothing, almost nine thousand times more than the rules allowed to exist. Amounts were stored as whole satoshis in a signed 64-bit cell, which holds a little over 92 billion bitcoins’ worth. The check of the day only looked at whether a payment’s outputs added up to no more than its input.
The transaction had half a bitcoin of input and two outputs of 92,233,720,368.54277039 BTC each. Their sum went past 2⁶³, the cell wrapped round to a small negative number, and a negative number is less than half a bitcoin, so the check let it through. The fixed version added the rule the old one lacked. Every output, and their sum, must be at most 21 million BTC.
The experiment runs both checks side by side on whatever you type. “As in block 74,638” loads the real amounts, and “Ordinary payment” loads a dull one for comparison. The arithmetic is exact, so the wrapped sum on the screen is the one the 2010 program saw. Look at the fee the old check grants the miner: with the real amounts it comes out larger than the whole input.
In the chapter Satoshi and the other developers shipped a fixed version in under five hours, the network rebuilt the chain from the block before the bug, and the extra coins vanished. It was the right call, and it showed early that when the code is wrong, a handful of people decide which history is the true one and the network goes along with them.
Sources
From the book
Nobody Owns Money · Chapter 4
Ten Thousand for a Pizza
They did the right thing, otherwise bitcoin would have ended in 2010. But this story already contained everything that would later be bashfully skirted around in conversations about code that is its own law. When the code made a mistake, people chose the correct history. A few developers decided which version of the record was the real one, and the network agreed with them.