eth_getBlockByHash

Returns information of the block matching the given block hash.

📘

Supported on Avalanche C-Chain (mainnet) only.

Parameters

  • hash - Hash of the block.
  • boolean - If true it returns the full transaction objects, if false only the hashes of the transactions.

Returns

  • object - A block object, or ‘null’ when no block was found.
    • number - The block number of the requested block encoded as a hexadecimal. null if pending.
    • hash - The block hash of the requested block. null if pending.
    • parenthash - Hash of the parent block.
    • nonce - Hash of the generated proof-of-work. null if pending.
    • sha3uncles - SHA3 of the uncles data in the block.
    • logsbloom - The bloom filter for the logs of the block. null if pending.
    • transactionsroot - The root of the transaction trie of the block.
    • stateroot - The root of the final state trie of the block.
    • receiptsroot - The root of the receipts trie of the block.
    • miner - The address of the beneficiary to whom the mining rewards were given.
    • difficulty - Integer of the difficulty for this block encoded as a hexadecimal.
    • totaldifficulty - Integer of the total difficulty of the chain until this block encoded as a hexadecimal.
    • extradata - The “extra data” field of this block.
    • size - The size of this block in bytes as an Integer value encoded as hexadecimal.
    • gaslimit - The maximum gas allowed in this block encoded as a hexadecimal.
    • gasused - The total used gas by all transactions in this block encoded as a hexadecimal.
    • timestamp - The unix timestamp for when the block was collated.
    • transactions - Array of transaction objects
    • uncles - Array of uncle hashes.

API Endpoint

The format of an Avalanche C-Chain API endpoint is
https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/rpc - for RPC API
https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/avax - for AVAX API

Here is an example:
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/avalanche-c/ext/bc/C/rpc
https://open-platform.nodereal.io/4c0a1c23661a4e26bcbcwed461e34ea9/avalanche-c/ext/bc/C/avax

Example

Request

curl https://open-platform.nodereal.io/{{apiKey}}/avalanche-c/ext/bc/C/rpc \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_getBlockByHash","params":["0x3e56c97d34f03b1369c351fa6c9f57c8bfa987c7da40964fab981303e0ef5849",false],"id":1,"jsonrpc":"2.0"}'

Result

{
"jsonrpc": "2.0",
"id": 1,
"result": {
    "difficulty": "0x4ea3f27bc",
    "extraData": "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
    "gasLimit": "0x1388",
    "gasUsed": "0x0",
    "hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0xbb7b8287f3f0a933474a79eae42cbca977791171",
    "mixHash": "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
    "nonce": "0x689056015818adbe",
    "number": "0x1b4",
    "parentHash": "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x220",
    "stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
    "timestamp": "0x55ba467c",
    "totalDifficulty": "0x78ed983323d",
    "transactions": [
    ],
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "uncles": [
    ]
}