eth_blockNumber - Somnia
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 on the Somnia network. This is a fundamental method for tracking blockchain state, monitoring network progress, and determining transaction finality. Given Somnia's ~100ms block times, this value updates rapidly.
Parameters
None
Returns
result
string
The current block number as a hexadecimal string
Request Example
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "eth_blockNumber",
"params": []
}'import axios from 'axios';
const data = JSON.stringify(
"jsonrpc": "2.0",
"id": "getblock.io",
"method": "eth_blockNumber",
"params": []
});
const config = {
method: 'post',
url: 'https://go.getblock.io/<ACCESS-TOKEN>/',
headers: {
'Content-Type': 'application/json'
},
data: data
};
axios(config)
.then(response => console.log(JSON.stringify(response.data)))
.catch(error => console.log(error));Response Example
Response Parameters
result
string
Hexadecimal block number (e.g., "0x1a2b3c" = 1,715,004)
Use Cases
Monitor blockchain synchronization status
Calculate transaction confirmations
Track network liveness and progress
Implement block-based polling for updates
Determine finality for transactions
Error Handling
-32603
Internal error - node processing issues
-32000
Server error - RPC endpoint unavailable
SDK Integration
Last updated
Was this helpful?