Skip to main content

eth_getBlockByNumber

POST

Returns block information for the specified block number.

🚧 Response taking too long? Response time may increase when including transactions!

When requesting full block information, response time can increase if the block contains many transactions.

For faster responses, exclude transactions and request only the block header (include transactions=false).

param[0]
blockNumberOrTagstringrequired
Use one of block number or block tag to specify a block.
  • Block number: hex string (ex. "0x1")
  • Block tag: enum string (ex. "latest", "earliest", "pending")
    • earliest: The oldest available block on the chain.
    • finalized: A recently finalized block that can no longer be changed. Primarily used in proof-of-stake (PoS) blockchains.
    • safe: A recent block considered safe by the network (immune to reorgs).
    • latest: The most recent block on the chain (may be subject to reorgs).
    • pending: The next block to be mined, including pending transactions in the mempool.
param[1]
includeTransactionsbooleanrequired
Whether to include transactions. Set to true to return results with full transaction data.
Responses
baseFeePerGasstring
Base fee per gas (EIP-1559, hex in wei)
difficultystring
Mining difficulty of the block (hex)
extraDatastring
Arbitrary extra data added by the miner (hex)
gasLimitstring
Maximum total gas allowed in this block (hex)
gasUsedstring
Total gas used by all transactions in this block (hex)
hashstring
Block hash
logsBloomstring
Bloom filter for event log search (2048 bits, hex)
minerstring
Address of the block miner
mixHashstring
Mix hash used in proof-of-work
noncestring
Nonce used in proof-of-work (hex)
numberstring
Block number (hex)
parentHashstring
Hash of the parent block
receiptsRootstring
Root hash of the transaction receipts trie
sha3Unclesstring
SHA3 hash of the uncles list
sizestring
Block size in bytes (hex)
stateRootstring
Root hash of the state trie
timestampstring
Block creation time (Unix timestamp, hex)
totalDifficultystring
Cumulative difficulty from genesis to this block (hex)
transactionsoneOf
Transactions in this block. Returns hash array or full objects depending on includeTransactions parameter.
Array of transaction hashes (includeTransactions=false)
transactionsRootstring
Root hash of the transactions trie
unclesarray
Array of uncle block hashes
Validator withdrawal list (EIP-4895)
indexstring
Withdrawal index (hex)
validatorIndexstring
Validator index (hex)
addressstring
Withdrawal recipient address
amountstring
Withdrawal amount (in Gwei, hex)
withdrawalsRootstring
Root hash of the withdrawals trie (EIP-4895)
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Unauthorized"
}
cURL
curl -X POST 'https://avalanche-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "eth_getBlockByNumber",
"params": [
"latest",
false
]
}'