Block Template Construction

How miners build candidate blocks, select transactions, and prepare block headers for proof-of-work hashing.

3 min read
mining

Definition

Block template construction is the process of building a candidate block before mining hardware starts hashing. It decides which transactions go in, where the reward is paid, and what header data miners solve with proof of work.

The template is a draft block. If a miner finds a valid hash for it, the draft can be broadcast as a real block.

How It Works

A miner, mining pool, or full node starts with the latest valid block it knows. The new template points to that block, so the previous block hash becomes part of the block header.

Next, the builder selects transactions from the mempool, where valid unconfirmed transactions wait. Most prefer higher fee rates, meaning more fee paid for the block space used. The builder also respects dependencies: if one transaction spends another, the parent usually comes first.

The template must follow consensus rules. In Bitcoin, that means staying within block weight limits, signature operation limits, and other validation rules. A block that breaks these rules will be rejected, even if its proof of work is valid.

The builder also creates the coinbase transaction, the special first transaction that pays the subsidy and fees to the miner or pool. After transactions are chosen, their hashes form a Merkle root, which summarizes the transaction set inside the header.

Mining devices then vary fields such as the nonce and coinbase data while searching for a header hash below the current difficulty target.

Why It Matters

Block template construction affects revenue because transaction selection determines block fees. A poor template may leave high-fee transactions behind or include a transaction that makes the block invalid.

It also affects efficiency. When a new block appears, miners need a fresh template that builds on the new chain tip. Hashing on an old template creates stale work.

Template control also matters for decentralization. If only large pools build templates, they gain more influence over transaction ordering and inclusion. Systems such as Stratum try to balance pool coordination with miner choice.