Skip to main content

eth_getBlockByNumber

Returns information about a block by block number on Linea.

Why Linea? Build on Consensys-backed zkEVM L2 with $1B+ TVL and 807% growth in 2025 with 15-30x lower fees than Ethereum mainnet, 6,200 TPS throughput, SWIFT integration with 12+ institutions, and $725M Consensys backing.

Use Cases#

The eth_getBlockByNumber method is essential for:

  • Block explorers - Display complete block information
  • Transaction indexers - Process all transactions in a block
  • Analytics platforms - Analyze blockchain data for enterprise DeFi (Aave, Renzo), institutional cross-border payments via SWIFT pilots, and zkEVM-native applications
  • Timestamp verification - Get block timestamps for time-based logic

Parameters#

ParameterTypeRequiredDescription
blockNumberQUANTITY|TAGYesBlock number in hex, or "latest", "earliest", "pending", "safe", "finalized"
fullTransactionsBooleanYesIf true, returns full transaction objects; if false, returns transaction hashes

Request#

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

Returns#

FieldTypeDescription
numberQUANTITYBlock number
hashDATA32-byte block hash
parentHashDATA32-byte parent block hash
timestampQUANTITYUnix timestamp
gasUsedQUANTITYTotal gas used by all transactions
gasLimitQUANTITYMaximum gas allowed in block
transactionsArrayArray of transaction objects or hashes
baseFeePerGasQUANTITYBase fee per gas (EIP-1559)

Response#

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"number": "0x5BAD55",
"hash": "0x0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
"parentHash": "0x...",
"timestamp": "0x64d8f6d0",
"gasUsed": "0x1234",
"gasLimit": "0x1c9c380",
"transactions": [],
"baseFeePerGas": "0x5f5e100"
}
}

Code Examples#

curl -X POST https://api-linea-mainnet-archive.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByNumber",
"params": ["latest", false],
"id": 1
}'

Error Handling#

Error CodeMessageDescription
-32602Invalid paramsInvalid block number or parameter format
-32000Block not foundBlock does not exist