Quickstart
This 5-minute tutorial shows you how to build an indexer using Squid SDK. You’ll create a complete blockchain indexer that fetches, decodes, and serves USDC transfer data.What you’ll build
Your indexer (squid) will:- Fetch all historical USDC transfers on Ethereum from the SQD Network
- Decode the transfer events
- Save the data to a local PostgreSQL database
- Start a GraphQL server with a rich API to query the historical USDC transfers
This tutorial uses an EVM template. For other chains, see the Solana
Quickstart or Fuel
Quickstart.
Prerequisites
Before you begin, ensure you have:- Node.js v18+ - Download here
- Git - Download here
- Docker - Download here (for running PostgreSQL)
- WSL (Windows only) - Install WSL
Scaffold the indexer project
Create a new squid project from the USDC transfers example:
This example is a pre-configured GitHub repository that indexes USDC transfers
on Ethereum.
Inspect the project structure
Explore the project structure:The The data processing and storage logic:
Key files explained: -
src/abi/usdc.ts - Utility module generated from
the USDC contract ABI for event decoding and RPC queries - src/model/ -
TypeORM model classes auto-generated from schema.graphql for database
operations - main.ts - Main executable containing data retrieval
configuration and processing logicmain.ts file contains the core processor configuration:main.ts
main.ts
Install dependencies and build
Install dependencies and build the project:
Verify the build completed successfully by checking for the
lib/ directory.Start the database and processor
The processor continuously fetches data, decodes it, and stores it in PostgreSQL. All logic is defined in Apply database migrations:Then start the processor:
main.ts and is fully customizable.First, start a local PostgreSQL database (the template includes a Docker Compose file):The indexer is now running and will begin processing blocks.
Start the GraphQL API
Start the GraphQL API to serve the transfer data:
The GraphQL playground is available at
localhost:4350/graphql

