> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sqd.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Solana

> Index Solana data with SQD

<Info>Solana on Portal is available from genesis and uses slots, not blocks. V2 archives (legacy) are available starting from block 269,828,500 (block, not slot).</Info>

| Property   | Value            |
| ---------- | ---------------- |
| Network ID | `solana-mainnet` |
| Real-time  | Yes              |

## Endpoint

<Tabs>
  <Tab title="Portal (recommended)">
    ```
    https://portal.sqd.dev/datasets/solana-mainnet
    ```
  </Tab>

  <Tab title="v2 archives (legacy)">
    <Warning>
      Will be sunset soon. [Migrate to Portal →](/en/portal/migration)
    </Warning>

    ```
    https://v2.archive.subsquid.io/network/solana-mainnet
    ```
  </Tab>
</Tabs>

## Quick start

```bash theme={"system"}
curl --compressed -X POST \
  'https://portal.sqd.dev/datasets/solana-mainnet/stream' \
  -H 'Content-Type: application/json' \
  -d '{
    "type": "solana",
    "fromBlock": 0,
    "toBlock": 100,
    "fields": {
      "block": { "number": true, "timestamp": true },
      "instruction": { "programId": true, "data": true }
    },
    "instructions": [{}]
  }'
```

For full SDK examples:

<CardGroup cols={2}>
  <Card title="Pipes SDK Quickstart" icon="bars-staggered" href="/en/sdk/pipes-sdk/solana/quickstart">
    Streaming pipeline indexer
  </Card>

  <Card title="Squid SDK Quickstart" icon="server" href="/en/sdk/squid-sdk/quickstart">
    GraphQL API indexer
  </Card>
</CardGroup>

## Schema

<AccordionGroup>
  <Accordion title="Transactions">
    | Field              | Type    | Description                   |
    | ------------------ | ------- | ----------------------------- |
    | `index`            | integer | Transaction index in block    |
    | `signature`        | string  | Transaction signature         |
    | `account_keys`     | array   | Account keys involved         |
    | `recent_blockhash` | string  | Recent blockhash used         |
    | `fee`              | integer | Transaction fee               |
    | `success`          | boolean | Whether transaction succeeded |
    | `error`            | object  | Error information if failed   |
  </Accordion>

  <Accordion title="Instructions">
    | Field                | Type    | Description              |
    | -------------------- | ------- | ------------------------ |
    | `index`              | integer | Instruction index        |
    | `transaction_index`  | integer | Parent transaction index |
    | `program_id`         | string  | Program ID               |
    | `accounts`           | array   | Accounts involved        |
    | `data`               | string  | Instruction data         |
    | `inner_instructions` | array   | Inner instructions       |
  </Accordion>

  <Accordion title="Balances">
    | Field     | Type   | Description                |
    | --------- | ------ | -------------------------- |
    | `account` | string | Account address            |
    | `pre`     | bigint | Balance before transaction |
    | `post`    | bigint | Balance after transaction  |
  </Accordion>

  <Accordion title="Token Balances">
    | Field         | Type    | Description                |
    | ------------- | ------- | -------------------------- |
    | `account`     | string  | Token account              |
    | `mint`        | string  | Token mint address         |
    | `owner`       | string  | Owner address              |
    | `pre_amount`  | bigint  | Balance before transaction |
    | `post_amount` | bigint  | Balance after transaction  |
    | `decimals`    | integer | Token decimals             |
  </Accordion>

  <Accordion title="Rewards">
    | Field         | Type    | Description               |
    | ------------- | ------- | ------------------------- |
    | `pubkey`      | string  | Recipient account         |
    | `lamports`    | bigint  | Reward amount in lamports |
    | `reward_type` | string  | Type of reward            |
    | `commission`  | integer | Commission percentage     |
  </Accordion>

  <Accordion title="Logs">
    | Field                 | Type    | Description                  |
    | --------------------- | ------- | ---------------------------- |
    | `transaction_index`   | integer | Parent transaction index     |
    | `instruction_address` | array   | Instruction path             |
    | `program_id`          | string  | Program that emitted the log |
    | `kind`                | string  | Log kind                     |
    | `message`             | string  | Log message                  |
  </Accordion>
</AccordionGroup>

## Reference

<CardGroup cols={2}>
  <Card title="API Reference" icon="code" href="/en/portal/solana/api">
    Field definitions and query syntax
  </Card>

  <Card title="Portal Migration" icon="arrow-right" href="/en/portal/migration">
    Migrate from v2 archives to Portal
  </Card>
</CardGroup>
