Returns all accounts owned by the provided program Pubkey.
NOTE
This endpoint is available exclusively to users on paid subscription tiers.
Parameters
-
<base-58 encoded strings> - Pubkey of program
-
<object>
- (optional) Config object:-
pageKey:
(optional) <string> - Alchemy RPC Only key for pagination. If more results are available, a pageKey will be returned in the response. Pass back the pageKey as a param to fetch the next page of results. -
encoding:
(optional) <string> - data encoding for each returned transaction
Accepts one of the following strings:
["json"
(Default),"jsonParsed"
,"base58"
(slow),"base64",
"base64+zstd"
]
"jsonParsed"
encoding attempts to use program-specific parsers to make thetransaction.message.instructions
list more human-readable; if a parser cannot be found, the instruction falls back to default JSON. -
dataSlice:
(optional) <object> - limit the returned account data using the providedoffset: <usize>
andlength: <usize>
fields; only available for "base58", "base64" or "base64+zstd" encodings. -
filters:
(optional) <array> - filter results using various filter objects; account must meet all filter criteria to be included in resultsmemcmp:
<object> - compares a provided series of bytes with program account data at a particular offset. Fields:offset:
<usize> - offset into program account data to start comparisonbytes:
<string> - data to match, as base-58 encoded string and limited to less than 129 bytes
dataSize: <u64>
- compares the program account data length with the provided data size
-
withContext:
(optional) <bool> - wrap the result in an RpcResponse JSON object. -
minContextSlot:
(optional) <number> - set the minimum slot that the request can be evaluated at.
-
Result
pubkey:
<base-58 encoded string> - the account Pubkeyaccount:
<object> - a JSON object, with the following sub fieldslamports:
<u64>, number of lamports assigned to this accountowner:
< base-58 encoded string>, Pubkey of the program this account has been assigned todata:
<[string, encoding]|object>, data associated with the account, either as encoded binary data or JSON format{<program>: <state>}
, depending on encoding parameterexecutable:
<bool>, boolean indicating if the account contains a program (and is strictly read-only)rentEpoch:
<u64>, the epoch at which this account will next owe rentpageKey:
(optional) <string> - Alchemy RPC Only key for pagination. If more results are available, a pageKey will be returned in the response. Pass back the pageKey as a param to fetch the next page of results.
Example
Request
curl --location --request POST 'https://solana-mainnet.g.alchemy.com/v2/demo/' \
--header 'Content-Type: application/json' \
--data-raw '{
"method": "getProgramAccounts",
"jsonrpc": "2.0",
"params": [
"Stake11111111111111111111111111111111111111",
{
"encoding": "jsonParsed",
"commitment": "recent",
"filters": [
{
"memcmp": {
"offset": 44,
"bytes": "65qFmhCmDgXjg1duFdcpYyPheWyWGyusZhy3Y8khMoYm"
}
}
]
}
],
"id": "566965b3-7c1a-4338-b424-430b3240976e"
}'
Response
{
"jsonrpc": "2.0",
"result": [
{
"account": {
"data": "2R9jLfiAQ9bgdcw6h8s44439",
"executable": false,
"lamports": 15298080,
"owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
"rentEpoch": 28
},
"pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"
}
],
"id": 1
}