Skip to content

Bitcoin accepted at checkout  |  Ships from Laval, QC, Canada  |  Expert support since 2016

Merkle Root

Advanced Mining Basics

Also known as: Merkle hash, Root hash

Definition

The Merkle root is a single 32-byte hash that cryptographically commits to every transaction in a Bitcoin block. It is produced by repeatedly hashing pairs of transaction IDs up a binary tree until one value remains, and that value is written into the block header. Change any transaction and the Merkle root changes, which is what makes a block tamper-evident.

Also known as: Merkle hash, root hash.

How the Merkle root is built

Bitcoin builds the Merkle root from the bottom up. Each transaction ID (TXID) is a double-SHA256 hash of that transaction. The TXIDs are paired off and each pair is concatenated and double-hashed to form a parent node. Those parents are paired and hashed again, and so on, halving the number of nodes at every level until a single root hash is left. If a level has an odd number of nodes, the last one is duplicated so it can still be paired. The root is the fingerprint of the entire transaction set: it lets a verifier confirm a block’s contents without re-hashing every transaction, and it lets a light client prove one transaction is included using only a short chain of sibling hashes (a Merkle path) instead of the whole block.

Why the Merkle root matters to an ASIC miner

This is the part that turns abstract cryptography into something your hardware actually grinds on. A Bitcoin block header is exactly 80 bytes, and the Merkle root occupies 32 of them. The other fields are the version, the previous block hash, the timestamp (nTime), the difficulty target (nBits), and the 4-byte nonce. Mining is the search for a nonce (and, with version-rolling, a tweaked version field) that makes the double-SHA256 of that 80-byte header fall below the target. The Merkle root is fixed for a given set of transactions, so it anchors the header your chips are hammering.

The crucial detail for miners is that the Merkle root is not static within a job. When a pool sends work over the Stratum protocol, it does not hand over a finished Merkle root. Instead a Stratum V1 mining.notify message provides the two halves of the coinbase transaction (coinb1 and coinb2) plus a list of Merkle branch hashes. The miner inserts its own extranonce values into the coinbase, double-hashes it to get the coinbase TXID, then folds that TXID up through the supplied branches to compute the Merkle root locally. Because every distinct extranonce produces a different coinbase, it produces a different Merkle root, which in turn gives the chips an enormous fresh search space without the pool resending a full block template each time.

Full-header vs midstate work delivery

How the Merkle root reaches the hashing chips depends on the silicon. Newer single-chip designs such as the BM1366, BM1368, and BM1370 run in full-header mode: the control board hands the chip the previous block hash and the Merkle root and lets the chip complete the SHA256 work itself. Older parts like the BM1387 (Antminer S9) and the BM1397 work in midstate mode, where the host pre-computes a SHA-256 midstate over the first 64 bytes of the header — which includes the front portion of the Merkle root — and ships that partial state to the chip. The byte-ordering of those state words is famously unforgiving: word order, endianness, and any stray byte-swap must be exactly right or the chip hashes the wrong data and returns zero accepted shares. Getting the Merkle root committed correctly into either work format is a prerequisite for a board producing valid SHA-256 shares at all.

Verification and self-sovereignty

Before a miner submits a share, its firmware reconstructs the full header — version, previous hash, the computed Merkle root from coinbase plus branches, nTime, nBits, and nonce — and confirms the resulting hash meets the share target. That local check is also what makes the Merkle root central to sovereign mining. When you run your own node and feed your miner a block template rather than letting a pool dictate it, you choose which transactions go in the block and therefore which Merkle root your hardware commits to. Protocols like DATUM (used by OCEAN) keep the Stratum wire format but let the miner own the coinbase and template, putting transaction selection back in the hands of the person running the machine.

If you want to put these fundamentals to work on real hardware — from a single Bitaxe on a desk to a rack of refurbished S19s — browse the D-Central shop to find a miner suited to your setup, and pair it with self-hosted block templates to mine on your own terms.

In Simple Terms

A hash summarizing all transactions in a block using a tree structure for efficient verification.

The Merkle root is a single 32-byte hash that cryptographically commits to every transaction in a Bitcoin block. It is produced by repeatedly hashing pairs of transaction IDs up a binary tree until one value remains, and that value is written into the block header. Change any transaction and the Merkle root changes, which is what makes a block tamper-evident.

Also known as: Merkle hash, root hash.

How the Merkle root is built

Bitcoin builds the Merkle root from the bottom up. Each transaction ID (TXID) is a double-SHA256 hash of that transaction. The TXIDs are paired off and each pair is concatenated and double-hashed to form a parent node. Those parents are paired and hashed again, and so on, halving the number of nodes at every level until a single root hash is left. If a level has an odd number of nodes, the last one is duplicated so it can still be paired. The root is the fingerprint of the entire transaction set: it lets a verifier confirm a block's contents without re-hashing every transaction, and it lets a light client prove one transaction is included using only a short chain of sibling hashes (a Merkle path) instead of the whole block.

Why the Merkle root matters to an ASIC miner

This is the part that turns abstract cryptography into something your hardware actually grinds on. A Bitcoin block header is exactly 80 bytes, and the Merkle root occupies 32 of them. The other fields are the version, the previous block hash, the timestamp (nTime), the difficulty target (nBits), and the 4-byte nonce. Mining is the search for a nonce (and, with version-rolling, a tweaked version field) that makes the double-SHA256 of that 80-byte header fall below the target. The Merkle root is fixed for a given set of transactions, so it anchors the header your chips are hammering.

The crucial detail for miners is that the Merkle root is not static within a job. When a pool sends work over the Stratum protocol, it does not hand over a finished Merkle root. Instead a Stratum V1 mining.notify message provides the two halves of the coinbase transaction (coinb1 and coinb2) plus a list of Merkle branch hashes. The miner inserts its own extranonce values into the coinbase, double-hashes it to get the coinbase TXID, then folds that TXID up through the supplied branches to compute the Merkle root locally. Because every distinct extranonce produces a different coinbase, it produces a different Merkle root, which in turn gives the chips an enormous fresh search space without the pool resending a full block template each time.

Full-header vs midstate work delivery

How the Merkle root reaches the hashing chips depends on the silicon. Newer single-chip designs such as the BM1366, BM1368, and BM1370 run in full-header mode: the control board hands the chip the previous block hash and the Merkle root and lets the chip complete the SHA256 work itself. Older parts like the BM1387 (Antminer S9) and the BM1397 work in midstate mode, where the host pre-computes a SHA-256 midstate over the first 64 bytes of the header — which includes the front portion of the Merkle root — and ships that partial state to the chip. The byte-ordering of those state words is famously unforgiving: word order, endianness, and any stray byte-swap must be exactly right or the chip hashes the wrong data and returns zero accepted shares. Getting the Merkle root committed correctly into either work format is a prerequisite for a board producing valid SHA-256 shares at all.

Verification and self-sovereignty

Before a miner submits a share, its firmware reconstructs the full header — version, previous hash, the computed Merkle root from coinbase plus branches, nTime, nBits, and nonce — and confirms the resulting hash meets the share target. That local check is also what makes the Merkle root central to sovereign mining. When you run your own node and feed your miner a block template rather than letting a pool dictate it, you choose which transactions go in the block and therefore which Merkle root your hardware commits to. Protocols like DATUM (used by OCEAN) keep the Stratum wire format but let the miner own the coinbase and template, putting transaction selection back in the hands of the person running the machine.

If you want to put these fundamentals to work on real hardware — from a single Bitaxe on a desk to a rack of refurbished S19s — browse the D-Central shop to find a miner suited to your setup, and pair it with self-hosted block templates to mine on your own terms.

Explore the Full Glossary

Browse all Bitcoin mining terms from A to Z. Whether you are a beginner or expert, deepen your understanding of the mining ecosystem.

Mining Glossary

ASIC Miner Database

Compare 500+ miners with real-time profitability data, home mining scores, and detailed specs.

Compare Miners