eth_getLogs failing with 429 or “block range too large”: pay with x402, no signup
A free public RPC fails a log scan in two ways:429 Too Many Requests once you go faster than its shared limit, and “block range too large” once a query spans more blocks than that one provider accepts.
The fix that finishes today: point the script at an endpoint that spreads requests across several providers, with a rate limit of your own, and split ranges when it tells you to. Lasso sells that endpoint for a few cents over x402 or MPP, with no account to create.
1. Buy a funded key in one paid request
402 Payment Required, with an x402 challenge in PAYMENT-REQUIRED and an MPP challenge in WWW-Authenticate. Pay it with any x402 client (USDC on Base) or MPP client (Tempo) by repeating the same request with the signed payment. One purchase buys $0.05 to $100.
The paid response returns key.rpc_url_template. Replace {chain} with load-balanced/ethereum, the strategy meant for bulk reads, and keep the URL secret: it carries the key. Resubmitting the same signed payment shows the same key again, so a lost response loses nothing.
2. Point the script at it
3. Split ranges on Lasso’s range error
Each provider caps how many blocks oneeth_getLogs may span, and Lasso learns those caps from live traffic. When a range is still too large, Lasso answers with a standard JSON-RPC error your loop can act on:
code: -32602,error.data.code: "log_range_limit";error.data.max_block_rangewith a size that fits, ornullwhen unknown.
address to the filter when you can: when every provider refuses an address-less query, Lasso reports log_filter_refused. Each successful response is one provider’s answer; if you need every log, reconcile against a second source.
4. What it costs
eth_getLogs is $0.000075 a call on load-balanced. $1 covers about 13,000 calls. An address-less query that every provider refuses is free. If the balance runs out mid-scan, the error carries error.data.credit_url; pay it the same way to top up, and the key keeps working.