QUANTITY - integer of the current block number the client is on.
Request
constWeb3=require("web3");asyncfunctionmain() {constWeb3=require('web3')constrpcURL='1DLT-IP-ADDRESS'// Your RPC URL goes hereconstweb3=newWeb3(rpcURL)// Query the blockchainconstblockNumber=awaitweb3.eth.getBlockNumber();// Print the output to consoleconsole.log(blockNumber);}main();
const { ethers } =require("ethers");asyncfunctionmain() {// Initialize an ethers instanceconstprovider=newethers.providers.JsonRpcProvider("1DLT-IP-ADDRESS");// Query the blockchainconstblockNumber=awaitprovider.getBlockNumber();// Print the output to consoleconsole.log(blockNumber);}main()
curl1DLT-IP-ADDRESS \-X POST \-H "Content-Type: application/json" \-d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":0}'