THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

Bitcoin BIP34 Explained: Coinbase Block Heights and Consensus History

permalink THAMER
#bip34#block-version#coinbase-height#consensus

BIP34 was an early Bitcoin consensus upgrade that required the height of a new block to be encoded at the start of its coinbase transaction input script. The rule made block heights explicit within the coinbase transaction and helped distinguish blocks that might otherwise share a transaction identifier.

The original problem

A coinbase transaction is the first transaction in a block. It creates the block subsidy and collects transaction fees, subject to consensus limits. Unlike ordinary transactions, its input does not spend a previous output. Historically, miners could choose arbitrary data in its scriptSig. Different blocks could consequently contain identical coinbase transactions, a complication for tracking transaction identifiers and unspent outputs.

BIP34 requires a minimally encoded block-height value as the first item of the coinbase scriptSig in version-2 blocks under its activation rules. It does not require the entire coinbase scriptSig to consist only of that height; miners can include additional permitted data.

What validation checks

A validating node knows the expected height from the block's position in its candidate chain. It compares that height with the encoded value in the coinbase scriptSig. A mismatch violates the applicable consensus rule, regardless of whether the block's proof of work is otherwise valid.

This is not a claim that a miner can choose an arbitrary height by editing a coinbase transaction. The expected height comes from the chain context, not the miner's label.

Historical deployment

BIP34 used block-version signaling and threshold-based activation. Its historical rollout predates the more general BIP9 versionbits mechanism. The mainnet activation was at height 227,931 in March 2013. Deployment mechanics matter because a rule can be specified before it is enforced by the network's upgraded nodes.

What BIP34 does not do

It does not provide an account balance, replace the UTXO set, or authenticate a block's miner. It is a structural consensus requirement concerning the coinbase transaction. Other rules still verify the proof of work, merkle root, transaction validity, block subsidy, and contextual constraints.

Why developers should care

When constructing test blocks or inspecting historical block data, distinguish the coinbase input script from an ordinary spending script. In regtest, manually assembled blocks must still satisfy the applicable coinbase-height rule. When comparing block histories, do not confuse BIP34's height commitment with the witness commitment introduced much later for SegWit.

Primary references

BIP34 — Block v2, Height in Coinbase: https://github.com/bitcoin/bips/blob/master/bip-0034.mediawiki
Bitcoin Core source: https://github.com/bitcoin/bitcoin

Questions & Answers

Explore all questions →

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects