πŸ”΅ Base
eth_getBlockByNumber

eth_getBlockByNumber RPC Method

Returns information about a specific block by its number or tag.


Parameters

1. blockNumber or Tag (string, required)

The block number as a hex string (e.g., "0x1b4") or one of the following tags:

  • "latest" – most recent block
  • "earliest" – the genesis block
  • "pending" – pending block

2. Transaction details flag (boolean, required)

  • true: returns full transaction objects
  • false: returns only transaction hashes

Default: false

Example Parameters

[
  "0x1029C88",
  true
]

Returns

Returns a Block object or null if no block was found.

Block Object Fields

  • number β€” Block number (hex or null if pending)
  • hash β€” Block hash (32 bytes)
  • parentHash β€” Parent block hash (32 bytes)
  • nonce β€” Proof-of-work nonce (8 bytes, null if pending)
  • difficulty β€” Block difficulty (hex)
  • totalDifficulty β€” Total difficulty up to this block (hex)
  • logsBloom β€” Bloom filter for logs (null if pending)
  • sha3Uncles β€” SHA3 hash of uncles data
  • extraData β€” Extra data included in block (hex)
  • timestamp β€” Unix timestamp of the block (hex)
  • size β€” Block size in bytes (hex)
  • miner β€” Miner address (20 bytes)
  • transactionsRoot β€” Root of the transaction trie
  • stateRoot β€” Root of the state trie
  • receiptsRoot β€” Root of the receipts trie
  • gasUsed β€” Total gas used in the block (hex)
  • gasLimit β€” Max gas allowed in the block (hex)
  • transactions β€” Array of transaction objects or hashes
  • uncles β€” Array of uncle block hashes
  • mixHash β€” 256-bit hash used in PoW (hex)
  • baseFeePerGas β€” Base fee per gas (hex, optional)

Request

POST Endpoint

POST https://base-mainnet.chainnodes.org/YOUR-API-KEY

Replace YOUR-API-KEY with your actual key from the CHAINNODES Dashboard (opens in a new tab).


Example Request (HTTPS)

curl https://base-mainnet.chainnodes.org/YOUR-API-KEY \
  -X POST \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByNumber",
    "params": ["0x1029C88", false],
    "id":1
  }'

Example Request (WebSocket)

wscat -c wss://base-mainnet.chainnodes.org/YOUR-API-KEY \
  -w 1 \
  -x '{
    "jsonrpc":"2.0",
    "method":"eth_getBlockByNumber",
    "params": ["0x1029C88", false],
    "id":1
  }'

Example Response (truncated)

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "number": "0x1029c88",
    "hash": "0xc52962...",
    "parentHash": "0x38c03b...",
    "nonce": "0x0000000000000000",
    "difficulty": "0x0",
    "totalDifficulty": "0xc70d81...",
    "size": "0x28abc",
    "extraData": "0x62656176...",
    "gasLimit": "0x1c9c380",
    "gasUsed": "0xdf19ac",
    "timestamp": "0x642709eb",
    "miner": "0x95222290dd...",
    "stateRoot": "0x30fcd7...",
    "transactionsRoot": "0x6f7b72...",
    "receiptsRoot": "0xf29158...",
    "logsBloom": "0x48...",
    "transactions": [
      "0xb19f38ce6f75...",
      "0xdb933288ef26...",
      ...
    ],
    "uncles": [],
    "baseFeePerGas": "0x6f664d776",
    "mixHash": "0x33ca51..."
  }
}

πŸ’¬ Need help? Ask blockchain developers in Chainnodes Telegram Chat (opens in a new tab)

Need RPC API keys?

Get 12.5M archival requests for free today.