getProgramAccounts RPC Method

Returns all accounts owned by the provided program Pubkey

Request
$ curl https://api.devnet.solana.com -s -X \
> POST -H "Content-Type: application/json" -d '
> {
> "jsonrpc": "2.0",
> "id": 1,
> "method": "getProgramAccounts",
> "params": [
> "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
> {
> "filters": [
> { "dataSize": 17 },
> {
> "memcmp": {
> "offset": 4,
> "bytes": "3Mc6vR"
> }
> }
> ]
> }
> ]
> }
> '

params

stringrequired

Pubkey of program, as base-58 encoded string

objectoptional

Configuration object containing the following fields:

result

Response
{
"jsonrpc": "2.0",
"result": [
{
"pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY",
"account": {
"data": "2R9jLfiAQ9bgdcw6h8s44439",
"executable": false,
"lamports": 15298080,
"owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T",
"rentEpoch": 28,
"space": 42
}
}
],
"id": 1
}
array

By default, returns an array of JSON objects. If withContext flag is set, the array will be wrapped in an RpcResponse JSON object.

Each object contains:

Is this page helpful?