curl --request POST \
--url https://nd-907-114-772.p2pify.com/b9b0fb92029d58b396139a9e89cf479b \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": []
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
curl --request POST \
--url https://nd-907-114-772.p2pify.com/b9b0fb92029d58b396139a9e89cf479b \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": []
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
0x69B5B
means that the block is the 432,987th block in the blockchain.
none
result
— the integer value of the node’s latest block number is synced to and encoded as hexadecimal. The block number is used to identify the block’s position in the blockchain and is updated every time a new block is added to the chain.eth_blockNumber
code examplesconst { Web3 } = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
async function getLatestBlockNumber() {
const block = await web3.eth.getBlockNumber();
console.log(`Latest block: ${block}`);
}
getLatestBlockNumber()
eth_blockNumber
method in Fantom is for applications that need to be aware of the current block number—some applications may need to be mindful of the current block number to function correctly. For example, a DApp may use the current block number to determine the expiration date of a time-limited offer.The latest block number.
The response is of type object
.
Was this page helpful?