Skip to main content
POST
/
eth_getBlockByNumber
curl --request POST \
  --url https://monad-testnet.core.chainstack.com/9c5b265f20b3ea5df4f54f70eb74b800/ \
  --header 'Content-Type: application/json' \
  --data '{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "latest",
    false
  ]
}'
{
  "jsonrpc": "<string>",
  "id": 123,
  "result": {}
}
Monad API method that returns information about a block by block number. This method allows you to retrieve detailed information about a specific block, including its transactions.
Get you own node endpoint todayStart for free and get your app to production levels immediately. No credit card required.You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • quantity or tag — the integer of a block number encoded as hexadecimal, or the string latest, earliest, or pending.
  • boolean — if true, returns the full transaction objects; if false, returns only the hashes of the transactions.

Response

  • result — the block object, or null when no block was found:
    • number — the block number
    • hash — the block hash
    • parentHash — hash of the parent block
    • nonce — hash of the proof-of-work
    • sha3Uncles — SHA3 of the uncles data
    • logsBloom — the bloom filter for the logs
    • transactionsRoot — the root of the transaction trie
    • stateRoot — the root of the final state trie
    • receiptsRoot — the root of the receipts trie
    • miner — the address of the beneficiary
    • difficulty — integer of the difficulty
    • totalDifficulty — total difficulty of the chain until this block
    • extraData — extra data field
    • size — size of this block in bytes
    • gasLimit — maximum gas allowed in this block
    • gasUsed — total gas used by all transactions
    • timestamp — the unix timestamp for when the block was collated
    • transactions — array of transaction objects or hashes
    • uncles — array of uncle hashes

eth_getBlockByNumber code examples

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

const provider = new ethers.JsonRpcProvider("CHAINSTACK_NODE_URL");

async function getBlock() {
  const block = await provider.getBlock("latest");
  console.log(block);
}

getBlock();

Use case

A practical use case for eth_getBlockByNumber is retrieving block data for analysis, such as examining transaction volume, gas usage patterns, or timestamps for specific blocks.

Body

application/json
id
integer
default:1
jsonrpc
string
default:2.0
method
string
default:eth_getBlockByNumber
params
(string | boolean)[]

Response

200 - application/json

The block information.

jsonrpc
string
id
integer
result
object | null