> For the complete documentation index, see [llms.txt](https://docs.envio.dev/llms.txt).

# Indexing on Solana

HyperIndex indexes Solana programs at the **instruction level**. You select the
programs and instructions you care about, HyperIndex decodes their arguments and
accounts from an IDL (Anchor, Shank or Codama) or a layout you declare, and
writes the results to Postgres with an auto-generated GraphQL API. Inner
instructions (CPIs), **account balance activity**, transaction metadata and
program logs are all available.

It is powered by [HyperSync for Solana](/docs/HyperSync/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.

:::info Stable since v3.11
The SVM API - configuration, handlers and payload types - is final and follows
semver like the rest of HyperIndex. Building on Solana?
[Say hello on Discord](https://discord.gg/envio); we'd love your input on what
to prioritize next.
:::

## Two ways to index Solana

| Approach | API | Data source | Use it for |
| --- | --- | --- | --- |
| **Instruction handlers** | [`indexer.onInstruction`](/docs/HyperIndex/solana/instruction-handlers) | HyperSync | The main path: decode and index program instructions (swaps, deposits, mints, transfers…), including inner/CPI instructions, with per-account balance activity. |
| **Slot handlers** | [`indexer.onSlot`](/docs/HyperIndex/solana/slot-handlers) | RPC (via the [Effect API](/docs/HyperIndex/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](/docs/HyperSync/solana) directly.

## Quickstart

```bash
pnpx envio init
```

Choose **Solana** when prompted, then pick the USDC Transfers template - a
working SPL Token instruction indexer with tests. See
[Getting Started](/docs/HyperIndex/solana/getting-started) for the full walkthrough.

The HyperSync endpoint comes from the chain id, so there's nothing to configure
beyond picking a `start_slot` - see
[choosing a start slot](/docs/HyperIndex/solana/configuration#choosing-an-endpoint-and-a-start-slot).

## 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`) |
| Block (`onBlock`) | Slot (`onSlot`) |
| `event.params` | `instruction.args` |

[EVM vs Solana](/docs/HyperIndex/solana/evm-vs-solana) has the full mapping.

## What's supported today

- **Instruction indexing** via [`indexer.onInstruction`](/docs/HyperIndex/solana/instruction-handlers): match by program + discriminator.
- **IDL-aware decoding**: point at an Anchor (legacy or 0.30+), Shank or Codama IDL and every instruction it declares becomes indexable, with its arguments and account names. No IDL? [Declare the layout yourself](/docs/HyperIndex/solana/decoding#inline-layout-no-idl).
- **Inner instructions (CPIs)**: decoded the same way as top-level ones, with a full instruction path so you can reconstruct the call tree.
- **Account activity**: pre/post lamport and SPL Token (and Token-2022) balances per account, so you get net value movement without indexing every transfer. See [account activity](/docs/HyperIndex/solana/instruction-handlers#account-activity).
- **Transaction metadata & logs**: fee payer, fee, compute units, success, the transaction signature, and per-instruction program logs (opt-in via the handler's [`fields`](/docs/HyperIndex/solana/instruction-handlers#selecting-fields) option).
- **Slot handlers** via [`indexer.onSlot`](/docs/HyperIndex/solana/slot-handlers) + the [Effect API](/docs/HyperIndex/effect-api) for RPC enrichment.
- **Local dev + GraphQL + Envio Cloud**: the same workflow and hosting as EVM.

## What is not supported yet

These are gaps in the built-in instruction-handler surface, not hard limits: for
most of them you can still pull the data yourself by calling out to RPC from a
handler with the [Effect API](/docs/HyperIndex/effect-api), you just don't get
it as a struct field for free.

- **Account-change subscriptions.** There is no `onAccount`/program-account handler. `instruction.accounts` gives you the accounts an instruction touched and, with `fields.accountActivity`, their pre/post lamport and token balances for that transaction - but not arbitrary account state. For that, read the account over RPC in a handler with the [Effect API](/docs/HyperIndex/effect-api).
- **A separate log handler.** Logs are a field on the instruction, not their own handler.
- **Dynamic registration.** No Solana equivalent of [dynamic contracts](/docs/HyperIndex/dynamic-contracts): programs are declared in `config.yaml`, not registered at runtime.
- **Wildcard indexing across programs.** A registration always names one program.
- **No-code contract import.** Solana has no `contract-import` flow, so you configure programs by hand. (IDLs are wired up in `config.yaml`, not auto-imported.)
- **ReScript.** Solana indexers are TypeScript only. Codegen emits no ReScript for `ecosystem: svm`, and `envio init` silently picks TypeScript if you ask for ReScript.

If the piece you need is on this list, [tell us on Discord](https://discord.gg/envio): there's a good chance we can sequence the work to unblock you, or point you at a [HyperSync-direct](/docs/HyperSync/solana) path that gets the data today.

## In this section

- **[Getting Started](/docs/HyperIndex/solana/getting-started)**: scaffold and run your first Solana indexer.
- **[Instruction Handlers](/docs/HyperIndex/solana/instruction-handlers)**: `onInstruction`, the instruction object, account activity, CPIs, testing.
- **[Decoding Instructions](/docs/HyperIndex/solana/decoding)**: IDLs, discriminators, inline layouts, supported types.
- **[Slot Handlers](/docs/HyperIndex/solana/slot-handlers)**: `onSlot` and RPC enrichment.
- **[Configuration](/docs/HyperIndex/solana/configuration)**: the `config.yaml` reference for `ecosystem: svm`.
- **[EVM vs Solana](/docs/HyperIndex/solana/evm-vs-solana)**: every difference in one place.
