For the complete documentation index, see llms.txt. This page is also available as Markdown.

eth_blockNumber - Arbitrum Nova

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

This method returns the number of the most recent block, as a hex-encoded integer. It is the primary way to read the current chain tip on GIWA Sepolia.

Parameters

This method does not require any parameters. Send the request with an empty params array.

Request

curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
    "jsonrpc": "2.0",
    "method": "eth_blockNumber",
    "params": [],
    "id": "getblock.io"
}'
example.js
const axios = require('axios');

const response = await axios.post('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', {
    jsonrpc: '2.0',
    method: 'eth_blockNumber',
    params: [],
    id: 'getblock.io'
}, {
    headers: { 'Content-Type': 'application/json' }
});

console.log(response.data.result);
example.py
import requests

response = requests.post(
    'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
    headers={'Content-Type': 'application/json'},
    json={
        'jsonrpc': '2.0',
        'method': 'eth_blockNumber',
        'params': [],
        'id': 'getblock.io'
    }
)

print(response.json())

Response

{
    "jsonrpc": "2.0",
    "id": "getblock.io",
    "result": "0x14b8a10"
}

Response Parameters

Parameter
Type
Description

jsonrpc

string

JSON-RPC protocol version ("2.0")

id

string

Request identifier matching the request

result

string

Hex-encoded number of the latest block

Use Cases

  • Chain Tip Polling: Track new blocks on a ~1 second cadence for indexers

  • Confirmation Counting: Compute confirmations as tip minus a transaction's block number

  • Log Range Bounds: Set toBlock for an eth_getLogs query to the current tip

  • Sync Checks: Compare a local indexer height against the network tip

Error Handling

Error Code
Message
Description

-32603

Internal error

The node failed to return the latest block number

-32601

Method not found

The eth module is disabled on the client build

Web3 Integration

Last updated

Was this helpful?