eth_getBlockByNumber RPC Method

Fetches block details using a block number or tag.

Parameters#

stringrequired

Block number (hex) or tag: latest, safe, finalized, pending.

booleanrequired

When true, includes complete transaction objects; when false, only transaction hashes.

Result#

object | null - The block object, or null if no matching block exists.

Code sample#

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "latest",
    false
  ],
  "id": 1
}

Response#

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "number": "0x4b7",
    "gasLimit": "0x1c9c380",
    "gasUsed": "0x0",
    "timestamp": "0x0",
    "transactions": []
  }
}
Try It