eth_blockNumber

Returns the number of the most recent block.

Parameters

none

Returns

QUANTITY - integer of the current block number the client is on.

Request

 const Web3 = require("web3");

async function main() {
    const Web3 = require('web3')
    const rpcURL = '1DLT-IP-ADDRESS' // Your RPC URL goes here
    const web3 = new Web3(rpcURL)

    // Query the blockchain
    const blockNumber = await web3.eth.getBlockNumber();

    // Print the output to console
    console.log(blockNumber);
}

main();

Result

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": "0x14"
}

Last updated