Skip to main content

getProgramAccounts

POST

Returns all accounts owned by the provided program Pubkey
param[0]
pubkeyOfProgramstringrequired
Base-58 encoded Pubkey of the program to query
param[1]
configurationObjectobjectrequired
commitmentstring
The commitment describes how finalized a block is at that point in time.
  • finalized - the node will query the most recent block confirmed by supermajority of the cluster as having reached maximum lockout, meaning the cluster has recognized this block as finalized
  • confirmed - the node will query the most recent block that has been voted on by supermajority of the cluster.
  • processed - the node will query its most recent block. Note that the block may still be skipped by the cluster.
minContextSlotstring
The minimum slot that the request can be evaluated at.
withContextboolean
Wrap the result in an RpcResponse JSON object
encodingstring
Encoding format for the returned Account data
  • base58 is slow and limited to less than 129 bytes of Account data.
  • base64 will return base64 encoded data for Account data of any size.
  • base64+zstd compresses the Account data using Zstandard and base64-encodes the result.
  • jsonParsed encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data.
  • If jsonParsed is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the data field is type <string>.
dataSliceobject
Request a slice of the account's data. Data slicing is only available for base58, base64, or base64+zstd encodings.
offsetinteger
number of bytes to return
lengthinteger
byte offset from which to start reading
filtersarray
Filter results using up to 4 filter objects.
Responses
idinteger
The request ID
jsonrpcstring
The JSON-RPC version
pubkeystring
The account Pubkey as base-58 encoded string
dataarray
Data associated with the account, either as encoded binary data or JSON format {<program>: <state>} - depending on encoding parameter
executableboolean
Boolean indicating if the account contains a program (and is strictly read-only)
lamportsinteger
Number of lamports assigned to this account
ownerstring
Base-58 encoded Pubkey of the program this account has been assigned to
rentEpochinteger
The epoch at which this account will next owe rent
spaceinteger
The data size of the account
codestringrequired
Code identifying the cause of the failed request.
messagestringrequired
Detailed message including the name and value of the invalid parameter.
{
"code": "ERROR_CODE",
"message": "Bad Request"
}
cURL
curl -X POST 'https://solana-mainnet.nodit.io' \
-H 'Content-Type: application/json' \
-H 'X-API-KEY: nodit-demo' \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getProgramAccounts",
"params": [
"4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
{
"commitment": "finalized",
"encoding": "base58",
"filters": [
{
"dataSize": 17
},
{
"memcmp": {
"offset": 4,
"bytes": "3Mc6vR"
}
}
]
}
]
}'