eth_getBlockByHash

Returns information about a block by hash.

Ethereum.org API Reference

Parameters

  1. DATA, 32 Bytes - Hash of a block. REQUIRED

  2. 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: QUANTITY - the block number. null when its pending block.

  • hash: DATA, 32 Bytes - hash of the block. null when its pending block.

  • parentHash: DATA, 32 Bytes - hash of the parent block.

  • nonce: DATA, 8 Bytes - hash of the generated proof-of-work. null when its pending block.

  • sha3Uncles: DATA, 32 Bytes - SHA3 of the uncles data in the block.

  • logsBloom: DATA, 256 Bytes - the bloom filter for the logs of the block. null when its pending block.

  • transactionsRoot: DATA, 32 Bytes - the root of the transaction trie of the block.

  • stateRoot: DATA, 32 Bytes - the root of the final state trie of the block.

  • receiptsRoot: DATA, 32 Bytes - the root of the receipts trie of the block.

  • miner: DATA, 20 Bytes - the address of the beneficiary to whom the mining rewards were given.

  • difficulty: QUANTITY - integer of the difficulty for this block.

  • totalDifficulty: QUANTITY - integer of the total difficulty of the chain until this block.

  • extraData: DATA - the "extra data" field of this block.

  • size: QUANTITY - integer the size of this block in bytes.

  • gasLimit: QUANTITY - the maximum gas allowed in this block.

  • gasUsed: QUANTITY - the total used gas by all transactions in this block.

  • timestamp: QUANTITY - the unix timestamp for when the block was collated.

  • transactions: Array - Array of transaction objects, or 32 Bytes transaction hashes depending on the last given parameter.

  • uncles: Array - Array of uncle hashes.

Example

Request

curl --request POST \
     --url https://endpoints.omniatech.io/v1/RPC_ENDPOINT \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "params": [
    "0xe76d777791f48b5995d20789183514f4aa8bbf09e357383e9a44fae025c6c50a",
    false
  ]
}
'

Response

{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "baseFeePerGas": "0x2f99b1dd0",
        "difficulty": "0x0",
        "extraData": "0x4d616465206f6e20746865206d6f6f6e20627920426c6f636b6e6174697665",
        "gasLimit": "0x1c9c380",
        "gasUsed": "0x1699c83",
        "hash": "0xe76d777791f48b5995d20789183514f4aa8bbf09e357383e9a44fae025c6c50a",
        "logsBloom": "0x1c243c7f96541e048c0cc481b0ac333461c12804d880990dfe1980c41c2a49aca538425bc4030022419e3fe80ce6a1819e0c8cbccaec3511034bc7c75a6424b148b3809049eb1a8b6a088bc9629304fa84666835856e23084c00b81191002810d6710c00834290e38544008cba206a7bf4891881609a144000d000b00c896c90b21805320683810d20c90c0810064069f4001911c10a0409400c615e0a34316d8b29c9d4298d7b191a6819811f118c01801021715096405280cbaa4326b1460ca46c66432390d05001c0341a2c82305750c027f4d2ae10971254a94321a9f2132090a00e1f0110b18567920180818fc6b1100e8af2e84040a0408c144015d213",
        "miner": "0xbaf6dc2e647aeb6f510f9e318856a1bcd66c5e19",
        "mixHash": "0xe8ad228f6a0f7c79bd2f8273f717a06f47b271f41d748718699bb966f710fc9b",
        "nonce": "0x0000000000000000",
        "number": "0xf8e3d7",
        "parentHash": "0xbef5b480684b03c0c3ff58deec762cf6650de5b71da431e85d908cca221a10b2",
        "receiptsRoot": "0xce65ddb737ae93370c63077c742ba190d917fbe0876a9a1f9d793d5b125fa04a",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x9684",
        "stateRoot": "0xc57cf792e5cdff63c582e03084a7d21748196f1c6a97171d2b4e07417fa5df2e",
        "timestamp": "0x63b15d3b",
        "totalDifficulty": "0xc70d815d562d3cfa955",
        "transactions": [
            "0x501251dd9097bcba3074c7e699be2bc28a343228e321251342188a34e9e54871",
            "0x1e4009ac7b59a0a64fe3f42918185a160ce22ad666215fa182ea1d927a8e1a22",
            "0xa04bdde31cba595dbb6749b4b2f4c712119d1f40c94c402592c2922416dd08a1",
            "0xdc23dd5f6c6ba68d6e73227b5dda9ddd5168beb829fdc3b432ae5d1755022c3b",
            "0x67c6d7216f8a7acce412dcdecea36bc983e040d16f9a594f4f89d785d9b960a3"
                                            ...
        ],
        "transactionsRoot": "0x0cf6abfa0c1f1f8e031dad7a314c5b130099dcf340d39d840accc778cb623f64",
        "uncles": []
    }
}

Last updated