Skip to main content
Plasma API method that returns information about a block by block number.

Parameters

  • quantity or tag — the block number in hex format or block tag (latest, earliest, pending, safe, finalized)
  • boolean — if true, returns full transaction objects; if false, returns only transaction hashes

Response

  • object — a block object, or null when no block was found

eth_getBlockByNumber code examples

const { JsonRpcProvider } = require("ethers");

const provider = new JsonRpcProvider("CHAINSTACK_NODE_URL");

async function call() {
  const result = await provider.send("eth_getBlockByNumber", [
    "latest",
    false
  ]);
  console.log(result);
}

call();