getblockheader
Returns a block header by hash. This method uses 80 credits from your daily balance.
Parameters
blockhash: (string) [required] - Hex-encoded block hash.verbose: (boolean) [optional] -truereturns a header object.falsereturns the serialized 80-byte header as a hex-encoded string. The default istrue.
Returns
result: (string or object) - The hex-encoded header when verbose is false. Otherwise, a header object:
hash: (string) - Block hash.confirmations: (integer) - Number of confirmations, or-1if the block isn't on the main chain.height: (integer) - Block height.version: (integer) - Block version.versionHex: (string) - Block version, as a hex string.merkleroot: (string) - Merkle root of the block's transactions.time: (integer) - Block timestamp, in Unix epoch seconds.mediantime: (integer) - Median timestamp of the previous 11 blocks, in Unix epoch seconds.nonce: (integer) - Proof-of-work nonce.bits: (string) - Compact encoding of the proof-of-work target.target: (string) - Proof-of-work target, as a hex string.difficulty: (number) - Proof-of-work difficulty.chainwork: (string) - Expected number of hashes required to produce the chain up to this block, as a hex string.nTx: (integer) - Number of transactions in the block.previousblockhash: (string) [optional] - Hash of the previous block. Absent for the genesis block.nextblockhash: (string) [optional] - Hash of the next block. Absent for the chain tip.
Request
- curl
curl https://bitcoin-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "getblockheader", "params": ["00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048", true]}'
Response
- JSON
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"hash": "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048",
"confirmations": 971402,
"height": 1,
"version": 1,
"versionHex": "00000001",
"merkleroot": "0e3e2357e806b6cdb1f70b54c3a3a17b6714ee1f0e68bebb44a74b1efd512098",
"time": 1231469665,
"mediantime": 1231469665,
"nonce": 2573394689,
"bits": "1d00ffff",
"target": "00000000ffff0000000000000000000000000000000000000000000000000000",
"difficulty": 1,
"chainwork": "0000000000000000000000000000000000000000000000000000000200020002",
"nTx": 1,
"previousblockhash": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
"nextblockhash": "000000006a625f06636b8bb6ac7b960a8d03705d1ace08b1a19da3fdcc99ddbd"
}
}