Research·Risk

The Bugs That Nearly Broke Bitcoin

Bitcoin's consensus rules have held since 2009, but the software implementing them has failed four times in ways that mattered. Two produced chain splits, one created 184 billion coins, and one would have allowed silent inflation. Each failure is more instructive than the record of success, because each shows where the real fragility is.

Level
Intermediate
Reading
8 min
Published
2026-11-24
Reviewed
2026-11-24

The interesting thing about Bitcoin’s reliability record is not that the rules have held. It is that the software enforcing them has failed repeatedly, and the system survived anyway — sometimes through design, sometimes through a handful of people being awake at the right hour.

Four incidents are worth knowing in detail. Each has a published post-mortem, each is verifiable against the chain, and each points at a different part of the stack.

What actually happened in August 2010?

Somebody created 184 billion bitcoins, and it lasted about five hours.

On 15 August 2010, in Bitcoin’s second year, block 74,638 contained a transaction that spent 0.5 BTC and produced outputs totalling 184,467,440,737.09551616 BTC — two addresses receiving roughly 92.2 billion each, plus a fraction to the miner. That number is not random. It is 2^64 divided by 10^8, which is to say the full range of a 64-bit integer expressed in bitcoin: the output values summed to more than the integer could hold, wrapped around, and the resulting total passed a check that compared outputs against inputs.

The fix shipped within five hours of discovery, as a soft fork rejecting any transaction with an output over 21 million coins and any sum that overflows. Many unpatched nodes kept building on the bad chain; the patched chain overtook it at height 74,691, 53 blocks later, and the transaction ceased to exist for anyone following the most-work chain. The 0.5 BTC it spent still exists and has not moved since.

Two details are easy to miss. The bug was not in the consensus rules as written down — it was in the arithmetic implementing them, which is a distinction without a difference, because in Bitcoin the code is the rule. And the recovery required a reorganisation deeper than most people’s confirmation threshold, resolved not by a protocol mechanism but by enough of the network upgrading quickly.

How did a database setting become a consensus rule?

By being invisible. In March 2013, the number of locks Berkeley DB was configured to hold split the chain for six hours.

Bitcoin versions before 0.8 used Berkeley DB, which requires the application to declare in advance how many locks it may need. The configured number was adequate for every block anyone had tested. Block 225,430 contained more transaction inputs than previously seen, needed more locks than were available, and was rejected by pre-0.8 nodes — while 0.8 nodes, which had moved to LevelDB and had no such limit, accepted it happily.

That made an undocumented database parameter into a consensus rule, and a worse one than any rule actually written down, because the number of locks required depended on the on-disk layout of each individual node’s index. Two nodes running identical software could disagree.

The split did not resolve itself: the 0.8 chain held around 60% of hash rate, so it would simply have kept winning. It ended because two pool operators downgraded to 0.7 at direct cost to themselves, putting the majority back on the chain the older nodes could follow. One large double spend occurred during the window, by someone testing whether it was possible rather than trying to profit.

BIP 50 is the post-mortem, and it is worth reading in full for the sentence where the root cause is identified as a limit nobody knew was load-bearing. The lasting lesson is that for consensus software, every observable behaviour is part of the specification, including the ones in your dependencies.

Could Bitcoin have been inflated in 2018?

Yes, by a miner, and the window was open for about eighteen months.

In 2014, Bitcoin Core 0.14 added a performance optimisation that removed a check — present since 2012 — that a single transaction did not spend the same input twice. The condition was still caught, but only by an assertion, which crashes rather than rejecting the block cleanly. That alone was a denial-of-service bug.

In 0.15 the assertion was subtly weakened as part of an unrelated redesign: it now asserted only that the output existed, not that it was unspent. The consequence, spelled out in Bitcoin Core’s own disclosure, is that a transaction double-spending an output created in an earlier block would hit no assertion at all. A miner could have included it and claimed the same value twice — inflation, in a block that other affected nodes would have accepted.

The disclosure timeline is the most instructive part of the whole episode. An anonymous reporter reported a crash bug at 14:57 on 17 September 2018. By 17:47 a developer had identified the inflation implication. A patch and a test for the denial-of-service half were published at 21:57 — publicly, while the inflation half was withheld — and 0.16.3 was tagged just after midnight. The withholding was deliberate: announce a crash bug loudly enough to get everyone upgrading, and say nothing about the worse problem until they had. It held for three days, until someone posted the full impact in a forum.

No exploitation was ever observed. The vulnerability existed in 0.14.0 through 0.16.2, which is to say in the software most of the network was running for most of two years.

Why did valid software still accept invalid blocks?

Because about half the hash rate was not checking. July 2015 is the one failure that was not a bug in Bitcoin Core at all.

BIP 66 tightened signature encoding rules, activating once 950 of the last 1,000 blocks signalled readiness. That threshold was crossed early on 4 July 2015, and shortly afterwards a miner in the non-upgraded minority produced a block that was now invalid — an entirely expected event, which the upgrade mechanism exists to make harmless.

What was not expected is that roughly half the network’s hash rate was SPV mining: building on new block headers before validating their contents, to avoid the seconds of idle time that validation costs. Those miners built on the invalid block. The result was a six-block fork on 4 July and a three-block fork on 5 July, with no double spends recorded in the first but real money lost — over $50,000 of mining income, by pools that had explicitly signalled they would enforce the rule they then failed to check.

The consequence for everyone else is the part worth keeping. For several hours, light wallets displayed confirmations for transactions in blocks that full nodes had rejected, because a confirmation count is a statement about work rather than about validity. The published advice was to wait thirty extra confirmations, which is another way of saying that the usual number assumes miners are validating.

What do these four have in common?

Not much, and that is the finding.

An arithmetic overflow, a dependency’s lock table, an optimisation that removed a check, and an economic shortcut taken by miners. Different layers, different decades, different kinds of mistake. No amount of care in one of them would have prevented the others, which is the argument against treating any single safeguard — code review, test coverage, formal methods, multiple implementations — as the thing that keeps Bitcoin honest.

What recurs is the response pattern. In every case the failure was detected quickly by people watching their own nodes, not by a monitoring system; the fix was distributed as software that operators chose to run; and the resolution depended on a majority of economic weight choosing the same chain. That is not a comforting mechanism, but it is the actual one, and it has now worked four times.

It is also why running a node is a different act from holding coins. The 2010 incident was caught because someone’s node rejected a block and they said so publicly. Three of these four would have been invisible to anyone trusting a service for their view of the chain.

Check it yourself

The 2010 transaction is gone from the main chain, but its block is not hard to reach. Compare the current supply against the schedule — the check that the overflow bug defeated:

bitcoin-cli gettxoutsetinfo

The total_amount field is summed from the unspent-output set on your own disk, not reported by anyone. Against the issuance schedule it is the only inflation audit that does not require trusting a publisher.

For the 2015 episode, the forks are still visible as stale blocks. Any block explorer’s orphan list for 4 July 2015 shows the six, and the invalid block hashes were published at the time.

What remains uncertain

Whether multiple implementations would help or hurt. Two of these four incidents were chain splits caused by two versions of one codebase disagreeing. The standard argument for implementation diversity — that a bug in one client does not take the network down — runs directly into the observation that consensus bugs are differences, and more implementations means more opportunities to differ. The debate is unresolved and the evidence cuts both ways.

How much of the current codebase carries similar risk. CVE-2018-17144 was introduced by an optimisation that looked safe and reviewed as safe. Nobody can say how many comparable changes are in the tree now. The honest answer is that the probability is not zero and is not estimable, which is the reason for the conservatism that outsiders read as stagnation.

Whether a quiet inflation bug would be noticed. The 2018 bug was found before exploitation, by luck as much as by process. A miner exploiting it carefully — once, for a modest amount — might not have been caught for a long time, and the supply check above is only run by the people who choose to run it. How many of those there are, and how often they look, nobody has measured.

Sources

Nearby