indexing

Query historical onchain data using events, The Graph subgraphs, and indexing APIs.

1|Updated Sep 4, 2025
One-click install
npx skills add https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO --skill indexing-fuzzystodd
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: indexing
Source: https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO/tree/main/skills/indexing
Command: npx skills add https://github.com/FuzzysTodd/The-Nexus-Protocol-Token-DAO --skill indexing-fuzzystodd

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Reading historical blockchain data is not possible with plain RPC calls: eth_call only reads current state, and scanning millions of blocks with eth_getLogs times out or burns RPC credits. This Skill explains how to read onchain history correctly using events, indexers, and provider APIs. ## Core Features & Use Cases - Event-First Contract Design: Guidance on emitting and indexing Solidity events so frontends, dashboards, and block explorers can query every state change. - The Graph Subgraphs: Step-by-step schema, mapping, and deployment workflow for turning contract events into a queryable GraphQL API. - Indexer Selection: Comparison of The Graph, Dune Analytics, Alchemy/QuickNode APIs, Ponder, and direct RPC, with a pattern table mapping common needs (activity feeds, NFT browsers, price history) to the right tool. - Use Case: You are building an NFT collection browser. Instead of scanning blocks, deploy a subgraph that indexes Transfer events, then query token ownership and transfer history via GraphQL in milliseconds. ## Quick Start Ask the assistant to design an event schema and The Graph subgraph for your smart contract so its historical activity becomes queryable via GraphQL.

Frequently Asked Questions about indexing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I query historical blockchain data without scanning blocks?▼

Use an indexer like The Graph instead of looping through blocks with eth_getLogs. You define a subgraph that processes your contract's events into entities, deploy it, and query the indexed history through a GraphQL API instantly.

What is The Graph and when should I use it?▼

The Graph is a decentralized indexing protocol that turns contract events into a queryable GraphQL API. Use it whenever your dApp needs historical data such as activity feeds, leaderboards, or transfer history that would require scanning more than roughly 10,000 blocks.

The Graph vs Dune Analytics vs Alchemy APIs for onchain data?▼

The Graph suits production dApp backends needing a decentralized GraphQL API. Dune Analytics is best for SQL-based dashboards and ad-hoc analytics. Alchemy APIs like getTokenBalances and getNftsForOwner handle quick common queries but are centralized.

Can I read past contract state with eth_call?▼

No, eth_call reads current state only. Reading state at a historical block requires an archive node, which is expensive and slow. For historical data, emit events from your contract and index them offchain with a tool like The Graph.

How many indexed fields can a Solidity event have?▼

A Solidity event supports up to 3 indexed topics. Reserve them for fields you will filter by, such as addresses and IDs like seller, buyer, or listingId, and leave large or non-filtered values unindexed.

How do I get real-time updates for new contract events?▼

Subscribe to events over WebSocket using viem's watchContractEvent with a wss transport. This streams new logs as they occur, which is suitable for live monitoring rather than historical queries.