Technology

The 184 Billion Bitcoin Bug: Two Flaws That Could Have Ended It All

The 184 Billion Bitcoin Bug: Two Flaws That Could Have Ended It All

Bitcoin's core promise is scarcity: 21 million coins, no more, enforced by code that everyone runs. Take that away and there is no reason for bitcoin to be worth anything at all. So the most dangerous bug imaginable isn't one that steals coins — it's one that creates them.

That has happened twice.

August 2010: the value overflow incident

On 15 August 2010, block 74638 contained a transaction that produced outputs totalling over 184 billion bitcoin — roughly 8,800 times the entire supply that will ever exist. It was not a theft or a hack of anyone's wallet. It was an integer overflow.

Bitcoin tracks amounts as whole numbers of satoshis. The code checked that each individual output was a sane value, but when it summed the outputs to compare them against the inputs, the total wrapped around past the maximum the data type could hold and came out as a small number. The transaction therefore looked, to the software, like it balanced. Two outputs of about 92.2 billion BTC each were created, and the network accepted them.

The response is the reason the story is remembered fondly rather than as a catastrophe. The bug was spotted within hours and reported on the bitcointalk forum. Satoshi Nakamoto — still active at the time — and developer Gavin Andresen wrote a patch that added an explicit check that output values are in range, and released a new client version the same day. Miners and node operators upgraded, and the patched software rejected the bad block. Within about five hours, the chain containing the overflow was abandoned in favor of a longer, clean chain. The 184 billion coins ceased to exist.

It remains the only time bitcoin's ledger has been deliberately reorganized to undo a transaction — done when the network was tiny, the fix was uncontroversial, and the alternative was the end of the project.

September 2018: the bug that sat there for two years

The second one is more unsettling, because it was silent.

CVE-2018-17144 was introduced into Bitcoin Core in 2016 as part of a performance optimization. A check for duplicate transaction inputs — attempting to spend the same coin twice in a single transaction — was inadvertently removed in a code path where it was still needed. The immediate consequence was a denial-of-service bug: a crafted transaction would crash nodes. That alone would have been serious.

But reviewing the code closely, developers found the deeper problem. Under the right construction, the same flaw could be used not just to crash nodes but to create new bitcoin out of nothing, by double-spending an input inside one transaction. The supply cap could have been broken, and — unlike 2010 — it might not have been obvious at a glance.

The flaw was reported privately in September 2018 by an anonymous researcher. Developers handled it as a security disclosure rather than an open discussion: a fix was written, a patched release pushed out, and miners and major operators were urged to upgrade quickly and quietly, with the full severity disclosed only after the network had largely updated. It was, as far as anyone can tell, never exploited. It had been live in released software for roughly two years.

What these two incidents really tell you

The uncomfortable lesson first: "the code enforces 21 million" is only as true as the code is correct. Bitcoin's rules are not laws of physics; they are software written by people, and software has bugs. Anyone who tells you bitcoin's supply is mathematically guaranteed is overstating it. What's guaranteed is that the rule is public, that thousands of independent parties run and check it, and that breaking it is extremely visible.

The reassuring lesson second: both times, it worked. The bugs were found — one by an alert user watching the chain, one by a researcher reading the source — and fixed within hours in the first case and before exploitation in the second. Open source means anyone can introduce a subtle mistake, and also that anyone can catch one.

It's also why bitcoin's development culture is as conservative as it is. The protocol changes slowly, new features are debated for years, and "we could just add this" is met with suspicion. After 2018, running multiple independent node implementations and investing heavily in review and testing stopped being a theoretical nicety. Both of bitcoin's near-death software experiences came from code that looked fine to competent people.

← All articles