BOMBARCHIVE
Explore

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

The archiveBitcoin

Coinbase transaction

A coinbase transaction is the special first transaction in a Bitcoin block. Unlike an ordinary Bitcoin transaction, it does not spend an earlier transaction output. It creates the block's allowed new subsidy and can also collect transaction fees from the rest of the block.

What makes it a coinbase

Current Bitcoin Core defines CTransaction::IsCoinBase() as a transaction with exactly one input whose prevout is null. Bitcoin Core transaction primitive — pinned source

Block validation adds the positional rule: the first transaction must be coinbase, and every transaction after it must not be. Bitcoin Core block validation — pinned source

That makes “coinbase” a consensus-defined transaction role, not simply a label for whichever payment goes to the miner.

Subsidy and fees

A miner may assign coinbase outputs up to the block's allowed reward: the height-dependent block subsidy plus the transaction fees paid by the block's non-coinbase transactions. Bitcoin Core rejects a block whose coinbase outputs exceed that amount as bad-cb-amount. Bitcoin Core reward validation — pinned source

The miner does not have to claim the entire amount. Consensus checks an upper bound, not an obligation to collect every available satoshi.

That distinction matters to Ordinal theory. Ordinal numbering follows the subsidy that could have been created, while fee sats are assigned into the coinbase after the subsidy sequence. If a miner underclaims the available subsidy, later ordinal numbers do not collapse downward to fill the gap.

The coinbase input script

Because the coinbase input does not unlock a previous output, its scriptSig has a different job from an ordinary input script.

Bitcoin Core currently requires that coinbase scriptSig to be between 2 and 100 bytes. Bitcoin Core transaction checks — pinned source

Since BIP 34, newly valid mainnet coinbases must begin that script with the block height encoded as a script number. The remaining space can carry miner-selected data such as an extra nonce or identifying text. BIP 34 therefore did not invent the coinbase transaction; it changed the required prefix of a field the coinbase already possessed. BIP 34 — standards record

This is also why block height and the block header should not be conflated. The height commitment lives inside the coinbase transaction, which is then committed indirectly by the block header's transaction Merkle root.

Coinbase maturity

Coinbase outputs are not immediately spendable. Current Bitcoin consensus uses a maturity of 100 blocks: when an attempted spend is checked, Bitcoin Core rejects it if the spending height minus the coinbase's height is less than 100. Bitcoin Core consensus constants — pinned source · Bitcoin Core input validation — pinned source

The delay keeps newly created mining rewards from being spent while the block that created them is still relatively shallow and therefore more exposed to reorganisation.

The genesis exception

The Genesis block contains a coinbase transaction with a 50 BTC output, but this output cannot be spent. Bitcoin Core's genesis construction notes that the generation output was never included in the original transaction database. Its exclusion is distinct from the ordinary 100-block maturity delay: waiting more blocks does not make that output spendable. The source documents the exception, not whether the original omission was intentional. Bitcoin Core genesis construction

Duplicate coinbases and BIP 30

Early coinbases exposed a transaction-identity edge case. Because no rule originally forced coinbases at different heights to contain different data, two separately mined coinbase transactions could serialize identically and therefore have the same txid.

Bitcoin's historical chain contains two such duplicate pairs. BIP 30 records how the later occurrence could overwrite the earlier UTXO database entry and how the 2012 consensus rule constrained future repeats.

BIP 34 then made the current height a required prefix in later coinbases, giving ordinary post-activation coinbases a natural source of uniqueness. As BIP 30 documents, that reduced the duplicate-txid problem without making the older consensus rule completely irrelevant.

SegWit made the coinbase a commitment carrier

Segregated Witness added another role to the coinbase transaction.

BIP 141 defines a witness commitment stored in a coinbase output. The commitment binds the block's witness Merkle root together with a 32-byte reserved value carried in the coinbase input's witness. For this calculation, the coinbase transaction's own wtxid is treated as all zeroes. BIP 141 — standards record

This turned the coinbase into more than the block's issuance-and-fee transaction. It also became a backward-compatible place where new block-level commitment data could be anchored without adding a new field to the legacy block header.

Why Ordinals cares

Ordinal theory models the coinbase as receiving an implicit subsidy input followed by the fee sats from each transaction in block order. Its outputs therefore determine where newly mined sats and fee sats emerge from the block. Ordinal Numbers draft — primary repository

That means coinbase structure sits directly underneath several Ordinals concepts:

  • the first sat of each block is created through the block's coinbase;
  • fee sats flow into coinbase outputs rather than disappearing;
  • underclaimed subsidy creates missing ordinals rather than renumbering the later supply;
  • Bitcoin's duplicate-coinbase history creates the special txid-displacement rule described in Ordinal theory and BIP 30.

Open research

Open question
Trace the term “coinbase” through the surviving 2008–2009 source snapshots and mailing-list record, distinguishing the earliest code use from later explanations of the transaction type.
Open question
Build a chain-artifact study of notable coinbase data fields — genesis, early extra-nonce patterns, BIP 34 activation and SegWit commitments — without treating miner-authored text as Bitcoin protocol messages.