Ask or search…
⌃K
Links

eth_blockNumber

How to use it

TypeScript/JavaScript
1
// yarn add @tatumio/tatum
2
​
3
import { TatumSDK, Chiliz, Network } from '@tatumio/tatum'
4
5
const tatum = await TatumSDK.init<Chiliz>({network: Network.CHILIZ})
6
​
7
const latestBlock = await tatum.rpc.blockNumber()
8
​
9
await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs

Overview

The eth_blockNumber method returns the number of the most recent block on the blockchain. This method is commonly used to track the current state of the network, monitor for new blocks, or fetch historical data.
Use cases for eth_blockNumber include:
  • Synchronising a local copy of the blockchain with the network
  • Checking the status of a transaction by comparing its block number to the current block number
  • Determining the current network state for smart contract interactions\

Parameters

The eth_blockNumber method does not require any parameters.

Return Object

The eth_blockNumber method returns a single field:
  • blockNumber: The number of the most recent block on the blockchain. The value is returned as a hexadecimal string.

JSON-RPC Request Example

{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": []
}

JSON-RPC Response Example

{
"id": 1,
"jsonrpc": "2.0",
"result": "0x4b7" // 1207
}
© Tatum Technology, LLC