Skip to main content
TLDR:
  • You’ll build a complete blockchain indexing backend using Ponder and Chainstack nodes.
  • You’ll create a Ponder project that indexes ERC-20 token transfers and balances across multiple chains.
  • You’ll configure Ponder to use Chainstack RPC endpoints for reliable data fetching.
  • By the end, you’ll have a production-ready GraphQL API for querying blockchain data with hot reloading and type safety.

Main article

In this tutorial, you will:
  • Create a Ponder project that indexes blockchain data from multiple networks.
  • Configure Ponder to use Chainstack nodes for reliable, high-performance data access.
  • Build a schema to track ERC-20 token transfers, balances, and holder statistics.
  • Deploy indexing functions that process blockchain events in real-time.
  • Query your data through Ponder’s auto-generated GraphQL API.
Ponder is an open-source framework for building blockchain application backends. Unlike traditional indexing solutions, Ponder provides end-to-end type safety, hot reloading during development, and automatic GraphQL API generation based on your schema.

Prerequisites

Dependencies

  • ponder: ^0.11.0
  • viem: ^2.30.0
  • typescript: ^5.0.0

Step-by-step

Create a public chain project

See Create a project.

Join blockchain networks

For this tutorial, we’ll index data from multiple chains. Join the following networks:
  • Ethereum - for established DeFi protocols
  • Polygon - for high-volume, low-cost transactions
  • Base - for modern L2 applications
See Join a public network.

Get your node access and credentials

See View node access and credentials. You’ll need the RPC endpoints for each network you joined.

Create a new Ponder project

  1. Create a new Ponder project using the CLI:
    This will prompt you to choose a template. For this tutorial, select “ERC-20” as it provides a good starting point for token indexing.
  2. Navigate to your project directory:
  3. Install dependencies:

Configure environment variables

  1. Create a .env.local file in your project root:
    Replace the placeholder values with your actual Chainstack endpoints.

    Environment variable naming

    Ponder uses the pattern PONDER_RPC_URL_{CHAIN_ID} for RPC endpoints. The chain IDs are:
    • Ethereum: 1
    • Polygon: 137
    • Base: 8453

Configure Ponder for multiple chains

  1. Edit ponder.config.ts to configure your chains and contracts:
    This configuration sets up Ponder to index USDC transfers across three different chains using your Chainstack nodes.

    Start block optimization

    Setting appropriate start blocks is crucial for performance. Choose blocks close to when your contracts were deployed or when interesting activity began.

Define your database schema

  1. Edit ponder.schema.ts to define the data structure you want to track:
    This schema defines three tables:
    • transfers: Individual transfer events
    • balances: Current token balances per account
    • tokenStats: Aggregate statistics per token contract

Write indexing functions

  1. Create indexing functions to process Transfer events. Replace the contents of src/index.ts:
    This indexing logic:
    • Records every transfer event across all three chains
    • Maintains real-time balance tracking for all accounts
    • Handles historical data gaps when starting from an arbitrary block (accounts may have balances from before the start block)
    • Tracks holder counts by detecting when balances go from zero to positive (new holder) or positive to zero (holder exit)
    • Calculates aggregate statistics including transfer volume and holder statistics per token contract

Start the development server

  1. Start the Ponder development server:
    You should see output similar to:

    Development features

    Ponder’s development server includes:
    • Hot reloading when you change config, schema, or indexing functions
    • Real-time progress monitoring and error reporting
    • Built-in GraphQL playground at http://localhost:42069
  2. Open your browser to http://localhost:42069 to access the GraphQL playground.

Query your indexed data

  1. In the GraphQL playground, try these example queries: Get recent transfers across all chains:
    Get top holders for a specific token:

Deploy to production

  1. For production deployment, you’ll need a PostgreSQL database. Update your .env.local:
  2. Build your Ponder application:
  3. Start the production server:
    Your Ponder application will be available at the configured port with a production-ready GraphQL API.

Conclusion

This tutorial guided you through building a comprehensive blockchain indexing backend using Ponder and Chainstack. You’ve created a system that:
  • Indexes data from multiple blockchain networks simultaneously
  • Provides type-safe, real-time data processing
  • Offers a production-ready GraphQL API
  • Scales efficiently with Chainstack’s reliable infrastructure
The combination of Ponder’s developer experience and Chainstack’s enterprise-grade blockchain infrastructure provides a robust foundation for building modern Web3 applications.

About the author

Ake

Ake Director of Developer Experience @ Chainstack
Talk to me all things Web3
20 years in technology | 8+ years in Web3 full time years experience
Last modified on April 13, 2026