Indexing on Solana
HyperIndex indexes Solana programs at the instruction level. You select the programs and instructions you care about, HyperIndex decodes them — arguments and accounts — using your Anchor IDL or an inline schema, and writes the results to Postgres with an auto-generated GraphQL API. Inner instructions (CPIs), token balances and balance changes, transaction metadata and program logs are all available.
It is powered by HyperSync for Solana, the same high-performance data engine behind EVM indexing, so historical backfills are fast and you never touch an RPC node for the bulk of indexing.
Solana support is experimental and pre-release. The program/instruction
config surface (programs_experimental) may change, indexers are
TypeScript-only, and the indexer tracks finalized data (no reorg
handling — see below). The APIs documented here are
the latest in active development. If you're building on Solana, say hello on
Discord — we can tell you which pieces are stable,
which are moving, and often suggest a better data path for your use case.
Two ways to index Solana
| Approach | API | Data source | Use it for |
|---|---|---|---|
| Instruction handlers | indexer.onInstruction | HyperSync | The main path — decode and index program instructions (swaps, deposits, mints, transfers…), including inner/CPI instructions, with token balance changes. |
| Slot handlers | indexer.onSlot | RPC (via the Effect API) | Per-slot orchestration, time-series snapshots, or pulling extra data from RPC on a schedule. |
Most indexers use instruction handlers. Slot handlers are for cases where you need to run logic on a slot cadence rather than react to a specific instruction. For raw, low-level data you can also query HyperSync for Solana directly.
Quickstart
pnpx envio init
Choose Solana when prompted, then pick a starter template (a Metaplex NFT instruction indexer, or a minimal slot handler). See Getting Started for the full walkthrough.
Mental model: coming from EVM?
If you've used HyperIndex on EVM, the shift is mostly vocabulary:
| EVM | Solana |
|---|---|
| Contract + ABI | Program + IDL |
Event (onEvent) | Instruction (onInstruction) |
event.params | event.instruction.decoded.args |
| Topic0 / event signature | Instruction discriminator |
Block (onBlock) | Slot (onSlot) |
Hex addresses 0x… | Base58 addresses |
start_block = block number | start_block = slot number |
See EVM vs Solana for the full picture.
What's supported today
- Instruction indexing via
indexer.onInstruction— match by program + discriminator. - IDL-aware decoding — point at a standard Anchor IDL (legacy or 0.30+) and HyperIndex derives the argument and account layout. No IDL? Declare an inline schema.
- Inner instructions (CPIs) — decoded the same way as top-level ones, with a full instruction-address path so you can reconstruct the call tree.
- Token balances & balance changes — pre/post SPL Token (and Token-2022) balances per transaction, so you get the net token movement without indexing every transfer. See token balances.
- Transaction metadata & logs — fee payer, fee, compute units, success, signatures, and per-instruction program logs (opt-in via field selection).
- Slot handlers via
indexer.onSlot+ the Effect API for RPC enrichment. - Local dev + GraphQL + Envio Cloud — the same workflow and hosting as EVM.
What is not supported yet
- Reorg handling. Solana indexers track finalized data only; there is no rollback-on-reorg. Expect a short latency at the head.
- Native SOL balance fields on handlers. Pre/post token balances are surfaced today; native SOL (lamport) balances are available via HyperSync directly but not yet as a handler field-selection toggle.
- Account-change subscriptions. There is no
onAccount/program-account handler. Account state is available only as the accounts referenced by an instruction (plus per-transaction token balances). - A separate log handler. Logs are a field on the instruction event, not their own handler.
- No-code contract import. Solana has no
contract-importflow — you configure programs/instructions by hand. (IDLs are wired up inconfig.yaml, not auto-imported.) - ReScript. Solana indexers are TypeScript only.
- Per-field selection. Field-selection toggles accept
trueonly, not field name lists (yet).
If the piece you need is on this list, tell us on Discord — there's a good chance we can sequence the work to unblock you, or point you at a HyperSync-direct path that gets the data today.
In this section
- Getting Started — scaffold and run your first Solana indexer.
- Configuration — the
config.yamlreference forecosystem: svm. - Instruction Handlers —
onInstruction, the event object, token balances, CPIs, testing. - Decoding & IDLs — discriminators, Anchor IDLs, inline schemas, supported types.
- Slot Handlers —
onSlotand RPC enrichment. - EVM vs Solana — every difference in one place.