Onchain Data & Indexing What You Probably Got Wrong You try to query historical state via RPC calls. You can't cheaply read past state. reads current state. Reading state at a historical block requires an archive node (expensive, slow). For historical data, you need an indexer. You loop through blocks looking for events. Scanning millions of blocks with is O(n) — it will timeout, get rate-limited, or cost a fortune in RPC credits. Use an indexer that has already processed every block. You store query results onchain. Leaderboards, activity feeds, analytics — these belong offchain. Compute off…