This guide explains Bitcoin Core getblock RPC in plain English. It shows what the command does, what its result means and what it cannot prove.
TL;DR
- What it is: Bitcoin Core 0.16.0 getblock accepted a block hash and verbosity level. Zero returned serialised block hex, one returned block metadata with transaction IDs, and two included decoded transaction objects.
- Why it matters: getblock is a layered inspection API whose shape and meaning depend on verbosity and current chain state. Reliable use validates identity, membership, weight and ancestry while handling pruning and reorganisations explicitly.
- Current position: Bitcoin Core 0.16.0 getblock accepted a block hash and verbosity level.
Bitcoin Core getblock RPC in simple English
Bitcoin Core getblock RPC: A pruned node may know a header but lack old block data, causing getblock retrieval to fail. Plan archive and pruned roles explicitly and distinguish absent local data from an invalid block.
Simple example
A miner is checking Bitcoin Core getblock RPC. Validate the 32-byte hexadecimal block hash and choose numeric verbosity explicitly. Verify ancestry and compare chainwork across nodes during an incident instead of selecting a branch by height or timestamp alone.
Key terms in plain English
- BIP:
- Bitcoin Improvement Proposal: a document describing a proposed rule, standard or process. Its status must be checked separately.
- Bitcoin Core:
- Widely used software that validates Bitcoin and can provide wallet, network and operator tools.
- RPC:
- A command that software sends to a node to request information or a local action.
- Consensus:
- The shared rules full nodes use to decide whether blocks and transactions are valid.
- Node:
- A computer running Bitcoin software that checks data and communicates with other peers.
Hash and verbosity contract
Validate the 32-byte hexadecimal block hash and choose numeric verbosity explicitly. Client schemas must not assume the tx field has one type: verbosity one returns transaction IDs, while verbosity two returns objects. A caller that accepts either silently can misparse data or expose unexpectedly large responses.
Raw block mode
Verbosity zero returns consensus serialisation as hex. Bound response size, authenticate its transport and hash the decoded header to confirm the requested identity. A successful fetch does not guarantee the block belongs to the active chain. Raw parsing should use a version-pinned library and reject trailing, truncated or excessive data.
Confirmations and chain membership
Positive confirmations describe active-chain depth at query time, while minus one means the block is not on the active chain. Record best-block context with the response because a reorganisation can change the value. Never mark payments final from a cached block object without rechecking active ancestry.
Size, stripped size and weight
size includes witness data, strippedsize excludes it and weight applies the BIP 141 weighting rule. Mining and fee analysis must use the correct measure and explicit units. Compare decoded transaction weights with the block total and reject arithmetic that treats ordinary bytes as virtual bytes.
Chainwork and neighbours
chainwork is cumulative expected work encoded in hexadecimal. Previousblockhash and nextblockhash describe known active-chain adjacency where available, not an immutable global sequence. Verify ancestry and compare chainwork across nodes during an incident instead of selecting a branch by height or timestamp alone.
Pruning and availability
A pruned node may know a header but lack old block data, causing getblock retrieval to fail. Plan archive and pruned roles explicitly and distinguish absent local data from an invalid block. Do not trigger broad redownloads automatically because one historical RPC request lacks stored bytes.
How specialists test it
Operators test the command on a non-production node first. They check a normal reply, an invalid request, a timeout and a restart. This shows what the response means and prevents one local result from being mistaken for a network-wide outcome.
Frequently asked questions
What is the main point of Bitcoin Core getblock RPC?
Bitcoin Core getblock RPC: A pruned node may know a header but lack old block data, causing getblock retrieval to fail.
For Bitcoin Core getblock RPC, what should a beginner know about hash and verbosity contract?
Validate the 32-byte hexadecimal block hash and choose numeric verbosity explicitly.
For Bitcoin Core getblock RPC, what should a beginner know about raw block mode?
Verbosity zero returns consensus serialisation as hex. Bound response size, authenticate its transport and hash the decoded header to confirm the requested identity.
For Bitcoin Core getblock RPC, what should a beginner know about confirmations and chain membership?
Positive confirmations describe active-chain depth at query time, while minus one means the block is not on the active chain.
Conclusion
getblock is a layered inspection API whose shape and meaning depend on verbosity and current chain state. Reliable use validates identity, membership, weight and ancestry while handling pruning and reorganisations explicitly.
Primary sources
Check the current specification status and the documentation for the exact implementation you operate before moving production funds or changing a mining node.
Join the ASIC Mining Discussion
Members can read and join the discussion
Log in to read comments from other miners. Create a free account if you would like to ask a question or share your experience.
Membership helps us protect the discussion from spam and keep answers useful.