Bitcoin spends specific outputs, not a balance attached to someone's name. That accounting model depends on being able to refer to an output without quietly replacing the record behind the reference. An early consensus rule, BIP30, addresses precisely that problem: a transaction identifier must not overwrite an earlier transaction that still has unspent outputs.

This is a historical design lesson with a continuing practical consequence. A hash is useful for identifying data, but software must also define how identical identifiers interact with the ledger's changing state. “The identifier matches” is not a complete accounting rule.

An output has a two-part reference

The Bitcoin transaction reference defines an outpoint using a transaction identifier and an output index. The index distinguishes different outputs created by the same transaction, beginning with zero. An ordinary input names the earlier outpoint it wants to spend.

Imagine a simplified ledger entry called transaction T with outputs T:0 and T:1. These are teaching labels, not real transaction identifiers. If T:0 has been spent but T:1 remains available, the ledger still needs the latter record. A new entry using the same references cannot simply replace it as though the old transaction had disappeared.

The issue is not a familiar address appearing again. Multiple payments to one address can create separate outputs with different outpoints. Address reuse and transaction-identifier duplication are different questions.

The rule protects what remains unspent

BIP30 prohibits a block from containing a transaction whose identifier matches an earlier, not-fully-spent transaction in the same chain. It documents why duplicate coinbase transactions were possible and records two historical main-chain exceptions at heights 91,842 and 91,880.

Its rationale focuses on reversibility. Adding blocks and subsequently removing them during a reorganization must not leave a different set of usable outputs merely because a temporary block overwrote a record. The rule permits duplicates of fully spent transactions, rather than requiring permanent evidence about every transaction ever created.

That qualification matters. Describing BIP30 as a universal ban on any repeated transaction identifier loses the distinction the rule was designed around. Its concern is preserving the spendable state, not making every historical database query equivalent to a unique invoice lookup.

For our hypothetical T, spending only T:0 does not make the earlier transaction fully spent. The remaining output is the reason the overwrite would still be prohibited.

Height adds another form of separation

BIP34 requires the block height to appear first in the coinbase transaction's input script, using a specified minimal encoding. Its stated goals include transaction uniqueness. Because a different height changes the coinbase data, this adds a structural distinction between coinbases created for different heights.

The height is not an optional memo and cannot be substituted with a miner's arbitrary label. It is part of the required transaction construction. The useful conceptual difference is prevention versus state protection: making newly created coinbases distinct and refusing harmful overwrites address related parts of the problem.

Historical exceptions still matter when implementing a validator. A rule describing newly created data does not retroactively erase older bytes from the chain that software must process.

Implementation preserves the historical detail

Bitcoin Core v30.0's block-validation code contains explicit handling for BIP30 and its relationship with BIP34. It checks for existing coins at the proposed output references when enforcing the overwrite check and reports a consensus failure for an attempted overwrite.

The same source explains why an optimization that skips some checks has qualifications involving historical coinbase data. This article is not claiming that every block follows one unconditional database loop, or that BIP34 makes every conceivable historical duplication case disappear.

For someone building an indexer, our takeaway is to preserve the context of the data model rather than invent a shortcut from an introductory slogan. A transaction identifier, an output reference and a block occurrence serve related but distinct lookup purposes.

Ask the node the question you mean

Bitcoin Core's gettxout documentation illustrates the output-oriented model: the query takes a transaction identifier and output number and returns information about an unspent output, or null. Its optional mempool view can also exclude an output already spent by an unconfirmed transaction.

That is a state query, not a complete historical biography. When reconciling records, keep the intended question explicit: are you locating a transaction occurrence, checking an output or following a spend? BIP30's enduring lesson is that reliable accounting requires both identifiers and rules about how their associated state may change.