getProgramAccountsConfig
Note: This is not a standard Solana JSON-RPC method. It is a configuration reference helper. See the linked method above for the actual RPC endpoint.
This is not a standard Solana JSON-RPC method. It serves as a configuration reference for the getProgramAccounts method, documenting the available filter options and configuration parameters in detail. Use the getProgramAccounts method with these configuration options to query program-owned accounts with specific filter criteria.
Parameters
This method does not accept any parameters.
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
encoding | string | Data encoding: base58, base64, base64+zstd, or jsonParsed |
dataSlice | object | { offset: number, length: number } - Limit returned data to a byte range |
filters | array | Array of filter objects to refine results |
filters[].memcmp | object | { offset: number, bytes: string, encoding?: string } - Compare bytes at a specific offset |
filters[].dataSize | number | Filter accounts by exact data size in bytes |
withContext | bool | Wrap result in an RpcResponse with slot context |
minContextSlot | number | Minimum slot at which the request can be evaluated |
Response
This is a configuration reference. See getProgramAccounts for the response format.
Code Examples
cURL
1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "method": "getProgramAccounts",
5 "params": [
6 "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
7 {
8 "encoding": "base64",
9 "filters": [
10 { "dataSize": 165 },
11 { "memcmp": { "offset": 32, "bytes": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg" } }
12 ],
13 "withContext": true
14 }
15 ]
16}'TypeScript
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 jsonrpc: "2.0",
6 id: 1,
7 method: "getProgramAccounts",
8 params: [
9 "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
10 {
11 encoding: "base64",
12 filters: [
13 { dataSize: 165 },
14 { memcmp: { offset: 32, bytes: "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg" } }
15 ],
16 withContext: true
17 }
18 ]
19 }),
20});
21const { result } = await response.json();
22console.log("Accounts found:", result.value.length);Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getProgramAccounts",
7 "params": [
8 "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
9 {
10 "encoding": "base64",
11 "filters": [
12 {"dataSize": 165},
13 {"memcmp": {"offset": 32, "bytes": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"}}
14 ],
15 "withContext": True
16 }
17 ]
18})
19result = response.json()["result"]
20print(f"Accounts found: {len(result['value'])}")Rust
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getProgramAccounts",
12 "params": [
13 "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
14 {
15 "encoding": "base64",
16 "filters": [
17 {"dataSize": 165},
18 {"memcmp": {"offset": 32, "bytes": "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"}}
19 ],
20 "withContext": true
21 }
22 ]
23 }))
24 .send().await?
25 .text().await?;
26 println!("{}", res);
27 Ok(())
28}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": {
4 "context": { "slot": 123456789 },
5 "value": [
6 {
7 "pubkey": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD",
8 "account": {
9 "data": ["base64data...", "base64"],
10 "executable": false,
11 "lamports": 2039280,
12 "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
13 "rentEpoch": 361,
14 "space": 165
15 }
16 }
17 ]
18 },
19 "id": 1
20}