Documentation index

getProgramAccounts

Returns all accounts owned by the provided program public key. This is one of the most powerful RPC methods, enabling applications to scan for all accounts created by a specific program. It supports filters by data size and memcmp (memory comparison) to narrow results. This method is essential for DeFi protocols, NFT marketplaces, and any application that needs to enumerate program state across the network.

Parameters

#TypeRequiredDescription
1stringYesBase-58 encoded public key of the program to query
2objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
commitmentstringCommitment level: processed, confirmed, or finalized
encodingstringData encoding: base58, base64, base64+zstd, or jsonParsed
dataSliceobjectLimit returned data: { offset: number, length: number }
filtersarrayArray of filter objects: { memcmp: { offset, bytes } } or { dataSize: number }
withContextboolWrap result in an RpcResponse with context
minContextSlotnumberMinimum slot at which the request can be evaluated

Response

Returns an array of account objects:

FieldTypeDescription
[].pubkeystringBase-58 encoded public key of the account
[].account.lamportsu64Number of lamports in the account
[].account.ownerstringProgram owner of the account
[].account.data[string, string]object
[].account.executableboolWhether the account is executable
[].account.rentEpochu64Epoch at which rent is next owed
[].account.spaceu64Data size of the account

Code Examples

cURL

Terminal
curl http://88.216.36.108:7999 -X POST -H "Content-Type: application/json" -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getProgramAccounts",
  "params": [
    "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
    {
      "encoding": "jsonParsed",
      "filters": [
        { "dataSize": 165 },
        { "memcmp": { "offset": 32, "bytes": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg" } }
      ]
    }
  ]
}'

TypeScript

TypeScript
const response = await fetch("http://88.216.36.108:7999", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getProgramAccounts",
    params: [
      "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
      {
        encoding: "jsonParsed",
        filters: [
          { dataSize: 165 },
          { memcmp: { offset: 32, bytes: "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg" } }
        ]
      }
    ]
  }),
});
const { result } = await response.json();
console.log("Accounts found:", result.length);

Python

Python
import requests

response = requests.post("http://88.216.36.108:7999", json={
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getProgramAccounts",
    "params": [
        "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
        {
            "encoding": "jsonParsed",
            "filters": [
                {"dataSize": 165},
                {"memcmp": {"offset": 32, "bytes": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"}}
            ]
        }
    ]
})
result = response.json()["result"]
print(f"Accounts found: {len(result)}")

Rust

Rust
use reqwest::Client;
use serde_json::json;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = Client::new();
    let res = client.post("http://88.216.36.108:7999")
        .json(&json!({
            "jsonrpc": "2.0",
            "id": 1,
            "method": "getProgramAccounts",
            "params": [
                "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
                {
                    "encoding": "jsonParsed",
                    "filters": [
                        {"dataSize": 165},
                        {"memcmp": {"offset": 32, "bytes": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"}}
                    ]
                }
            ]
        }))
        .send().await?
        .text().await?;
    println!("{}", res);
    Ok(())
}

Example Response

JSON
{
  "jsonrpc": "2.0",
  "result": [
    {
      "pubkey": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD",
      "account": {
        "data": { "parsed": {}, "program": "spl-token", "space": 165 },
        "executable": false,
        "lamports": 2039280,
        "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
        "rentEpoch": 361,
        "space": 165
      }
    }
  ],
  "id": 1
}