Coinbase Transactions
Every transaction we’ve studied so far obeys the conservation rule: inputs must be ≥ outputs, so no value is created. But that raises an obvious question — if no transaction can mint coins, where do new bitcoins come from? They come from exactly one privileged transaction per block, the coinbase transaction, which is the sole, protocol-sanctioned exception to conservation. This page dissects it.
The first transaction in every block
Section titled “The first transaction in every block”Every block’s transaction list begins with a coinbase transaction (and contains exactly one). It is the miner’s reward, and the only way new supply enters existence:
BLOCK ├── tx[0] ← COINBASE (creates new coins: subsidy + fees → miner) ├── tx[1] ← ordinary transaction ├── tx[2] ← ordinary transaction └── ...Its output value is allowed to be:
coinbase output ≤ block subsidy + sum of all fees in the blockThe block subsidy is the freshly-minted portion, set by the protocol and cut in half roughly every four years (every 210,000 blocks) — the famous halving that drives Bitcoin toward its 21-million cap, detailed in halving & issuance. The fees are the gaps left by every other transaction in the block (recall fees are implicit). The miner sweeps both into the coinbase outputs, paying themselves. If a miner under-claims (e.g. forgets some fees), the unclaimed amount is simply lost — burned forever.
The phantom input
Section titled “The phantom input”A coinbase transaction is structurally odd: it has inputs, but it isn’t spending anything. There is no prior coin for new money to come from. So its single input is a placeholder that points at nothing:
COINBASE INPUT ├── previous output txid : all-zeroes (0x0000...0000) ├── previous output vout : 0xffffffff (the "null" index) └── coinbase field : ARBITRARY DATA (not a real scriptSig)Because there’s no real outpoint to reference, the txid is set to all zeros and the index to the maximum value — a sentinel that says “this is not a normal spend.” Validating nodes recognize this shape and apply the special issuance rules instead of the conservation rule.
The coinbase field and the extranonce
Section titled “The coinbase field and the extranonce”Where an ordinary input would carry an unlocking script, a coinbase input carries an essentially free-form data field (the coinbase field). It has two famous uses:
- Messages. The very first block’s coinbase field contained the now-iconic newspaper headline “The Times 03/Jan/2009 Chancellor on brink of second bailout for banks,” timestamping the genesis block. Mining pools still stamp identifiers here.
- The extranonce. This is the load-bearing one. When a miner exhausts all ~4 billion values of
the block header’s 32-bit
noncewithout finding a valid hash, it needs more room to search. It mutates a counter — the extranonce — inside the coinbase field. Changing the coinbase field changes the coinbase transaction, which changes the block’s Merkle root in the header, which gives the miner a fresh ~4-billion-value nonce space to grind. The extranonce is, in effect, the high bits of the mining search.
nonce exhausted (2^32 tries)? │ ▼ bump extranonce in coinbase field │ ▼ coinbase tx changes → Merkle root changes → header changes │ ▼ a whole new 2^32 nonce space to searchThe 100-block maturity rule
Section titled “The 100-block maturity rule”Coinbase outputs come with a unique restriction: they cannot be spent until 100 additional blocks have been built on top of the block that created them (roughly 100 × 10 minutes ≈ 16–17 hours).
block N : coinbase coins created (immature, unspendable) block N+1 ... N+99 : still maturing block N+100: coins are MATURE → now spendableThe reason is reorganizations. If two miners find blocks at nearly the same time, the chain can temporarily fork, and a block (with its coinbase reward) can end up orphaned — discarded when the network converges on the longer chain. If a miner could immediately spend a freshly-minted reward and that block were then orphaned, the spent coins would vanish, and anyone who accepted them would be left with worthless inputs. The 100-block delay ensures a coinbase reward is buried deeply enough that a reorg undoing it is, for practical purposes, impossible — so by the time the coins are spendable, their existence is settled.
The thread
Section titled “The thread”How do coinbase transactions help untrusting strangers agree on one ledger? They make new-money
creation transparent, capped, and self-verifying. Every node independently checks that each
block’s coinbase claims no more than subsidy + fees, that the subsidy matches the halving schedule
for that height, and that no coinbase coins are spent before maturing. There is no central mint to
trust and no way to sneak extra coins past the network — issuance is a number every participant can
recompute and enforce. The coinbase is simultaneously the incentive that pays miners to secure the
ledger and the only sanctioned source of new supply, and both facts are enforced by the same
universal, trustless arithmetic that governs every other transaction.
Check your understanding
Section titled “Check your understanding”- Why is the coinbase transaction allowed to violate the conservation rule when no other transaction is?
- What is the maximum value a coinbase transaction may pay out, and what are its two components?
- Describe the coinbase input. Why does it point at an all-zero txid and the
0xffffffffindex? - What is the extranonce, and how does bumping it give a miner a fresh nonce search space?
- Why must coinbase outputs wait 100 blocks to be spendable, and what risk does that mitigate?