Skip to content
EthNews

News from across Ethereum

eth_getLogs failures on public RPC endpoints: query limits

Why does eth_getLogs fail on a public RPC endpoint? Free nodes cap block ranges, result sizes and request rates; chunking and tighter filters make queries reliable.

The EthNews Desk5 min read

eth_getLogs failures on public RPC endpoints: query limits

eth_getLogs calls fail on public RPC endpoints when a query exceeds the provider’s block-range or result-size limits, or when a burst of requests hits its rate limit; smaller, filtered queries are more likely to succeed.

In JSON-RPC, eth_getLogs accepts a fromBlock and toBlock range, plus optional address and topics filters. The endpoint searches for matching logs and returns them in the response. A wide range can require substantial work, especially when it covers many contracts or common events.

Free shared nodes serve many callers, so providers set limits to control expensive requests. A query that crosses a block or response cap may return an error or time out. EIP-1474 defines error code -32005 as “Limit exceeded.” Providers choose their own caps and may report failures differently, so the code and wording are not consistent across endpoints.

Rate limits are a separate constraint. A single query may fit the provider’s range and result limits, but a rapid burst of queries can still be throttled. Some public endpoints also restrict eth_getLogs entirely. Check the endpoint provider’s documentation for its supported methods, range limits and request policy.

Why wide event queries run into limits

eth_getLogs consumes a provider’s range and response budget according to the blocks scanned and the matching logs returned. The limits vary by provider, and the result count can grow sharply when a query spans many blocks or matches a frequently emitted event.

Say you want every Transfer event for a token. A query from block 0 to latest asks the endpoint to search the entire chain history for that address and event signature. If the token was deployed much later, the query still spends its block-range allowance on all earlier blocks, where that contract could not have emitted anything. The broad scan can hit a range cap, produce too many logs, or take long enough to time out.

Start from the contract’s deployment block instead. This removes blocks where the contract did not yet exist, so the same query uses its range more effectively. Then split the remaining interval into smaller, consecutive chunks. If one chunk fails, retry that range rather than repeating the entire history.

Filter by the contract address and, when appropriate, by topic0—the event signature topic. These filters narrow the results the endpoint must return. A Transfer query for one token should include that token’s address and the Transfer topic, rather than requesting matching events across every contract.

Provider limits vary, so there is no single block range that every public RPC accepts. If you are comparing endpoints, Chainlist helps you find an EVM network’s chain ID and published RPC endpoints. The linked topic can help you identify an endpoint to try when your current one is rejecting log queries: Chainlist. Confirm the endpoint’s own limits in its documentation; a directory entry does not establish how many blocks or logs it will accept.

How can you shape a query that succeeds?

Make eth_getLogs queries fit the endpoint by limiting the block span, narrowing the filters and pacing requests. Begin with the deployment block, set a modest toBlock, and query one interval at a time. Increase the interval only when the endpoint accepts the calls reliably.

If a request fails with a limit error or timeout, reduce the chunk size and retry. If requests are throttled, pause between them and use exponential backoff: wait longer after each repeated failure, then resume from the failed interval. Keep track of the last completed block so retries do not skip history or duplicate work in your own processing.

Compared with searching the same events in a block explorer, direct JSON-RPC queries let an application request raw logs for chosen ranges and filters. That is useful when building an indexer, following a contract’s events, or checking a transaction’s emitted logs. The trade-off is that your code must handle pagination by block range, endpoint limits and retries; the explorer handles its own indexing and search path.

Suppose the endpoint changes but the contract and requested Transfer history stay the same. A different provider may allow a larger range or respond faster, so fewer chunks might be needed. The deployment-block starting point and narrow filters still save work, and shared endpoints can still impose range, result or rate limits.

Related

What block range does eth_getLogs allow on common providers?

eth_getLogs has no universal block-range allowance across public providers. Each provider sets its own range and result caps, which can also vary by endpoint or service tier; consult the provider’s current documentation and adapt chunk sizes to its stated limits.

When should an indexer replace direct eth_getLogs calls?

An indexer should consider a dedicated indexing service when repeatedly scanning large histories or keeping event-derived state current becomes unreliable with the available endpoint limits. For a bounded history or occasional lookup, filtered chunks with backoff can be enough. Start at deployment, query only the events you need, and use the endpoint’s documented limits to set each range.