getProgramAccounts
SPL and SPL-2022 token GPA requests are served by a dedicated indexed cluster and have additional filter requirements. Requests that do not meet them are blocked — see below.
From now on, any SPL or SPL-2022 token GPA requests will be routed away from all the nodes and handled on a dedicated memory indexed server for those program accounts. This will prevent poorly formatted requests from negatively impacting the RPC node's performance. This solution is already been replicated and has redundancy built in as we have two servers running these solutions. Initial findings show an extremely faster response time for these GPA requests as opposed to before when the RPC nodes were fulfilling the requests. For those unfamiliar, this applies to the following token accounts for GPA requests:
TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
TokenzQdYV1iJj6g9VzBzzWJPKtnP1Ez5QnhrWcvbxC
The caveat is that anyone performing a GPA request for these accounts need to adhere to the following requirements to prevent your request from getting blocked: Must contain a filter in the GPA request, Must contain a datasize filter that is one of the known lengths for SPL & SPL-2022 tokens, When filtering for token accounts must contain at least one memcmp filter. Only the mint and the owner filters are supported. (offset=0 or offset=32),
These restrictions only apply to the SPL token and SPL-2022 token program accounts.
Returns all accounts owned by a given program. This method is useful for finding all accounts associated with a specific program, such as all token accounts for a particular token mint or all accounts created by a custom program. You can apply filters to narrow down the results. SPL/SPL2022 Token Program Requirements: When querying SPL or SPL2022 token programs, the configuration object must include: filters (array, required): An array of filters to apply to the accounts. Must contain the dataSize filter. Must be one of the known lengths for SPL/SPL2022 program accounts (mint= 82 , token= 165 ) or a larger value when filtering for SPL2022 accounts with extensions. When filtering for multisig accounts, the size must be 355 for accounts of both programs. When filtering for token accounts : Must contain at least one memcmp filter. Only the mint ( offset = 0 , 32 bytes data length) and the owner ( offset = 32 , 32 bytes data length) filters are supported. Parameters
programId(required) — Program pubkey, base-58.config(optional) — Optional configuration object. Every field is optional; omit the entire object to use defaults.
Pass Authorization: <api-key> on each request.
JSON-RPC protocol version.
2.0Possible values: Request identifier echoed back in the response.
1Must be getProgramAccounts.
getProgramAccountsPossible values: Successful getProgramAccounts response.
Base envelope of every JSON-RPC 2.0 response.
2.0Possible values: Echoed request id.
1Authentication required or invalid.
Insufficient permissions for the request.
Rate limit exceeded for this tier.
Unexpected server error.
curl -X POST https://public.rpc.solanavibestation.com \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"TokenkegQfeZyiNwAJsyFbPVwwQnLjMi6tsmbMrWcbq",
{
"encoding": "base64",
"filters": [
{
"dataSize": 165
}
]
}
]
}'{
"jsonrpc": "2.0",
"id": 1,
"result": [
{
"pubkey": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
"account": {
"lamports": 2039280,
"owner": "TokenkegQfeZyiNwAJsyFbPVwwQnLjMi6tsmbMrWcbq",
"executable": false,
"rentEpoch": 0,
"space": 165,
"data": [
"",
"base64"
]
}
}
]
}Last updated