Skip to main content
The API exposed by the indexer closely mirrors existing RPC calls, with one-to-one mapping:
Solana RPCPhoton RPC Calls
getAccountInfogetCompressedAccount
getBalancegetCompressedBalance
getTokenAccountsByOwnergetCompressedTokenAccountsByOwner
getProgramAccountsgetCompressedAccountsByOwner

View all RPC endpoints for ZK Compression

Create an RPC Connection

  • Mainnet
  • Devnet
import {
  Rpc,
  createRpc,
} from "@lightprotocol/stateless.js";

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

console.log("connection", connection);

Best Practices

Best PracticeDescription
Commitment LevelsUse appropriate commitment levels: processed (fastest), confirmed (balanced), finalized (most reliable)
Rate LimitingImplement retry logic and respect rate limits. Public endpoints: 100 req/s, Private: 1000+ req/s
Batch RequestsUse batch requests when possible to improve efficiency and reduce API calls
CachingCache frequently accessed data to reduce API calls and improve performance

Error Codes

For help with debugging useAsk DeepWiki
CodeMessageDescription
-32600Invalid RequestThe JSON sent is not a valid Request object
-32601Method not foundThe method does not exist / is not available
-32602Invalid paramsInvalid method parameter(s)
-32603Internal errorInternal JSON-RPC error
-32000Account not foundThe compressed account was not found
-32001Invalid account hashThe provided account hash is invalid

Next Steps

View all RPC endpoints for ZK Compression