getblockheader - Zcash

This method returns block header data — the fixed 80-byte header plus derived fields — without the full transaction list. Significantly cheaper than getblock when only header data is needed, such as during header-first chain synchronization or SPV-style verification.

Parameters

ParameterTypeRequiredDescription
blockhashstringYesBlock hash (hex string)
verbosebooleanNoIf true (default), returns a JSON object; if false, returns raw hex-encoded header

Request

bashcurl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "getblockheader",
    "params": [
        "00000000000f3c0bdf81aba0bf081c5c4882975cbc0a8ce35e70ddb5f265f1b1",
        true
    ],
    "id": "getblock.io"
}'

example.js

javascriptconst axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'getblockheader',
    params: [
        "00000000000f3c0bdf81aba0bf081c5c4882975cbc0a8ce35e70ddb5f265f1b1",
        true
    ],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);

example.py

pythonimport requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'getblockheader',
        'params': [
        "00000000000f3c0bdf81aba0bf081c5c4882975cbc0a8ce35e70ddb5f265f1b1",
        true
    ],
        'id': 'getblock.io'
    }
)

print(response.json())

example.rs

rustuse reqwest::Client;
use serde_json::{json, Value};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    
    let response = client
        .post("https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/")
        .header("Content-Type", "application/json")
        .json(&json!({
            "jsonrpc": "2.0",
            "method": "getblockheader",
            "params": [
        "00000000000f3c0bdf81aba0bf081c5c4882975cbc0a8ce35e70ddb5f265f1b1",
        true
    ],
            "id": "getblock.io"
        }))
        .send()
        .await?
        .json::<Value>()
        .await?;
    
    println!("Result: {}", response["result"]);
    Ok(())
}

Response

json{
    "jsonrpc": "2.0",
    "result": {
        "hash": "00000000000f3c0bdf81aba0bf081c5c4882975cbc0a8ce35e70ddb5f265f1b1",
        "confirmations": 40,
        "height": 3487790,
        "version": 4,
        "merkleroot": "2134e7beb96aac05105adbbe8ef04fab84739f8a90e22e73e44e6add4812ed35",
        "blockcommitments": "50f7a4921c16db984372e06ebc91e971d9412926d50cea958e71d496fc58682e",
        "finalsaplingroot": "59d2ea590d75d202eaa4690d627c21c56b59474991e197725804b25b8206133c",
        "time": 1789741929,
        "nonce": "a341002a000000000000000000000000000000000000000000000000d094f930",
        "solution": "00ede59b1b273717f4ec030131a4bb48c4a0edc3181219faec7dd00dc5bf7fb19762f52384676b04bceb01881d81d606...",
        "bits": "1b762f01",
        "difficulty": 290731287.69865835,
        "previousblockhash": "000000000007b84c009ac090a37dd74b23bcfa4aeb6620960c7d0ee3f5fb664a",
        "nextblockhash": "00000000000aa124983da79c1e3bd8524b5b76da7b43bb1a88edd93ac5f61331"
    },
    "id": "getblock.io"
}

Response Parameters

ParameterTypeDescription
hashstringBlock hash
confirmationsintegerNumber of confirmations
heightintegerBlock height
versionintegerBlock version
merklerootstringMerkle root of transactions
blockcommitmentsstringBlock commitments hash (post-Heartwood)
finalsaplingrootstringFinal Sapling commitment tree state after this block
timeintegerUnix timestamp
noncestringBlock nonce (hex)
solutionstringEquihash solution (hex)
bitsstringCompact difficulty target
difficultynumberDifficulty of this block
previousblockhashstringParent block hash
nextblockhashstringNext block hash (empty at chain tip)

Use Cases

  • Header-First Sync: SPV clients download headers first to establish the canonical chain before fetching transactions
  • Reorg Detection: Compare header hashes across polls to detect chain reorganization
  • Lightweight Block Metadata: Get block timing, difficulty, and shielded-tree state without loading transactions
  • Chain History Reconstruction: Iterate headers backwards from a known hash to reconstruct chain history

Error Handling

Error CodeMessageDescription
-5Block not foundRequested hash doesn't exist
-32602Invalid paramsHash is malformed
-32603Internal errorNode failed to retrieve the header