indexing

Index onchain events via The Graph and provider APIs for historical queries.

1|Updated Apr 25, 2026
One-click install
npx skills add https://github.com/collat-labs/collat --skill indexing-collat-labs
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: indexing
Source: https://github.com/collat-labs/collat/tree/main/.agents/skills/ethskills/indexing
Command: npx skills add https://github.com/collat-labs/collat --skill indexing-collat-labs

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you understand how to read and query historical onchain activity without inefficient block-scanning RPC calls, so your dApp and analytics can reliably fetch past events.

Core Features & Use Cases

  • Event-first contract design: Emphasizes emitting Solidity events as the primary API for frontends and indexers.
  • Indexing strategies for history: Explains why direct RPC reads only cover current state and how indexers solve historical queries.
  • Production-grade options: Covers The Graph (subgraphs), plus alternatives like Dune Analytics, provider APIs (Alchemy/Etherscan), and WebSocket for real-time updates.

Quick Start

Use the indexing skill to design an event-first contract and choose between The Graph, Dune Analytics, provider APIs, or RPC/event subscriptions based on your query needs and expected block scan volume.

Frequently Asked Questions about indexing

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

FAQPage Schema
How do I query historical onchain data without expensive RPC block scanning?

To query historical onchain data efficiently, replace expensive RPC block scanning with event-driven indexing approaches using indexers like The Graph. This solves historical queries by capturing Solidity events, enabling reliable access to past events for dashboards and dApp backends.

What is the best way to build a dApp backend for contracts that emit events across historical time ranges?

The best way to build a dApp backend for event-emitting contracts is using event-first Solidity design combined with an indexing strategy. Utilize The Graph subgraphs or Dune Analytics to query historical time ranges, supplemented by WebSocket subscriptions for real-time updates.

How does event-first contract design help with indexing onchain data?

Event-first contract design helps indexing onchain data by emphasizing Solidity events as the primary API for frontends and indexers. This allows tools like The Graph to efficiently capture and query historical onchain activity instead of relying on direct RPC reads that only cover current state.

When should I use The Graph versus provider APIs like Etherscan or Alchemy for onchain data?

Use The Graph for comprehensive event-driven indexing across historical time ranges, and use provider APIs like Etherscan or Alchemy as fallbacks. Choose based on your specific query needs and expected block scan volume to ensure efficient onchain data access for analytics or activity feeds.

Can I use WebSocket subscriptions for real-time updates alongside historical onchain indexing?

Yes, you can use WebSocket subscriptions for real-time updates alongside historical onchain indexing. Combining indexers like The Graph for past events with WebSocket subscriptions ensures your dApp backends and dashboards receive both reliable historical data and live event updates.