getblockheader
description: Gives the block's hash and returns the header of the block.
getblockheader
Returns a string containing serialized, hex-encoded data for the blockheader "hash" if verbose is set to false. Returns an Object containing details about the blockheader "hash" if verbose is true.
Example Request and Result for getblockheader method
In this section, we provide an illustrative example of a request made to retrieve details contents using the getblockheader
method. Additionally, we present the resulting response containing information about the block hash in the chain.
Parameters
Field | Type | Description |
---|---|---|
blockhash* | numeric | The block hash. |
info
The example in this section uses a non-existing project id.
Make sure you replace it with your Bitcoin mainnet or Bitcoin Testnet endpoint when issuing the API calls.
Don't have a project id? Here's a straightforward guide on how to obtain one!
Gives the block's hash and returns the header of the block.
POST
https://bitcoin-mainnet.blastapi.io/<project-id>
Request Body
Name | Type | Description |
---|---|---|
jsonrpc* | string | 1.0 |
id* | string | bwarelabs |
method* | string | getblockheader |
params* | array<string> | ["0000000000000000000454a3a654c88ab5ad9824ca8506c1f7f65cc0ea193503"] |
- 200: OK
{
"result": {
"hash": "0000000000000000000454a3a654c88ab5ad9824ca8506c1f7f65cc0ea193503",
"confirmations": 45595,
"height": 784665,
"version": 683581440,
"versionHex": "28bea000",
"merkleroot": "d8f4f9edd1c0a37a705289b7202a3d3b67ef46a20f88c27c88fe757aa87f17c5",
"time": 1681051849,
"mediantime": 1681049210,
"nonce": 2450381578,
"bits": "1705e0b2",
"difficulty": 47887764338536.25,
"chainwork": "000000000000000000000000000000000000000045155fb82c72a339d3522688",
"nTx": 169,
"previousblockhash": "00000000000000000003a77bfe6ccd653f7db680c4a03fa4b78ac95fa9dd5538",
"nextblockhash": "000000000000000000028b6ee09959abd8a47ce1487f3854fda0a7ed0b4e85ae"
},
"error": null,
"id": "bwarelabs"
}
Curl Request example
curl --location 'https://bitcoin-mainnet.blastapi.io/<project-id>' \
--header 'Content-Type: application/json' \
--data '{
"jsonrpc": "1.0",
"id": "bwarelabs",
"method": "getblockheader",
"params": [
"0000000000000000000454a3a654c88ab5ad9824ca8506c1f7f65cc0ea193503"
]
}'