Skip to main content

getblockheader

POST

Returns the header of the block with the given block hash.Set verbose to false to return the serialized header as a hex-encoded string.
param[0]
blockHashstringrequired
The hash of the block to look up.
param[1]
verbosebooleanrequired
Whether to return a JSON object. When false, a hex-encoded string is returned.
Responses
hashstring
The block hash, identical to the value provided in the request.
confirmationsinteger
The number of confirmations, or -1 if the block is not on the main chain.
heightinteger
The block height.
versioninteger
The block version.
versionHexstring
The block version in hexadecimal.
merklerootstring
The merkle root of the transactions in the block.
timeinteger
The block time expressed in UNIX epoch time.
mediantimeinteger
The median time of the preceding 11 blocks, expressed in UNIX epoch time.
nonceinteger
The nonce used for proof of work.
bitsstring
nBits, the compact representation of the block difficulty target.
targetstring
The difficulty target, in hexadecimal.
difficultynumber
The difficulty of the block.
chainworkstring
The expected number of hashes required to produce the current chain, in hexadecimal.
nTxinteger
The number of transactions in the block.
previousblockhashstring
The hash of the previous block.
nextblockhashstring
The hash of the next block.
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": "getblockheader",
"params": [
"000000000000000000024bead8df69990852c202db0e0097c1a12ea637d7e96d",
true
]
}'