← Protocols
Subsquid (SQD)
Indexing / Data·EVM · Solana · Bitcoin · Multi-chain

Subsquid (SQD)

01Description

Decentralized data lake and open-source Squid SDK for indexing 225+ chains across EVM, Solana, Substrate, Bitcoin, and Hyperliquid. Pre-filtered data is streamed from SQD Network gateways to a TypeScript processor that you deploy to SQD Cloud.

02Best for
  • 01high-throughput historical backfills
  • 02custom multi-chain indexers
  • 03GraphQL APIs over decoded events
  • 04Substrate / Solana / Bitcoin indexing
  • 05subgraph alternatives without GRT
03Install
  • npm i -g @subsquid/cli
  • sqd init my-squid -t https://github.com/subsquid-labs/showcase01-all-usdc-transfers
  • pnpm add @subsquid/evm-processor @subsquid/typeorm-store
04Environment variables
VariableScopeDescription
SQD_DEPLOY_KEYServerSQD Cloud deploy key from app.sqd.ai. Used by `sqd deploy` in CI; treat like a credential.
SQD_GATEWAY_URLServerOptional override for the SQD Network gateway URL when targeting a specific dataset (e.g. `https://v2.archive.subsquid.io/network/ethereum-mainnet`).
05Prompt snippet
Scaffold a squid with `sqd init <name> -t <template>`, define data requests in `src/processor.ts` using `EvmBatchProcessor` (or `SolanaBatchProcessor`/`SubstrateBatchProcessor`) and call `.setGateway(lookupArchive('eth-mainnet'))` plus `.addLog({ address: [...], topic0: [...] })`. Map blocks in `src/main.ts` with `processor.run(new TypeormDatabase(), async ctx => { ... })`, generate types with `sqd codegen`, then `sqd build && sqd deploy .` to SQD Cloud. Query the auto-generated GraphQL endpoint at the URL printed by `sqd deploy`, or expose custom REST handlers via the included Express server.
06Gotchas
  • SQD Network gateways stream data in batches of 1k–10k blocks — never assume single-block ordering inside a `ctx.blocks` iteration; aggregate then write once per batch to avoid TypeORM contention.
  • Free SQD Cloud tier caps deployments and storage; high-volume backfills (e.g. full Ethereum logs) require a paid Collaborator/Professional plan.
  • Non-EVM coverage (Solana, Substrate, Bitcoin) uses different processor classes and dataset names — verify the chain has a dataset at https://docs.sqd.ai/subsquid-network/reference/networks/ before committing.
  • Schema drift: changing `schema.graphql` requires `sqd codegen` AND a fresh DB (or migration); deploying with a mismatched schema will hard-fail on startup.
  • Indexing latency to chain head is typically 1–2 blocks via the gateway, but RPC ingestion mode (used for unsupported chains) can lag 10s+ — show `_meta.block.height` in the UI.
07Alternatives