klay_getHeaderByHash

Returns information about a header by hash.

📘

Supported on Klaytn (mainnet) only.

NOTE: This API is supported from Klaytn v1.7.0.

Returns information about a header by hash. This API works only on RPC call, not on JavaScript console.

Parameters

Request

TypeDescription
32-byte DATAHash of a block.

Result

Object - A header object, or error when no header was found:

NameTypeDescription
numberQUANTITYThe block number. null when it is pending block.
parentHash32-byte DATAThe hash of the parent block.
logsBloom256-byte DATAThe bloom filter for the logs of the block. null when it is pending block.
transactionsRoot32-byte DATAThe root of the transaction trie of the block.
stateRoot32-byte DATAThe root of the final state trie of the block.
receiptsRoot32-byte DATAThe root of the receipts trie of the block.
reward20-byte DATAThe address of the beneficiary to whom the block rewards were given.
blockScoreQUANTITYFormer difficulty. Always 1 in the BFT consensus engine
extraDataDATAThe "extra data" field of this block.
gasUsedQUANTITYThe total used gas by all transactions in this block.
timestampQUANTITYThe Unix timestamp for when the block was collated.
timestampFoSQUANTITYThe fraction of a second of the timestamp for when the block was collated.
governanceDataDATARLP encoded governance configuration
voteDataDATARLP encoded governance vote of the proposer
baseFeePerGasQUANTITYThe base fee per gas. It has a meaningful value when EthTxTypeCompatible and Magma hardforks are activated.

API Endpoint

The format of a Klaytn API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/klaytn/

Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/klaytn/

Example

// Request
curl https://open-platform.nodereal.io/{{apiKey}}/klaytn/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"klay_getHeaderByHash","params":["0xb8deae63002d2b6aa33247c8ef545383ee0fd2282ac9b49dbbb74114389ddb5c"],"id":1}'

// Result
{
  "jsonrpc":"2.0",
  "id":1,
  "result":{
    "baseFeePerGas":"0x5d21dba00",
    "blockScore":"0x1",
    "extraData":"0xda83010800846b6c617989676f312e31362e31338664617277696e0000000000f89ed5949712f943b296758aaae79944ec975884188d3a96b841ddfdf7e2cb0a93538f757f87f23a93ee35df703c781c6f15e31e4978ecdfb3501fc00924372b9a01df2bc452f2a924c242d83580183d131c47e49a25b78f625201f843b841b9b6034d5a8c5f5b057274cda4f427614cd1f448ee781f4c4322861d1361d09d47d6030f2b69a26cb426db984f54e71f8c112fbf882930ccd715d595e8d8307500",
    "gasUsed":"0x0",
    "governanceData":"0x",
    "hash":"0xe882d7a16f38126dc0c507f990b3fe18fa2d3a380002538581327abe96ca6edc",
    "logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "number":"0x1e67",
    "parentHash":"0x28b1c054346c3bd083741c757a750dcabf94b6d50c7f87158753544e96e73550",
    "receiptsRoot":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
    "reward":"0x4b2c736fd05c2e2da3ccbd001a395a444f16a861",
    "stateRoot":"0xdf9885621c9e6e75912ca94d6987bcb1b54fef0e4a99cbec5e68f1ffc7468a78",
    "timestamp":"0x62130beb",
    "timestampFoS":"0x0",
    "transactionsRoot":"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470"
  }
     
}