BOMBARCHIVE
Explore

A living reference collection. Written in the wiki, preserved in Git.

The archiveBitcoin

Old revision: BIP 30

archive: trace BIP 30 duplicate txid history

BIP 30 is the Bitcoin consensus rule that prevents a new transaction from overwriting an earlier transaction with the same transaction identifier while the earlier transaction still has unspent outputs. It was assigned on 22 February 2012 after a long-known duplicate-coinbase quirk was shown to have sharper consequences during chain reorganisations.

The duplicates were already in the chain

Bitcoin's historical main chain contains two pairs of duplicate coinbase transactions:

  • blocks 91,812 and 91,842 share coinbase txid d5d27987d2a3dfc724e359870c6644b40e497bdc0589a033220fe15429d88599;
  • blocks 91,722 and 91,880 share coinbase txid e3bf3d07d4b0375638d5f1db5255fe07ba2c4cb067cd81b84ee974b6585fb468.

Russell O'Connor documented both duplicate coinbases on 6 February 2012 while explaining why they mattered. Russell O'Connor, “Mirco… Mezzo… Macroflation—Overheated Economy”, 6 February 2012 — contemporary technical account

Current Bitcoin Core still carries the exact historical exception in consensus code. IsBIP30Repeat identifies blocks 91,842 and 91,880 as the later repeats. IsBIP30Unspendable identifies blocks 91,812 and 91,722 as the earlier coinbases whose outputs were overwritten. Bitcoin Core validation — current implementation

Coinbases were unusually easy to duplicate because they do not spend an ordinary previous output. Before BIP 34 made the current height a required prefix in later coinbase scriptSigs, nothing in Bitcoin consensus guaranteed that two coinbase serializations mined at different heights would differ.

February 2012: a database quirk becomes a consensus problem

O'Connor's 6 February post makes the key distinction plainly: a transaction hash identifies the transaction's contents, not a unique historical occurrence of those contents. The reference client nevertheless used that hash as the database key.

When a later transaction with the same txid arrived, it could overwrite the earlier database entry. A chain reorganisation could then disconnect the later copy without correctly restoring the earlier one. O'Connor showed that this could make previously confirmed transaction state much less secure than users assumed. Contemporary demonstration and technical account

This was not a claim that SHA-256 had been broken. The two transactions had the same identifier because their serialized contents were the same.

The BIP 30 rule

BIP 30, authored by Pieter Wuille and assigned on 22 February 2012, chose a deliberately narrower rule than “a txid may never repeat”:

Blocks are not allowed to contain a transaction whose identifier matches that of an earlier, not-fully-spent transaction in the same chain.

BIP 30 — standards record

That “not-fully-spent” condition matters. The BIP explicitly allows a fully spent transaction to be duplicated so a validating node does not need to retain permanent evidence for every transaction ever seen merely to prove that its txid never reappears. The rule protects live UTXO state rather than turning the complete historical set of txids into an eternal consensus index.

Wuille's implementation commit landed on 3 March 2012. Its commit message calls the change a network rule and records the trade-off directly: changing consensus risked a split, but leaving the overwrite behaviour unresolved carried related reorganisation risk. “Do not allow overwriting unspent transactions (BIP 30)” — direct implementation record

The first implementation applied the rule to mainnet blocks whose timestamp was after 15 March 2012 00:00 UTC. On 10 September 2012, Gregory Maxwell changed the implementation to apply BIP 30 to the whole historical chain except the two blocks that already violated it, 91,842 and 91,880. His commit explains that the wider check also closed an initial-block-download denial-of-service path involving old forks. “Apply BIP30 checks to all blocks except the two historic violations” — direct implementation record

BIP 34 reduced the problem, but did not erase BIP 30

BIP 34 required later coinbase transactions to begin their scriptSig with the current block height. That makes two ordinary post-BIP-34 coinbases at different heights naturally different at the serialization level.

In 2015, Bitcoin Core PR #6931 used that relationship as an optimization: once the known chain was past BIP 34 activation and clear of the two historical duplicate chains, Core could skip the more expensive BIP 30 UTXO-overwrite check. Bitcoin Core PR #6931 — “Skip BIP 30 verification where not necessary”

The shortcut turned out to need a boundary. In 2018, PR #12204 documented that some pre-BIP-34 coinbase scripts happen to begin with bytes that can be interpreted as a valid future BIP-34 height. A future coinbase at that height could therefore reproduce an old coinbase serialization despite obeying BIP 34.

The review's exhaustive search found the earliest relevant indicated heights as 209,921, 490,897 and 1,983,702. The first was still inside explicit BIP 30 enforcement; the second was analysed and passed with a different coinbase. The merged fix made Bitcoin Core resume explicit BIP 30 checking from height 1,983,702 onward. Bitcoin Core PR #12204 — direct 2018 correction · Current enforcement code

So the durable version is a little less tidy than the usual summary. BIP 34 makes duplicate coinbases structurally avoidable across the normal post-activation chain, but historical pre-BIP-34 script bytes mean BIP 30 still has a future consensus role in current Bitcoin Core.

Why Ordinal theory inherits this scar

Ordinal theory tracks satoshis through Bitcoin transaction inputs and outputs. To reproduce Bitcoin's historical UTXO behaviour, it cannot pretend the duplicate-txid blocks never happened.

The Ordinal Numbers draft therefore carries an explicit displacement rule: if a transaction is mined with the same txid as outputs currently present in the UTXO set, the newer outputs displace the older entries, and sats contained in any still-unspent outputs of the first occurrence are treated as destroyed. The draft names the same two mainnet pairs: 91,812/91,842 and 91,722/91,880. Ordinal Numbers draft — application-layer rule

This is a useful boundary between Bitcoin and Ordinals. Bitcoin consensus determines which outpoints survive. Ordinal theory then has to decide what that consensus history means for the serial identities it assigns to sats. The exception is not an Ordinals invention; it is inherited from an early Bitcoin identity collision.

Open research

Open question
Preserve the raw coinbase transactions and output state for blocks 91,722, 91,812, 91,842 and 91,880 so the duplicate pairs can be verified from chain artifacts inside the archive rather than only from code and later explorers.
Open question
Recover the February–March 2012 developer discussion around BIP 30 and distinguish O'Connor's demonstrated technical result, the BIP's stated rationale, and any additional concerns considered during review.