Skip to main content
Helius Labs maintains the canonical RPC API and Photon indexer implementation.
Interact with compressed accounts directly with the ZK Compression JSON RPC API. It’s a thin wrapper extending Solana’s web3.js Connection class with compression-related endpoints. The API exposed by the indexer closely mirrors existing RPC calls, with one-to-one mapping:
Solana RPCPhoton RPC Calls
getAccountInfogetCompressedAccount
getBalancegetCompressedBalance
getTokenAccountsByOwnergetCompressedTokenAccountsByOwner
getProgramAccountsgetCompressedAccountsByOwner

Creating an RPC Connection

Ask anything about the ZK Compression RPC API viaAsk DeepWiki
Connect to a specific RPC endpoint
  • 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

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

Mainnet ZK Compression JSON RPC Methods

GetCompressedAccount

Retrieves information about a specific compressed account by its address or hash.

GetCompressedAccountsByOwner

Returns all compressed accounts owned by a specific address.

GetCompressedBalance

Retrieves the balance of a compressed account.

GetCompressedBalanceByOwner

Gets the total balance of all compressed accounts owned by an address.

GetCompressedMintTokenHolders

Lists all holders of a specific compressed token mint.

GetCompressedTokenAccountBalance

Retrieves the token balance of a compressed token account.

GetCompressedTokenAccountsByDelegate

Returns all compressed token accounts delegated to a specific address.

GetCompressedTokenAccountsByOwner

Lists all compressed token accounts owned by a specific address.

GetCompressedTokenBalancesByOwner

Retrieves all token balances for compressed accounts owned by an address.

GetCompressionSignaturesForAccount

Returns signatures for transactions involving a compressed account.

GetCompressionSignaturesForAddress

Retrieves signatures for transactions involving a specific address.

GetCompressionSignaturesForOwner

Returns signatures for transactions where an address is the owner.

GetCompressionSignaturesForTokenOwner

Lists signatures for transactions involving tokens owned by an address.

GetIndexerHealth

Returns the health status of the compression indexer.

GetIndexerSlot

Retrieves the current slot of the compression indexer.

GetLatestCompressionSignatures

Returns the most recent transaction signatures related to compression.

GetLatestNon-VotingSignatures

Retrieves recent non-voting transaction signatures.

GetMultipleCompressedAccounts

Retrieves multiple compressed accounts in a single request.

GetMultipleNewAddressProofs

Returns proofs that the new addresses are not taken already and can be created.

GetTransactionWithCompressionInfo

Returns transaction details with additional compression-related information.

GetValidityProof

Retrieves a validity proof for compressed data.