{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "latest",
    true
  ]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "number": "0x1b4",
    "hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
    "parentHash": "0x6c0f2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
    "nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom": "0x0e670ec64341...",
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "stateRoot": "0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "miner": "0x4e65fda2159562a496f9f3522f89122a3088497a",
    "difficulty": "0x027f07",
    "totalDifficulty": "0x027f07",
    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "size": "0x027f07",
    "gasLimit": "0x9f759",
    "gasUsed": "0x9f759",
    "timestamp": "0x54e34e8e",
    "transactions": ["0x..."],
    "uncles": []
  }
}

Defined in the Ethereum JSON-RPC Specification

Returns information about a block by block number.

Parameters

blockParameter
string
required

Integer block number, or the string “latest”, “earliest”, “pending”, “safe” or “finalized”.

fullTransactionObjects
boolean
required

If true, returns the full transaction objects; if false, returns only the hashes of the transactions.

Returns

result
object

A block object, or null when no block was found.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "latest",
    true
  ]
}
{
  "id": 1,
  "jsonrpc": "2.0",
  "result": {
    "number": "0x1b4",
    "hash": "0xc6ef2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
    "parentHash": "0x6c0f2fc5426d6ad6fd9e2a26abeab0aa2411b7ab17f30a99d3cb96aed1d1055b",
    "nonce": "0xe04d296d2460cfb8472af2c5fd05b5a214109c25688d3704aed5484f9a7792f2",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom": "0x0e670ec64341...",
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "stateRoot": "0xd5855eb08b3387c0af375e9cdb6acfc05eb8f519e419b874b6ff2ffda7ed1dff",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "miner": "0x4e65fda2159562a496f9f3522f89122a3088497a",
    "difficulty": "0x027f07",
    "totalDifficulty": "0x027f07",
    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "size": "0x027f07",
    "gasLimit": "0x9f759",
    "gasUsed": "0x9f759",
    "timestamp": "0x54e34e8e",
    "transactions": ["0x..."],
    "uncles": []
  }
}

Error Handling

CodeMessageDescription
-32602Invalid block parameterThe provided block parameter is invalid
4100Requested method not supportedThe method is not supported by the wallet

Block parameter tags: “latest” (most recent block), “earliest” (genesis block), “pending” (next block to be mined), “safe” and “finalized” (post-merge Ethereum blocks).