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

Parameter
Type
Required
Description

blockParameter

string

Yes

Block number in hex, block hash, or "latest", "earliest", "pending"

Request

cURL
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"
}'

Response

Response (example)
{
    "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

Parameter
Type
Description

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

  1. Block Processing: Process all transactions in a block efficiently.

  2. Event Indexing: Extract all events from a block at once

  3. Analytics: Analyze gas usage across entire blocks.

  4. Chain Indexing: Build block-by-block indexes.

  5. MEV Analysis: Examine transaction ordering and outcomes.

Error Handling

Error Code
Message
Description

-32602

Invalid params

Invalid block parameter

-32603

Internal error

Block not found or node failure

Web3 Integration

Last updated

Was this helpful?