blockchain - TAC
Example code for the blockchain JSON-RPC method. Complete guide on how to use blockchain JSON-RPC in GetBlock Web3 documentation.
Returns block metadata (headers) for a range of heights, newest first. The range is capped at 20 blocks per call.
Method
blockchainParameters
minHeight
string
Lowest block height in the range
maxHeight
string
Highest block height in the range
Example
export TAC_TM=https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/
# JSON-RPC over HTTP (POST)
curl -X POST "${TAC_TM}" -H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": "getblock.io", "method": "blockchain", "params": {"minHeight": "5123400", "maxHeight": "5123420"}}'
# URI over HTTP (GET)
curl "${TAC_TM}blockchain?minHeight=5123400&maxHeight=5123420"Response
Response Fields
last_height
string
Current chain tip height
block_metas
array
Block headers in the requested range, newest first
Use Cases
Range scan: Pull a window of recent block headers
Lightweight sync: Read headers without full block bodies
Error Handling
-32600 / Invalid request
Invalid request
The JSON-RPC envelope was malformed
-32602 / Invalid params
Invalid params
A parameter was missing or of the wrong type
403 / RBAC: access denied
Access denied
The GetBlock access token is missing or incorrect
Was this helpful?