Skip to main content

Solana SDK Reference

Complete API reference for building Solana blockchain indexers with Squid SDK’s SolanaBatchProcessor.

Batch Processor API

Data Types

Advanced Features

Overview

The SolanaBatchProcessor is the main class for indexing Solana blockchain data. It provides:
  • High-performance batch processing: Process thousands of blocks efficiently
  • Flexible data selection: Choose exactly what data you need
  • Type-safe interfaces: Full TypeScript support with generated types
  • Real-time sync: Near real-time indexing with chain reorganization handling

Basic Usage

main.ts
import { SolanaBatchProcessor } from "@subsquid/solana-processor";
import { TypeormDatabase } from "@subsquid/typeorm-store";

const processor = new SolanaBatchProcessor()
  .setGateway("https://v2.archive.subsquid.io/network/solana-mainnet")
  .setRpcEndpoint("<RPC_ENDPOINT_URL>")
  .setBlockRange({ from: 150000000 })
  .addInstruction({
    programId: ["<PROGRAM_ID>"],
    isCommitted: true,
  });

processor.run(new TypeormDatabase(), async (ctx) => {
  for (let block of ctx.blocks) {
    for (let instruction of block.instructions) {
      // Process instruction data
    }
  }
});
The Solana batch processor integrates seamlessly with SQD Network for fast historical data retrieval and falls back to RPC for real-time data.

Network API

Solana Network API

Learn about the SQD Network gateway for Solana
Start with the General Settings page to understand processor configuration, then explore specific data types based on your indexing needs.