Skip to main content

getblockchaininfo

POST

Returns an object containing various state information regarding blockchain processing.It includes the network name, the block height, the best block hash, the difficulty target, the verification progress and the pruning settings.

📘 The softfork activation status was removed from this method in Bitcoin Core 25.0 and moved to getdeploymentinfo.

Responses
chainstring
The current network name. Returns one of main, test, testnet4, signet or regtest.
blocksinteger
The height of the most-work fully-validated chain. The genesis block has height 0.
headersinteger
The current number of validated headers.
bestblockhashstring
The hash of the current best block.
bitsstring
nBits, the compact representation of the block difficulty target.
targetstring
The difficulty target, in hexadecimal.
difficultynumber
The current difficulty.
timeinteger
The time of the current best block, expressed in UNIX epoch time.
mediantimeinteger
The median time of the current best block, expressed in UNIX epoch time.
verificationprogressnumber
An estimate of the verification progress. The value ranges from 0 to 1.
initialblockdownloadboolean
Whether the node is in Initial Block Download (IBD) mode.
chainworkstring
The total amount of work in the active chain, in hexadecimal.
size_on_diskinteger
The estimated size of the block and undo files on disk, in bytes.
prunedboolean
Whether the blocks are subject to pruning.
pruneheightinteger
The height of the last block pruned, plus one. Returned only when pruning is enabled.
automatic_pruningboolean
Whether automatic pruning is enabled. Returned only when pruning is enabled.
prune_target_sizeinteger
The target size used by pruning, in bytes. Returned only when automatic pruning is enabled.
signet_challengestring
The block challenge of the signet network, in hexadecimal. Returned only on signet.
warningsarray
The list of network and blockchain warnings.
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://bitcoin-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getblockchaininfo",
"params": []
}'