Skip to main content
EVM

eth_getBlockByNumber

Summary: Get block by block number

This request block data for the given block number. You can use this method to view the transactions in a block, or the transaction hashes.

Parameters

block oneOf
required

Block number or string tag.

Block number string

Block number in hexadecimal.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

Block tag enum

See the default block parameter.

  • earliest: The lowest numbered block the client has available.
  • finalized: The most recent crypto-economically secure block, cannot be re-orged outside of manual intervention driven by community coordination.
  • 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.
  • pending: A sample next block built by the client on top of latest and containing the set of transactions usually taken from local mempool.

Enum:
"earliest"
"finalized"
"latest"
"pending"

hydratedTransactions boolean
required

For hashes pass false, for detailed transaction objects, pass true.

Returns

eth_getBlockByNumberResponse oneOf

null

Not Found (null).

object
required

hash string

Block hash, 32 byte hex identifier for the block derived from the block header; null when block is pending.

Pattern: ^0x[0-9a-f]{64}$

parentHash string

32 byte hex value of the hash of the parent block.

Pattern: ^0x[0-9a-f]{64}$

sha3Uncles string

SHA3 of the uncle's data in the block.

Pattern: ^0x[0-9a-f]{64}$

miner string

Not relevant to Proof of Stake/Linea. Applied to Proof of Work. Address to pay mining rewards to the coinbase transaction that rewarded the miner for their work.

Pattern: ^0x[0-9a-fA-F]{40}$

stateRoot string

Root of the final state trie for the block as 32 byte hex value.

Pattern: ^0x[0-9a-f]{64}$

transactionsRoot string

Root of the transaction trie for the block.

Pattern: ^0x[0-9a-f]{64}$

receiptsRoot string

Root of the receipts trie for the block.

Pattern: ^0x[0-9a-f]{64}$

logsBloom string

Bloom filter for the block logs; null when block is pending.

Pattern: ^0x[0-9a-f]{512}$

difficulty string

Not relevant to Proof of Stake/Linea. Difficulty for this block.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

number string

Block number; null when block is pending.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

gasLimit string

Maximum gas allowed in this block.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

gasUsed string

Total gas used by all transactions in this block.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

timestamp string

Unix timestamp (milliseconds) for block assembly.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

extraData string

Extra data field for this block.

Pattern: ^0x[0-9a-f]*$

mixHash string

Not relevant to Proof of Stake/Linea. Hash used in the Proof of Work process.

Pattern: ^0x[0-9a-f]{64}$

nonce string

Proof of Work nonce; not relevant to Proof of Stake/Linea. Hash of the generated Proof of Work.

Pattern: ^0x[0-9a-f]{16}$

totalDifficulty string

Not relevant to Proof of Stake/Linea. Total difficulty of the chain until this block. This value will always be 0 for an uncle block.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

baseFeePerGas string

The block's base fee per gas; empty for blocks created before EIP-1559.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

withdrawalsRoot string

Root of the trie containing withdrawal receipts in the block.

Pattern: ^0x[0-9a-f]{64}$

parentBeaconBlockRoot string

Root of the parent Beacon Chain block. This ties the execution layer to the consensus layer in Proof of Stake.

Pattern: ^0x[0-9a-f]{64}$

size string

Size of block in bytes.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

transactions anyOf

Array of transaction objects, or 32 byte transaction hashes depending on the specified parameter.

Transaction hashes array

Transaction hashes

string

32 byte hex value.

Pattern: ^0x[0-9a-f]{64}$

Full transactions array

Full transactions

Contextual information object
required

Transaction information.

blockHash string

Block hash, 32 byte hex identifier for the block derived from the block header.

Pattern: ^0x[0-9a-f]{64}$

blockNumber string

Block number.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

from string

Sender's address.

Pattern: ^0x[0-9a-fA-F]{40}$

hash string

32 byte hex identifier for the transaction hash.

Pattern: ^0x[0-9a-f]{64}$

transactionIndex string

Transaction index.

Pattern: ^0x([1-9a-f]+[0-9a-f]*|0)$

withdrawals array

object
required

Validator withdrawal.

index string

Index of withdrawal.

Pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$

validatorIndex string

Index of validator that generated withdrawal.

Pattern: ^0x([1-9a-f]+[0-9a-f]{0,15})|0$

address string

Recipient address for withdrawal value.

Pattern: ^0x[0-9a-fA-F]{40}$

amount string

Value contained in withdrawal.

Pattern: ^0x([1-9a-f]+[0-9a-f]{0,31})|0$

uncles array

Array of uncle hashes.

string

32 byte hex value.

Pattern: ^0x[0-9a-f]{64}$

Customize request
Parameter
Value
0x4ff31d
oneOf
falseboolean
Request
curl https://linea-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["0x4ff31d",false],
"id": 1
}'
Example response
{
"id": 1,
"jsonrpc": "2.0",
"result": {
"baseFeePerGas": "0x7",
"difficulty": "0x2",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000f37...",
"gasLimit": "0x3a2c940",
"gasUsed": "0x108061",
"hash": "0xf9539cc20c8f5271ac12e6491c022f2e9faaaff1eca0000799e0a6e78d6050c5",
"logsBloom": "0x04000004000c0000000010000000002100000000140052480000000...",
"miner": "0x0000000000000000000000000000000000000000",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"nonce": "0x0000000000000000",
"number": "0x4ff31d",
"parentHash": "0x8f702c7b4b88546f07cf66f09e46a6693a810131018b61a4ea257d369ace01c8",
"receiptsRoot": "0x70e4d96f4800e8c86ae75de75de1846da140a853d1e29fdae46400d93f85f4b8",
"sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"size": "0xf74",
"stateRoot": "0x0411d23f01843fc2f08dc97ed9da86d19232c3c0ee6cd6e66a0fbf65ee7f0333",
"timestamp": "0x66630dae",
"totalDifficulty": "0x9fe63b",
"transactions": [
"0xd34e34e1bf1c940b7524c7180c1c8ca83fd886d736df5537214d5715365a4e29",
"0x78109d6f5d643369fbf0ff432bc0c89a150f1c96d849f06cde2fccde7cd4cb25",
"0x5b4ad10868aea3dbcb8999554e5ba86992a189b65f64e7e762f2e19830766de2",
"0x058e58b8fcd988f7cdc8b9ea10811405c83e1b107c9d0c008ee4716f35bee2d2",
"0x15bb69f5c0e7b43321c69917600665632e4a49dbfb84eeb21c31afb02f2bb49b",
"0x8d9c25bf2dcbd1b148137702cf748ee18600d7df7a374da7b72a56200166fb7d",
"0xee8270208bea7bee60eb10de43f7a46ae81f972e7473627d89311163dd068db8",
"0x645ceec2a8aa92bcf2491bc97b4ac98aa2acb360627aecb2391c6d7b9a841e9f",
"0xdcca21e756689b7bea9b5534698435b7ea729c852e50256f21832943f475c00f",
"0x61db38d84032e85e77e927172ada7062f1747c09078ffa1131fea374d4e1c177",
"0xd35b3f5490f13717b99efa6f1e8f2eabaf75b6e1e5ccff0c837c1e11731b0fd2",
"0x466864e901219e93de7ea03ac640f2b7cabf2f96dda62e0ed3b9a236c1a401e8"
],
"transactionsRoot": "0xd5100dcb4f1adad04c51fdea94706b145cb4218c69c6b4415ee165f1d7e6434e",
"uncles": []
}
}