eth_getBlockByHash - zkSync Era

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.

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.

Example

Request

curl --location --request POST 'https://zksync-era-mainnet.unifra.io/v1/your-api-key' \
--header 'Content-Type: application/json' \
--data-raw '
{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByHash",
    "params":["0x7377c6bcf268755e8f662748974b5afcd55a8f8c2bbe14827a03a1fc7261003b", true],
    "id":0
}'

Result

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": {
        "baseFeePerGas": "0x211638",
        "difficulty": "0x2",
        "extraData": "0xd983010a0d846765746889676f312e31372e3133856c696e75780000000000005ecf0d58f468b471f442f27cc1754575729e945c1787b1fe65b32b9df691f44b2e1d099c73318c6f2e813282725f25b09679bb5aa577b1aa0b13f8d745c8958f00",
        "gasLimit": "0x3590e4b7",
        "gasUsed": "0x1ad6b",
        "hash": "0x7377c6bcf268755e8f662748974b5afcd55a8f8c2bbe14827a03a1fc7261003b",
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000004200000000001000000000000000000000080000000000000000400000000000000000000000000000000000000008000000000000000000000000040000000000000000010000000400000000000000000000000000000000000000000000000000000000000000000000000000000000800002000000000000000000000000000000000000000000080000000000000000000000000002000000008000000000010000000000000000000001000008000000",
        "miner": "0x0000000000000000000000000000000000000000",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0x2e",
        "parentHash": "0x2b279ceff553c0ae96c504648cb0399ebed3639af1c2ac79d0fc7db3b4a7ddaa",
        "receiptsRoot": "0x146f139d93c98df123422bf9bfefc9eaf19c144b6f23e639c3e3f8db9f609cfa",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x49f",
        "stateRoot": "0x23feebfd5629455553234567290ad5aaab9006ec74e80733c21456c1a0a3dce0",
        "timestamp": "0x6357a456",
        "totalDifficulty": "0x4b",
        "transactions": [
            {
                "blockHash": "0x7377c6bcf268755e8f662748974b5afcd55a8f8c2bbe14827a03a1fc7261003b",
                "blockNumber": "0x2e",
                "from": "0x000070300830ffc8501cf42402015bad12699d71",
                "gas": "0x29488",
                "gasPrice": "0x4a168811e",
                "hash": "0x68cd8c782c1847062d2a2d93c6333bedd960ecd0385881d73745057236ab2e67",
                "input": "0x9e353c700000000000000000000000007136311d65fe0e65eae4f389a4d86f9bd731d97c000000000000000000000000704da9bc96a89b98f7a3890aba3deebb8b69b043000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006360de69000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000a4232e8748000000000000000000000000e4657139e50e909731de703e1728128197a90447000000000000000000000000e4657139e50e909731de703e1728128197a90447000000000000000000000000000000000000000000000000002386f26fc100000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
                "nonce": "0x8",
                "to": "0xcb4567f103a6ba4cc348547a5094be0d93e88835",
                "transactionIndex": "0x0",
                "value": "0x0",
                "type": "0x1",
                "accessList": [],
                "chainId": "0x518935",
                "v": "0x0",
                "r": "0xe49e94b447d9b445ff15d5fa7b37e2ce98ca21808f1d6841c2f5bef8b9add95b",
                "s": "0x35e9fc945318b4bae251fdf43d0f434771ae80cd42683663105aa98e6cd200a3"
            }
        ],
        "transactionsRoot": "0xa93545b38d995049e44aff51d31ac5bc1094ec0b8740621a76c35f68134865e0",
        "uncles": []
    }
}

🚧

The below parameter inputs do not work, please reference the section above instead.

Language
Click Try It! to start a request and see the response here!