rest/chaininfo - Bitcoin

This endpoint returns the node's view of the chain: height, best block, difficulty, and verification progress. It is the cheapest call to confirm an endpoint works and that the node is in sync.

Parameters

This endpoint takes no parameters.

Request

bashcurl --location --request GET 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/chaininfo.json'

example.js

javascriptconst response = await fetch(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/chaininfo.json'
);
console.log(await response.json());

example.py

pythonimport requests

response = requests.get('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/rest/chaininfo.json')

print(response.json())

Response

json{
    "chain": "main",
    "blocks": 967816,
    "headers": 967816,
    "bestblockhash": "000000000000000000019c481c042c0625abe1dc04fe26795e2e24b152791e5f",
    "bits": "17021ec5",
    "target": "000000000000000000021ec50000000000000000000000000000000000000000",
    "difficulty": 132757073449487.5,
    "time": 1789899076,
    "mediantime": 1789892696,
    "verificationprogress": 1,
    "initialblockdownload": false,
    "chainwork": "000000000000000000000000000000000000000148e422b78a65626de4ddb156",
    "size_on_disk": 877666977499,
    "pruned": false,
    "warnings": ""
}

Response Parameters

FieldTypeDescription
chainstringNetwork name: main, test, signet, or regtest
blocksnumericHeight of the most-work fully-validated chain
headersnumericHeight of the best header chain. Equals blocks when fully synced
bestblockhashstringHash of the current chain tip
difficultynumericCurrent proof-of-work difficulty
targetstringCurrent proof-of-work target
mediantimenumericMedian time of the last 11 blocks
verificationprogressnumericEstimate of verification progress, 0 to 1
initialblockdownloadbooleanTrue while the node is still in initial block download
chainworkstringTotal cumulative work on the chain, hex-encoded
size_on_disknumericSpace the block files occupy, in bytes
prunedbooleanTrue when the node is running pruned

This is Bitcoin Core's own REST interface, served by the node. It is a read-only view of the chain: there is no address index, so it cannot answer "what is the balance of this address". Those queries belong on the Blockbook add-on.

Use Cases

  • Endpoint Verification: Confirm the token and base URL work before integrating
  • Sync Gating: Require blocks to equal headers before trusting chain reads
  • Network Assertion: Check chain is main before treating data as mainnet
  • Dashboards: Surface height, difficulty, and verification progress

Error Handling

HTTP StatusMessageDescription
400Bad requestThe path is malformed, or a hash or height is invalid
403ForbiddenMissing or invalid ACCESS-TOKEN
404Not foundNo object matches the requested hash, height, or outpoint
500Internal errorThe node failed to process the request