eth_getBlockByNumber - Ethereum

eth_getBlockByNumber. Returns information of the block matching the given block number

getBlockByNumber - ethereum [Value: 24CU]
Returns information of the block matching the given block number.
Use cases

Use cases

  • Verify transactions in a specific block
  • Compare block details for node sync
  • Monitor contract events for off-chain triggers
Constraints

Constraints

  • Response delays due to network latency
  • Slight data discrepancies until finality
  • Strain on resources with frequent requests
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl --request POST \
    --url https://eth.drpc.org \
    --header 'accept: application/json' \
    --header 'content-type: application/json' \
    --data '
{
 "id": 1,
 "jsonrpc": "2.0",
 "method": "eth_getBlockByNumber",
 "params": [
   "finalized",
   "finalized"
 ]
}
'
Copy
Response
200
{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "number": "0x1b4",
    "difficulty": "0x4ea3f27bc",
    "extraData": "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
    "gasLimit": "0x1388",
    "gasUsed": "0x0",
    "hash": "0xdc0818cf78f21a8e70579cb46a43643f78291264dda342ae31049421c82d21ae",
    "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "miner": "0xbb7b8287f3f0a933474a79eae42cbca977791171",
    "mixHash": "0x4fffe9ae21f1c9e15207b1f472d5bbdd68c9595d461666602f2be20daf5e7843",
    "nonce": "0x689056015818adbe",
    "parentHash": "0xe99e022112df268087ea7eafaf4790497fd21dbeeb6bd7a1721df161a6657a54",
    "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "size": "0x220",
    "stateRoot": "0xddc8b0234c2e0cad087c8b389aa7ef01f7d79b2570bccb77ce48648aa61c904d",
    "timestamp": "0x55ba467c",
    "totalDifficulty": "0x78ed983323d",
    "transactions": [],
    "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "uncles": []
  }
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersarray
array
blockNumberstring
The block number in hexadecimal format or the string latest, earliest, pending, safe or finalized.
  • pending - A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool. Intuitively, you can think of these as blocks that have not been mined yet.
  • latest - The most recent block in the canonical chain observed by the client, this block may be re-orged out of the canonical chain even under healthy/normal conditions.
  • safe - The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination. Intuitively, this block is “unlikely” to be re-orged.
  • finalized - The most recent crypto-economically secure block, that has been accepted by >2/3 of validators. Cannot be re-orged outside of manual intervention driven by community coordination. Intuitively, this block is very unlikely to be re-orged.
  • earliest - The lowest numbered block the client has available. Intuitively, you can think of this as the first block created.
transaction_detail_flagboolean
The method returns the full transaction objects when this value is true otherwise, it returns only the hashes of the transactions

Response

200
A block object, or null when no block was found. The block object contains the following fields:

Response params

object
baseFeePerGasstring
A string of the base fee encoded in hexadecimal format. Please note that this response field will not be included in a block requested before the EIP-1559 upgrade
difficultyinteger
The integer of the difficulty for this block encoded as a hexadecimal
extraDatastring
The “extra data” field of this block
gasLimitstring
The maximum gas allowed in this block encoded as a hexadecimal
gasUsedstring
The total used gas by all transactions in this block encoded as a hexadecimal
hashstring
The block hash of the requested block. null if pending
logsBloomstring
The bloom filter for the logs of the block. null if pending
minerstring
The address of the beneficiary to whom the mining rewards were given
mixHashstring
A string of a 256-bit hash encoded as a hexadecimal
noncestring
The hash of the generated proof-of-work. null if pending
numberstring
The block number of the requested block encoded as hexadecimal. null if pending
parentHashstring
The hash of the parent block
receiptsRootstring
The root of the receipts trie of the block
sha3Unclesstring
The SHA3 of the uncles data in the block
sizestring
The size of this block in bytes as an Integer value encoded as hexadecimal
stateRootstring
The root of the final state trie of the block
timestampstring
The UNIX timestamp for when the block was collated
totalDifficultystring
The integer of the total difficulty of the chain until this block encoded as a hexadecimal
transactionsarray
An array of transaction objects - please see eth_getTransactionByHash for exact shape
transactionsRootstring
The root of the transaction trie of the block
unclesarray
An array of uncle hashes