getblocktemplate (GBT)
getblocktemplate is a Bitcoin RPC method that lets miners construct their own block templates for mining, replacing the older getwork protocol with full transaction-level control.
Key Takeaways
- getblocktemplate (GBT) is a Bitcoin RPC method defined in BIP 22 and BIP 23 that sends miners the full set of pending transactions, letting them construct their own block templates rather than blindly hashing a pre-built header.
- GBT replaced the older getwork protocol in 2012, giving miners visibility into block contents and the ability to select which transactions to include: a key property for mining decentralization.
- While most miners today receive templates from mining pools via the Stratum protocol, Stratum V2 revives miner-side template construction through its Job Declaration sub-protocol, building on the principles GBT introduced.
What Is getblocktemplate?
getblocktemplate (commonly abbreviated GBT) is a JSON-RPC method exposed by Bitcoin Core that provides miners with all the data needed to assemble a valid block. When a miner calls getblocktemplate, the node responds with a list of unconfirmed transactions from the mempool, the previous block hash, the current difficulty target, the maximum allowed coinbase payout, and other fields required to build a complete block. The miner then assembles the Merkle root, constructs the block header, and begins hashing to find a valid proof of work.
GBT was designed in 2012 by Luke Dashjr and formalized in BIP 22 (basic protocol) and BIP 23 (pooled mining extensions). It replaced the older getwork RPC, which only handed miners a single 80-byte block header with no information about what was inside the block. By exposing the full transaction list, GBT gave miners the power to verify, modify, add, or remove transactions before mining: a fundamental shift toward miner sovereignty over block construction.
How It Works
The GBT protocol follows a request/response cycle between the miner (or mining software) and a Bitcoin node.
Request
The miner sends a JSON-RPC call with an optional parameters object specifying capabilities and rules:
bitcoin-cli getblocktemplate '{"rules": ["segwit"]}'The request object can include several fields:
mode: either"template"(request a new template) or"proposal"(submit a candidate block for validation)capabilities: an array of features the miner supports, such as"longpoll","coinbasetxn", or"coinbasevalue"rules: an array of soft fork deployment names the miner understands, such as"segwit"
Response
The node returns a JSON object containing everything needed to build a block:
{
"version": 536870912,
"previousblockhash": "00000000000000000002a7c4...",
"transactions": [
{
"data": "02000000000101...",
"txid": "abc123...",
"hash": "def456...",
"fee": 4500,
"sigops": 1,
"weight": 561
}
],
"coinbaseaux": { "flags": "" },
"coinbasevalue": 328125000,
"target": "00000000000000000004b7...",
"curtime": 1732000000,
"bits": "17034219",
"height": 870001
}Key response fields include:
transactions: an array of transaction objects, each with its raw hex data, txid, fee, sigops count, and weightcoinbasevalue: the maximum satoshis the coinbase transaction may pay out, combining the block subsidy and all included transaction feescoinbaseaux: data that must appear in the coinbase scriptSigpreviousblockhash: the hash of the current chain tip to build onbits: the compact encoding of the difficulty targetheight: the block height being constructedcurtime: the recommended timestamp for the block header
Block Construction
After receiving the template, the miner:
- Selects which transactions to include (can add, remove, or reorder them)
- Constructs a coinbase transaction paying itself the reward (up to
coinbasevalue) - Computes the Merkle root from the selected transactions
- Assembles the 80-byte block header (version, previous hash, Merkle root, timestamp, bits, nonce)
- Iterates the nonce and extra-nonce searching for a hash below the target
- Submits the solved block back to the node via
submitblock
getblocktemplate vs. getwork
The original getwork RPC, available in early versions of Bitcoin, provided miners with a single 80-byte block header to hash. The miner had no visibility into transactions and no ability to modify block contents. The node assembled the entire block and simply handed out work units.
getwork had several critical limitations:
- A single header provided only 2^32 (roughly 4 billion) nonce combinations, enough for about 4 GH of work: far below what even early ASICs could exhaust in under a second
- The "rollntime" extension extended this to roughly 4 GH per second by allowing timestamp manipulation, but that was still inadequate for modern hardware
- getwork was difficult to extend: new features were bolted on via HTTP headers rather than clean protocol extensions
- Miners had zero insight into what they were mining, creating trust and censorship concerns
GBT solved all of these problems. By exposing the full transaction set, it gave miners complete control over block construction. It also supported arbitrary nonce space through the coinbase extra-nonce field, eliminating the work exhaustion problem. getwork was removed from Bitcoin Core in 2014 (merged in PR #4100), with GBT as the standard replacement.
GBT and Mining Pools
In practice, most miners today do not call getblocktemplate directly. Instead, they connect to a mining pool using the Stratum protocol. Under Stratum V1, the pool operator runs a Bitcoin node, calls getblocktemplate to obtain a template, and then distributes work units (derived from that template) to individual miners. The miners hash headers without ever seeing the underlying transactions.
This architecture reintroduces the same centralization concern that GBT was designed to address: a small number of pool operators decide which transactions appear in blocks. As of mid-2026, the top four mining pools collectively produce roughly 70% of all Bitcoin blocks, concentrating transaction selection power among a handful of entities.
For a deeper analysis of this dynamic, see the research article on block template mining centralization.
Stratum V2 and the Return of Miner Templates
Stratum V2 addresses the centralization problem by reintroducing miner-side template construction through its Job Declaration sub-protocol. Under this model, individual miners run their own Bitcoin nodes, build their own block templates (similar to what GBT enables), and submit those templates to the pool for validation.
Stratum V2 also defines a Template Distribution Protocol designed to replace the getblocktemplate RPC with a more efficient, push-based mechanism. Rather than the miner repeatedly polling the node for new templates, the node pushes updated templates to mining software whenever the mempool or chain tip changes.
Adoption is progressing: in 2025, DEMAND Pool (DMND) launched as the first Stratum V2-native mining pool, and by mid-2026, pools representing roughly 75% of Bitcoin's hashrate had joined the Stratum V2 working group. For more on this transition, see the research article on Stratum V2 and mining decentralization.
Use Cases
Solo Mining
Solo miners call getblocktemplate directly against their own full node. This gives them complete control over which transactions they mine, full visibility into fees, and the ability to include or exclude transactions based on their own policies.
Pool Operators
Mining pool backends use getblocktemplate to obtain work from the Bitcoin network. The pool software processes the template, constructs the coinbase transaction (distributing rewards among participants), and generates work units for connected miners.
Block Proposal Validation
BIP 22 defines a "proposal" mode where a miner submits a fully constructed block for validation without broadcasting it. This lets mining software verify that a block is valid before committing hashpower to it, catching errors like invalid transactions or incorrect witness commitments early.
Custom Transaction Selection
Because GBT exposes all candidate transactions, miners can implement custom selection policies: prioritizing transactions with higher fee rates, filtering out certain transaction types, or including their own transactions. Projects like OCEAN use this capability to offer transparent, non-custodial mining with miner-selected templates.
Risks and Considerations
Polling Overhead
GBT uses a pull-based model: miners must periodically call the RPC to check for new blocks or mempool changes. While BIP 22 defines a "longpoll" extension that blocks until the template changes, this is less efficient than the push-based notification model used by Stratum V2's Template Distribution Protocol. For high-volume pool operations, the polling overhead can add latency to block template updates.
Network Latency
The getblocktemplate response includes the full serialized data for every transaction in the template. For blocks near the 4 million weight unit limit, this can be several megabytes of JSON. Transmitting this data over slow connections adds delay between new block arrivals and when miners begin working on the next template.
Centralization Despite Availability
Even though GBT gives any miner the ability to build their own blocks, economic incentives push most hashrate toward pools that handle template construction centrally. Running a full node and using GBT directly requires technical expertise and infrastructure. The gap between protocol capability and real-world adoption highlights why protocol-level solutions like Stratum V2 are needed to make miner-side template construction practical at scale.
Soft Fork Coordination
Miners must correctly specify which consensus rules they support in the rules array. Failing to include activated soft forks (like SegWit) causes the node to reject the request. This adds an operational burden: miners and pool operators must stay current with network upgrades to avoid producing invalid templates.
This glossary entry is for informational purposes only and does not constitute financial or investment advice. Always do your own research before using any protocol or technology.