Returns the information about a block header by hash.
Parameters
- block_hash - The block hash.
- verbosity - Result format which allows 0 and 2. (Optional, the default is 2.)
Returns
The RPC returns a header or null. When the RPC returns a header, the block hash must equal to the parameter block_hash.
If the block is in the canonical chain, the RPC must return the header information. Otherwise, the behavior is undefined. The RPC may return blocks found in local storage or simply returns null for all blocks that are not in the canonical chain. And because of chain reorganization, for the same block_hash, the RPC may sometimes return null and sometimes return the block header.
When verbosity is 1, it returns a JSON object as the result. See HeaderView for the schema.
When verbosity is 0, it returns a 0x-prefixed hex string as the result. The string encodes the block header serialized by molecule using schema table Header.
Example
Request
curl --location --request POST 'https://ckb-mirana.unifra.io/v1/4fb36720a57340d39aee4cf68511064a' \
--data-raw '{
"id": 42,
"jsonrpc": "2.0",
"method": "get_header",
"params": [
"0xb2671d3cc16b7738bbc8902ef11322bc2bfe7c54f5ce4a5cdfdf57b1a02fcb11"
]
}'
Result
{
"jsonrpc": "2.0",
"result": {
"compact_target": "0x1a08a97e",
"dao": "0x7194050c98a5a12e4827806b0b872300b2e0a033e71b0000008867461f3bff06",
"epoch": "0x6cf0400000000",
"extra_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"hash": "0xb2671d3cc16b7738bbc8902ef11322bc2bfe7c54f5ce4a5cdfdf57b1a02fcb11",
"nonce": "0x5af1702d0000043000000000cc700400",
"number": "0x400",
"parent_hash": "0x013c445cedc6744f051a78320217e2493590d014fa49e9815481954a68a2a18d",
"proposals_hash": "0xc78954b079452667f9e2412af83893b6ccdf93e7fc21f88b015f58f677c8e2e2",
"timestamp": "0x16e7808ab0f",
"transactions_root": "0x535c2a0979a61c984b862a93198b2055c20e8b57db6dbb184cbadcee339bcc92",
"version": "0x0"
},
"id": 42
}