# eth_getBlockReceipts - Scroll RPC Method

Returns all transaction receipts for a block on Scroll. This is more efficient than calling `eth_getTransactionReceipt` once per transaction when you already know the target block.

> **Why Scroll?** Build on the largest zkEVM by market share with $750M+ TVL and bytecode-level Ethereum equivalence with bytecode-level EVM equivalence, native Hardhat/Remix/MetaMask support, decentralized proof validation, and Scroll SDK for L2/L3 deployment.

## When to Use This Method

`eth_getBlockReceipts` is useful for Ethereum developers, DeFi builders, and teams requiring seamless mainnet migration:

- **Indexer Backfills**: Pull every receipt in a block with one request instead of looping over transaction hashes
- **Event Collection**: Scan all logs emitted by a block when building analytics or data pipelines
- **Settlement Auditing**: Verify every transaction outcome in a target block for zero-migration DeFi protocols, zkEVM-native dApps, and 100+ ecosystem projects with native Ethereum tooling
- **Operational Debugging**: Compare receipt-level gas usage, status, and logs across multiple transactions at once

## Request Parameters

- `block` (`QUANTITY | TAG | DATA, required`): Block number, block tag such as latest, or 32-byte block hash

## Request Example

```json
{
  "jsonrpc": "2.0",
  "method": "eth_getBlockReceipts",
  "params": ["0x122ce98b8c7b63658708683fe2d01378846723641ac04459e844a61a6225db5c"],
  "id": 1
}
```

## Response Fields

- `result` (`Array<Object> | null, required`): Array of receipt objects for the block, or null if the block is not found
- `transactionHash` (`DATA, required`): Transaction hash
- `status` (`QUANTITY, required`): 0x1 on success, 0x0 on failure
- `gasUsed` (`QUANTITY, required`): Gas used by this transaction
- `cumulativeGasUsed` (`QUANTITY, required`): Total gas used in the block up to this transaction
- `logs` (`Array<Object>, required`): Logs emitted by the transaction
- `contractAddress` (`DATA | null, required`): Created contract address for deployment transactions
- `effectiveGasPrice` (`QUANTITY, required`): Effective gas price paid by the sender

## Successful Response

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": [
    {
      "transactionHash": "0x50b1857dce8dbe401e09610534de81655bc508c6765eb30ecefe24148c515c28",
      "transactionIndex": "0x0",
      "blockHash": "0x0ee8240b9393d92d059f1a87f4845ca5fd75f70aca8b1a97d98e1ea2560edf34",
      "blockNumber": "0xab47b2",
      "from": "0x0bd34b0a5be345c9bf7a147eb698e993511180cb",
      "to": "0xccc88a9d1b4ed6b0eaba998850414b24f1c315be",
      "gasUsed": "0x10b58",
      "cumulativeGasUsed": "0x10b58",
      "effectiveGasPrice": "0x9c7652400",
      "status": "0x0",
      "logs": [
        {
          "address": "0x20c0000000000000000000000000000000000000",
          "topics": [
            "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
          ],
          "data": "0x0000000000000000000000000000000000000000000000000000000000000b3b",
          "logIndex": "0x0",
          "removed": false
        }
      ]
    }
  ]
}
```

## Common Use Cases

### 1. Backfill Transaction Receipts for an Indexer

When bootstrapping an indexer for Scroll, use `eth_getBlockReceipts` to backfill historical receipt data efficiently. One RPC call per block replaces dozens of individual `eth_getTransactionReceipt` calls.

```javascript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('https://api-scroll-mainnet.n.dwellir.com/YOUR_API_KEY');

async function backfillReceipts(startBlock, endBlock) {
  const receipts = {};

  for (let i = startBlock; i <= endBlock; i++) {
    const hexBlock = '0x' + i.toString(16);
    const results = await provider.send('eth_getBlockReceipts', [hexBlock]);

    if (results) {
      for (const receipt of results) {
        receipts[receipt.transactionHash] = {
          block: i,
          status: receipt.status === '0x1' ? 'success' : 'failed',
          gasUsed: parseInt(receipt.gasUsed, 16),
          logCount: receipt.logs.length,
        };
      }
    }
    console.log(`Backfilled block ${i}: ${results ? results.length : 0} receipts`);
  }

  return receipts;
}

backfillReceipts(10000000, 10000050);
```

### 2. Audit Gas Usage Across All Transactions in a Range

Compute total gas consumption and identify high-gas transactions within a target block range on Scroll. This is useful for gas cost analysis and identifying optimization targets in smart contract usage.

```python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-scroll-mainnet.n.dwellir.com/YOUR_API_KEY'))

def audit_gas_usage(block_identifier):
    response = w3.provider.make_request(
        'eth_getBlockReceipts', [block_identifier]
    )

    receipts = response.get('result')
    if not receipts:
        print(f'No receipts found for block {block_identifier}')
        return

    total_gas = 0
    for receipt in receipts:
        gas = int(receipt['gasUsed'], 16)
        total_gas += gas
        if gas > 500_000:
            print(f'High gas tx: {receipt["transactionHash"]} used {gas:,} gas')

    print(f'Block {block_identifier}: {len(receipts)} txs, '
          f'total gas {total_gas:,}')

audit_gas_usage('0x122ce98b8c7b63658708683fe2d01378846723641ac04459e844a61a6225db5c')
```

### 3. Extract Contract Creation Events from Deployment Blocks

When monitoring contract deployments on the largest zkEVM by market share with $750M+ TVL and bytecode-level Ethereum equivalence, use `eth_getBlockReceipts` to scan for receipts where `contractAddress` is non-null. This identifies all new contract deployments within a block in a single call.

```go
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/rpc"
)

func main() {
    client, _ := rpc.Dial("https://api-scroll-mainnet.n.dwellir.com/YOUR_API_KEY")

    var receipts []map[string]interface{}
    err := client.CallContext(
        context.Background(),
        &receipts,
        "eth_getBlockReceipts",
        "0x122ce98b8c7b63658708683fe2d01378846723641ac04459e844a61a6225db5c",
    )
    if err != nil {
        log.Fatal(err)
    }

    for _, r := range receipts {
        contractAddr, ok := r["contractAddress"]
        if ok && contractAddr != nil {
            fmt.Printf("Contract deployed: %s\n", contractAddr)
            fmt.Printf("  Creator: %s\n", r["from"])
            fmt.Printf("  Tx hash: %s\n", r["transactionHash"])
        }
    }
}
```

## Best Practices

- **Use block hash instead of block number for deterministic results**: Hash-based lookups guarantee you are querying the exact block intended, even if chain reorganizations shift block numbers
- **Paginate large receipt arrays client-side**: Blocks with thousands of transactions return large payloads; paginate processing to avoid memory pressure in your application
- **Cache individual receipt data per transaction hash**: Receipts are immutable once a block is finalized, so cache them indefinitely for repeated lookups
- **For historical blocks, archive nodes may return more complete receipt data**: Full nodes may prune older state; archive nodes retain complete historical receipt information

## Code Examples

cURL
JavaScript
Python
Go

```bash
curl -X POST https://api-scroll-mainnet.n.dwellir.com/YOUR_API_KEY \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_getBlockReceipts",
    "params": ["0x122ce98b8c7b63658708683fe2d01378846723641ac04459e844a61a6225db5c"],
    "id": 1
  }'
```

```javascript
import { JsonRpcProvider } from 'ethers';

const provider = new JsonRpcProvider('https://api-scroll-mainnet.n.dwellir.com/YOUR_API_KEY');

const receipts = await provider.send('eth_getBlockReceipts', [
  '0x122ce98b8c7b63658708683fe2d01378846723641ac04459e844a61a6225db5c',
]);

console.log('Receipt count:', receipts.length);
console.log('First tx status:', receipts[0]?.status);
console.log('First tx logs:', receipts[0]?.logs.length ?? 0);
```

```python
from web3 import Web3

w3 = Web3(Web3.HTTPProvider('https://api-scroll-mainnet.n.dwellir.com/YOUR_API_KEY'))

response = w3.provider.make_request(
    'eth_getBlockReceipts',
    ['0x122ce98b8c7b63658708683fe2d01378846723641ac04459e844a61a6225db5c'],
)

receipts = response['result']
print(f'Receipt count: {len(receipts)}')
print(f'First tx status: {receipts[0][\"status\"]}')
print(f'First tx logs: {len(receipts[0][\"logs\"])}')
```

```go
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/ethereum/go-ethereum/rpc"
)

func main() {
    client, err := rpc.Dial("https://api-scroll-mainnet.n.dwellir.com/YOUR_API_KEY")
    if err != nil {
        log.Fatal(err)
    }

    var receipts []map[string]any
    err = client.CallContext(
        context.Background(),
        &receipts,
        "eth_getBlockReceipts",
        "0x122ce98b8c7b63658708683fe2d01378846723641ac04459e844a61a6225db5c",
    )
    if err != nil {
        log.Fatal(err)
    }

    fmt.Printf("Receipt count: %d\n", len(receipts))
    if len(receipts) > 0 {
        fmt.Printf("First tx status: %v\n", receipts[0]["status"])
    }
}
```

## Related Methods

- [`eth_getTransactionReceipt`](https://www.dwellir.com/docs/scroll/eth_getTransactionReceipt) - Retrieve a single transaction receipt
- [`eth_getBlockByHash`](https://www.dwellir.com/docs/scroll/eth_getBlockByHash) - Retrieve the block object itself
- [`eth_getBlockByNumber`](https://www.dwellir.com/docs/scroll/eth_getBlockByNumber) - Retrieve a block by number or tag
