eth_getBlockByHash - Polygon

Returns information about a block by hash.

Parameters

  • DATA, 32 Bytes - Hash of a block.

  • Boolean - If true it returns the full transaction objects, if false it returns only the hashes of the transactions.

params: [
    '0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69',
    true
]

Returns

Object - A block object with the following fields, 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.

Request example

curl https://polygon.api.watchdata.io/node/jsonrpc?api_key=your_api_key
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69", true],"id":0}'

Result

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": {
        "number": "0x1d763ed",
        "hash": "0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69",
        "parentHash": "0xf83ad5151f15afab92eafd54674a91484bb99e3e2b08f996f8c94440ab346541",
        "nonce": "0x0000000000000000",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "logsBloom": "0x0910839d381643800481512280e8022c182103c0000850806c057c216380b7007219181acd10e044a441091904200a01e0068e585a362408a443331009ae21c2281ca92c02002009140f108990e90ddb925a306e0904e0085003741100112542ba0082743b62a8c44a012a2b00c08cc0b00d300103d078c8a568423443384e1910145494d89d5c4e084846b10cd220c0003117acc2014325c8586402062a5372320b0a32717682201a800e023ba8004111064090620229023d182806014030407a03c0039e4258ee0d0187cb2216c009405184e1862a808f1d5883581c90e0a6001029ec19212dfdc421603469622920faa80c0b040644850662282460f0700e",
        "transactionsRoot": "0xbc3f787fa03e2b3af644521d20cec04d867685519f7bf2f5c740d2cb5794432c",
        "stateRoot": "0x71646d6cb789c95362eca6eaee7811a6e33207a80f16b65a217a8e52716c9303",
        "receiptsRoot": "0x4c002bc814f434bb6444d540fb4144172fb97cbc97733dc9562031a305dae6f1",
        "miner": "0x0000000000000000000000000000000000000000",
        "difficulty": "0x14",
        "totalDifficulty": "0x1ac4d50f",
        "extraData": "0xd682021083626f7288676f312e31382e33856c696e7578000000000000000000448d1ee49a9f16d8b56744e1d32d4c263ebb6e85620823845be5a3ada1e9ceb5410877b76c0ebd63ad922d6550e2280441a5a666f3aa1dcc4a42c2fe2a2b9d2700",
        "size": "0xa14c",
        "gasLimit": "0x1c9c380",
        "gasUsed": "0x81ff1c",
        "timestamp": "0x62d67b7d",
        "uncles": [],
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "transactions": [
            {
                "hash": "0x92bb0c20f3d256978eda3f75c369497c1a058351581cda26e5df3a96fdcfe15b",
                "nonce": "0x265df2",
                "transactionIndex": "0x0",
                "from": "0x4f27769c38169e402ffbb38b19f2606be60fdf97",
                "to": "0x7abba724a26d23aaca42d9b65cb4c35bbff1f577",
                "value": "0x0",
                "gasPrice": "0x45d964b800",
                "gas": "0x3d0900",
                "input": "0xb5cdffa8000000000000000000000000a34ab23406a237eec17af4d1496bfaadd2f48efd0000000000000000000000000000000000000000000000000000000000b7782f000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000018215cdb4f800000000000000000000000000000000000000000000000000000000000000034e465400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000013323032322d30372d31395430393a33323a353900000000000000000000000000",
                "v": "0x136",
                "r": "0x5b2fd90ee53860af8e159e0bf14033d91ab6599948c4ca70ed31a41764d71c35",
                "s": "0x69333f5c60a3a9f7f040279f75fddb2a2b81803866d00c8072dc90a5334eaf01",
                "chainId": null,
                "blockHash": "0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69",
                "blockNumber": "0x1d763ed"
            }
        ]
    }
}

Last updated