getblockheader
The getblockheader is a Bitcoin RPC method that returns information about a specified block header. This method is useful for obtaining a high-level view of a specific block, including its hash, previous block hash, merkle root, timestamp, difficulty target, and nonce, without having to fetch the entire block's contents.
Parameters
parameter | description |
|---|---|
blockhash | The hash of the block for which the header information is requested. Example: "0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e" |
verbose | Specifies whether to return the header information in a JSON object (true) or as a serialized hex-encoded string (false). Default is true. Example: true |
Return Object
If verbose is set to true (default), the return object is a JSON object containing the following fields:
name | description |
|---|---|
hash | The hash of the block. |
confirmations | The number of confirmations for the block. |
height | The height of the block in the blockchain. |
version | The block version. |
versionHex | The block version formatted as a hex string. |
merkleroot | The merkle root of the block. |
time | The block timestamp in UNIX format. |
mediantime | The median block time of the last 11 blocks in UNIX timestamp format. |
nonce | The nonce value for the block. |
bits | The encoded difficulty target for the block. |
difficulty | The actual difficulty target for the block as a decimal number. |
chainwork | The total work in the blockchain up to this block. |
nTx | The number of transactions in the block. |
previousblockhash | The hash of the previous block. |
nextblockhash | The hash of the next block (only present if there is a next block). |
If verbose is set to false, the return object is a serialized hex-encoded string of the block header.
Request Example
Bitcoin Get Block Header Request