Skip to content

Guide: Index blockchain events with The Graph for dApps #27

@PetarStoev02

Description

@PetarStoev02

Description

Guide showing how to use The Graph protocol to index and query smart contract events — the decentralized alternative to running your own indexer.

Why this matters

The 32-hour course uses The Graph for the NFT marketplace frontend. Every serious dApp needs indexed event data — transaction history, NFT ownership, DeFi positions. Scanning logs directly is slow and expensive. The Graph provides a GraphQL API over indexed events.

Scope

  • What is The Graph and why indexing matters
  • Subgraph definition (schema, mappings, manifest)
  • Deploying a subgraph to The Graph's hosted/decentralized service
  • Querying subgraphs from TypeScript with GraphQL
  • Subgraph Studio vs self-hosted
  • Common subgraph patterns (NFT ownership, DeFi events, token transfers)
  • Alternatives to The Graph (Goldsky, Envio, custom indexers)

w3-kit approach

  • Focus on the TypeScript querying side (most devs consume, not create, subgraphs)
  • GraphQL client setup with type safety
  • Practical: query Uniswap, Aave, or OpenSea subgraphs
  • When to use The Graph vs direct event polling

Acceptance criteria

  • Guide in guides/
  • Subgraph creation walkthrough
  • TypeScript GraphQL querying examples
  • Comparison of indexing solutions
  • .learn.md explaining how The Graph's decentralized indexing works (curators, indexers, delegators)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions