eth_blockNumber
Returns the number of the most recent block on the blockchain.
Parameters
NoneReturns
result (string)Request
{
"jsonrpc": "2.0",
"method": "eth_blockNumber",
"params": [],
"id": 1
}curl https://rpc.dysnomia.icu -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' package main
import (
"context"
"fmt"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
ctx := context.Background()
client, _ := ethclient.Dial("https://rpc.dysnomia.icu")
blockNumber, _ := client.BlockNumber(ctx)
fmt.Println(blockNumber)
}from web3 import Web3, HTTPProvider
web3 = Web3(HTTPProvider("https://rpc.dysnomia.icu"))
print(web3.eth.block_number)import { ethers } from "ethers";
(async () => {
const provider = new ethers.JsonRpcProvider("https://rpc.dysnomia.icu/");
const response = await provider.getBlockNumber();
return response;
}).then((r) => {
console.log(r);
});Response
{
"jsonrpc": "2.0",
"id": 1,
"result": "0x16b398e"
}Last updated