[Supanode](https://supanode.xyz/)[Learn](https://supanode.xyz/learn)Backfill EVM logs with bounded block windows

# Backfill EVM logs with bounded block windows

Adapt query size to response volume and persist progress without inventing a universal block cap.

**On this page**[Range limits are implementation details](https://supanode.xyz/learn/eth-getlogs-block-windows#range-limits-are-implementation-details)[An adaptive collector](https://supanode.xyz/learn/eth-getlogs-block-windows#an-adaptive-collector)[Keep progress auditable](https://supanode.xyz/learn/eth-getlogs-block-windows#keep-progress-auditable)[Join live and historical ingestion](https://supanode.xyz/learn/eth-getlogs-block-windows#join-live-and-historical-ingestion)[Sources](https://supanode.xyz/learn/eth-getlogs-block-windows#sources)

## Range limits are implementation details

The same eth\_getLogs request shape can face different timeout, range and response-size limits on different endpoints. There is no single block-window number that applies to every provider or every contract. A quiet contract and a busy exchange can produce radically different response volumes over the same range.

## An adaptive collector

```
start = saved_next_block
while start <= target:
    end = min(start + window - 1, target)
    try:
        logs = get_logs(start, end, filter)
        commit_logs_and_checkpoint(logs, end + 1)
        start = end + 1
    except RetryableSizeOrTimeout:
        window = max(1, window // 2)
```

At a one-block window, repeated size failures need another retrieval strategy rather than an infinite halving loop. Retry transient network errors with backoff and retain the exact error.

## Keep progress auditable

1.  Freeze a target block for each backfill run.
2.  Use inclusive fromBlock/toBlock boundaries and advance the next start by one.
3.  Deduplicate by chain ID, block hash, transaction hash and log index.
4.  Handle reorganizations by invalidating replaced blocks and re-reading an overlap window.

## Join live and historical ingestion

Buffer live events while the backfill reaches its fixed target, then reconcile the overlap. Use the same decoder and identity rules for both paths. Supanode's Robinhood limits document its current endpoint policy; check that policy before choosing an initial window. Preserve a count and checksum per completed range so later audits can distinguish a verified empty block span from a range that was never collected.

## Sources

-   [Ethereum log-query parameters](https://ethereum.org/en/developers/docs/apis/json-rpc/)
-   [Supanode Robinhood limits](https://supanode.xyz/docs/robinhood/rpc/limits)
-   [EVM log notifications](https://geth.ethereum.org/docs/interacting-with-geth/rpc/pubsub)

## Continue reading

[Robinhood RPC and WebSocket](https://supanode.xyz/blog/robinhood-chain-rpc-websocket)[Robinhood methods](https://supanode.xyz/docs/robinhood/rpc/whats-available)[Learn library](https://supanode.xyz/learn)

---
Source: https://supanode.xyz/learn/eth-getlogs-block-windows
