eth_getBlockReceipts - Base
Example code for the eth_getBlockReceipts JSON-RPC method. Complete guide on how to use eth_getBlockReceipts JSON-RPC in GetBlock Web3 documentation.
The eth_getBlockReceipts method returns all transaction receipts for a given block. This is more efficient than fetching individual receipts when you need all receipts from a block.
Parameters
blockParameter
string
Yes
Block number in hex, block hash, or "latest", "earliest", "pending"
Request
curl --location --request POST 'https://go.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "eth_getBlockReceipts",
"params": ["latest"],
"id": "getblock.io"
}'const axios = require('axios');
const response = await axios.post('https://go.getblock.io/<ACCESS-TOKEN>/', {
jsonrpc: '2.0',
method: 'eth_getBlockReceipts',
params: ['latest'],
id: 'getblock.io'
}, {
headers: { 'Content-Type': 'application/json' }
});
const receipts = response.data.result;
console.log('Total Receipts:', receipts.length);
receipts.forEach(r => {
console.log('Tx:', r.transactionHash, 'Status:', r.status === '0x1' ? 'Success' : 'Failed');
});Response
{
"jsonrpc": "2.0",
"id": "getblock.io",
"result": [
{
"transactionHash": "0x633982a26e0cfba940613c52b31c664fe977e05171e35f62da2426596007e249",
"transactionIndex": "0x0",
"blockHash": "0x849a3ac8f0d81df1a645701cdb9f90e58500d2eabb80ff3b7f4e8c13f025eff2",
"blockNumber": "0x12d687f",
"from": "0x742d35Cc6634C0532925a3b844Bc9e7595f5bE21",
"to": "0x1234567890123456789012345678901234567890",
"cumulativeGasUsed": "0x5208",
"gasUsed": "0x5208",
"effectiveGasPrice": "0x5f5e100",
"contractAddress": null,
"logs": [],
"logsBloom": "0x00000000...",
"status": "0x1",
"type": "0x2",
"l1Fee": "0x2540be400",
"l1GasPrice": "0x3b9aca00",
"l1GasUsed": "0x640"
}
]
}Response Parameters
transactionHash
string
32-byte transaction hash
blockHash
string
32-byte block hash
blockNumber
string
Block number in hex
from
string
20-byte sender address
to
string
20-byte recipient address
status
string
0x1 for success, 0x0 for failure
gasUsed
string
Gas used by this transaction (hex)
effectiveGasPrice
string
Actual gas price paid (hex)
logs
array
Array of log objects
l1Fee
string
L1 data fee (Base-specific)
Use Cases
Block Processing: Process all transactions in a block efficiently.
Event Indexing: Extract all events from a block at once
Analytics: Analyze gas usage across entire blocks.
Chain Indexing: Build block-by-block indexes.
MEV Analysis: Examine transaction ordering and outcomes.
Error Handling
-32602
Invalid params
Invalid block parameter
-32603
Internal error
Block not found or node failure
Web3 Integration
Last updated
Was this helpful?