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

# JSON RPC Methods

> Photon indexer methods for querying compressed state on Solana.

<Note>
  The Light Token SDK calls these methods internally via interface functions
  like `transferInterface` and `getAtaInterface`. You rarely need to call
  them directly.

  Call these methods directly if you are building a block explorer,
  custom indexer, or working with
  [legacy compressed tokens](/resources/legacy-compressed-tokens).
</Note>

| Solana RPC              | Photon RPC                         |
| :---------------------- | :--------------------------------- |
| getAccountInfo          | getCompressedAccount               |
| getBalance              | getCompressedBalanceByOwner        |
| getAccountInfo          | getCompressedTokenAccountsByOwner  |
| getTokenAccountBalance  | getCompressedTokenBalancesByOwner  |
| getSignaturesForAddress | getCompressionSignaturesForAddress |
| getSignaturesForAddress | getCompressionSignaturesForOwner   |

## Create an RPC connection

<Tabs>
  <Tab title="Mainnet">
    ```typescript theme={null}
    // Helius exposes Solana and Photon RPC endpoints through a single URL
    import { createRpc, Rpc } from '@lightprotocol/stateless.js';

    const RPC_ENDPOINT = 'https://mainnet.helius-rpc.com?api-key=YOUR_KEY';
    const connection: Rpc = createRpc(RPC_ENDPOINT, RPC_ENDPOINT);
    ```
  </Tab>

  <Tab title="Devnet">
    ```typescript theme={null}
    import { createRpc, Rpc } from '@lightprotocol/stateless.js';

    // Helius exposes Solana and Photon RPC endpoints through a single URL
    const RPC_ENDPOINT = "https://devnet.helius-rpc.com?api-key=<api_key>";
    const connection: Rpc = createRpc(RPC_ENDPOINT, RPC_ENDPOINT);
    ```
  </Tab>
</Tabs>

## Best practices

| Best practice         | Description                                                                                                    |
| :-------------------- | :------------------------------------------------------------------------------------------------------------- |
| **Commitment levels** | Use appropriate commitment levels: `processed` (fastest), `confirmed` (balanced), `finalized` (most reliable). |
| **Rate limiting**     | Implement retry logic and respect rate limits. Public endpoints: 100 req/s, Private: 1000+ req/s.              |
| **Batch requests**    | Use batch requests when possible to reduce API calls.                                                          |
| **Caching**           | Cache frequently accessed data to reduce API calls.                                                            |

## Error codes

| Code   | Message              | Description                                   |
| :----- | :------------------- | :-------------------------------------------- |
| -32600 | Invalid Request      | The JSON sent is not a valid Request object.  |
| -32601 | Method not found     | The method does not exist / is not available. |
| -32602 | Invalid params       | Invalid method parameter(s).                  |
| -32603 | Internal error       | Internal JSON-RPC error.                      |
| -32000 | Account not found    | The compressed account was not found.         |
| -32001 | Invalid account hash | The provided account hash is invalid.         |

## Methods

These methods are called internally by the Light Token SDK. Call them
directly for custom indexing, block explorers, or debugging.

<table>
  <thead>
    <tr>
      <th width="30%" />

      <th />
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>[GetCompressedAccount](/api-reference/json-rpc-methods/getcompressedaccount)</td>
      <td>Returns a compressed account by address or hash.</td>
    </tr>

    <tr>
      <td>[GetCompressedAccountsByOwner](/api-reference/json-rpc-methods/getcompressedaccountsbyowner)</td>
      <td>Returns all compressed accounts for an owner.</td>
    </tr>

    <tr>
      <td>[GetCompressedBalanceByOwner](/api-reference/json-rpc-methods/getcompressedbalancebyowner)</td>
      <td>Returns the total compressed balance for an owner.</td>
    </tr>

    <tr>
      <td>[GetCompressedTokenAccountsByOwner](/api-reference/json-rpc-methods/getcompressedtokenaccountsbyowner)</td>
      <td>Returns all compressed token accounts for an owner.</td>
    </tr>

    <tr>
      <td>[GetCompressedTokenBalancesByOwner](/api-reference/json-rpc-methods/getcompressedtokenbalancesbyowner)</td>
      <td>Returns all token balances for compressed accounts owned by an address.</td>
    </tr>

    <tr>
      <td>[GetValidityProof](/api-reference/json-rpc-methods/getvalidityproof)</td>
      <td>Returns a validity proof for compressed state transitions.</td>
    </tr>

    <tr>
      <td>[GetCompressionSignaturesForAddress](/api-reference/json-rpc-methods/getcompressionsignaturesforaddress)</td>
      <td>Returns signatures for transactions involving an address.</td>
    </tr>

    <tr>
      <td>[GetCompressionSignaturesForOwner](/api-reference/json-rpc-methods/getcompressionsignaturesforowner)</td>
      <td>Returns signatures for transactions where an address is the owner.</td>
    </tr>

    <tr>
      <td>[GetTransactionWithCompressionInfo](/api-reference/json-rpc-methods/gettransactionwithcompressioninfo)</td>
      <td>Returns transaction details with compression context.</td>
    </tr>

    <tr>
      <td>[GetIndexerHealth](/api-reference/json-rpc-methods/getindexerhealth)</td>
      <td>Returns the health status of the Photon indexer.</td>
    </tr>

    <tr>
      <td>[GetIndexerSlot](/api-reference/json-rpc-methods/getindexerslot)</td>
      <td>Returns the current slot of the Photon indexer.</td>
    </tr>
  </tbody>
</table>

## Legacy

Methods for direct compressed-token workflows. Not called by the Light
Token SDK interface functions.

<table>
  <thead>
    <tr>
      <th width="30%" />

      <th />
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>[GetCompressedBalance](/api-reference/json-rpc-methods/getcompressedbalance)</td>
      <td>Returns the balance of a single compressed account.</td>
    </tr>

    <tr>
      <td>[GetCompressedMintTokenHolders](/api-reference/json-rpc-methods/getcompressedminttokenholders)</td>
      <td>Lists all holders of a compressed token mint.</td>
    </tr>

    <tr>
      <td>[GetCompressedTokenAccountBalance](/api-reference/json-rpc-methods/getcompressedtokenaccountbalance)</td>
      <td>Returns the token balance of a single compressed token account.</td>
    </tr>

    <tr>
      <td>[GetCompressedTokenAccountsByDelegate](/api-reference/json-rpc-methods/getcompressedtokenaccountbydelegate)</td>
      <td>Returns all compressed token accounts delegated to an address.</td>
    </tr>

    <tr>
      <td>[GetCompressionSignaturesForAccount](/api-reference/json-rpc-methods/getcompressionsignaturesforaccount)</td>
      <td>Returns signatures for transactions involving a compressed account.</td>
    </tr>

    <tr>
      <td>[GetCompressionSignaturesForTokenOwner](/api-reference/json-rpc-methods/getcompressionsignaturesfortokenowner)</td>
      <td>Returns signatures for token transactions by owner.</td>
    </tr>

    <tr>
      <td>[GetLatestCompressionSignatures](/api-reference/json-rpc-methods/getlatestcompressionsignatures)</td>
      <td>Returns the most recent compression-related signatures.</td>
    </tr>

    <tr>
      <td>[GetLatestNonVotingSignatures](/api-reference/json-rpc-methods/getlatestnonvotingsignatures)</td>
      <td>Returns recent non-voting transaction signatures.</td>
    </tr>

    <tr>
      <td>[GetMultipleCompressedAccounts](/api-reference/json-rpc-methods/getmultiplecompressedaccounts)</td>
      <td>Returns multiple compressed accounts in a single request.</td>
    </tr>

    <tr>
      <td>[GetMultipleNewAddressProofs](/api-reference/json-rpc-methods/getmultiplenewaddressproofs)</td>
      <td>Returns proofs that new addresses can be created.</td>
    </tr>
  </tbody>
</table>
