eth_getBlockByNumber - Mantle

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

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

Parameters

Parameter
Type
Description

blockNumber

string

Block number in hex, or "latest", "earliest", "pending"

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_getBlockByNumber",
    "params": ["0x3F6777", 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",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "nonce": "0x0000000000000000",
        "number": "0x3f6777",
        "parentHash": "0xd9505c7d82fbbad090d3ab4b4ecd20bca0f3700ce0c0c5ad2563a4100f86a004",
        "receiptsRoot": "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
        "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
        "size": "0x2d1",
        "stateRoot": "0x6ac1007f49aecaa29deff133703b287eb166ed12826bb685520f4b7a1aace96a",
        "timestamp": "0x643fc8a5",
        "totalDifficulty": "0x7eceef",
        "transactions": [
            "0x6dfef681e0a83a40b05d40877e53a88459e8829240a6d6d5ec6fe816e435f8d8"
        ],
        "transactionsRoot": "0x...",
        "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

miner

string

Address of block producer

Use Case

The eth_getBlockByNumber method is essential for:

  • Block explorer functionality

  • Transaction confirmation tracking

  • Historical data analysis

  • Chain synchronization verification

  • DeFi protocol state tracking

  • Event indexing by block range

Error Handling

Status Code
Error Message
Cause

403

Forbidden

Missing or invalid ACCESS-TOKEN

-32602

Invalid params

Invalid block number format

Web3 Integration

Last updated

Was this helpful?