eth_getBlockByHash - Mantle

Example code for the eth_getBlockByHash JSON-RPC method. Complete guide on how to use eth_getBlockByHash JSON-RPC in GetBlock Web3 documentation.

This method returns information about a block on Mantle by block hash.

Parameters

Parameter
Type
Description

blockHash

string

32-byte hash of the block

fullTransactions

boolean

If true, returns full transaction objects; if false, returns transaction hashes

Request

curl
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockByHash",
    "params": ["0x9b14d73f45c836bfb0e1f59453c39fe8cddab45a0f78670dc6190e5c85b65a8e", false],
    "id": "getblock.io"
}'

Response

response.json
{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": {
        "difficulty": "0x2",
        "extraData": "0xd98301090a846765746889676f312e31352e3133856c696e7578",
        "gasLimit": "0xe4e1c0",
        "gasUsed": "0x5208",
        "hash": "0x9b14d73f45c836bfb0e1f59453c39fe8cddab45a0f78670dc6190e5c85b65a8e",
        "logsBloom": "0x00000000...",
        "miner": "0x0000000000000000000000000000000000000000",
        "number": "0x3f6777",
        "parentHash": "0xd9505c7d82fbbad090d3ab4b4ecd20bca0f3700ce0c0c5ad2563a4100f86a004",
        "timestamp": "0x643fc8a5",
        "transactions": [],
        "uncles": []
    }
}

Response Parameters

Field
Type
Description

number

string

Block number (hex)

hash

string

Block hash (32 bytes)

parentHash

string

Parent block hash

timestamp

string

Unix timestamp of block creation

gasLimit

string

Maximum gas allowed in block

gasUsed

string

Total gas used by transactions

transactions

array

Array of transaction hashes or objects

Use Case

The eth_getBlockByHash method is essential for:

  • Verifying block existence by hash

  • Block explorer functionality

  • Cross-referencing block data

  • Transaction confirmation validation

  • Historical block analysis

  • Chain reorganization detection

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN

-32602

Invalid params

Invalid block hash format

Web3 Integration

Last updated

Was this helpful?