getMultipleAccounts
Returns the account information for a list of Pubkeys

Parameters

  • <array of base-58 encoded strings> - An array of Pubkeys to query (up to a maximum of 100)
  • <object> - (optional) Config object:
    • 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 the transaction.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 provided offset: <usize> and length: <usize> fields; only available for "base58", "base64" or "base64+zstd" encodings.
    • minContextSlot: (optional) <number> - set the minimum slot that the request can be evaluated at.

Result

Pubkey Exists
Pubkey Does Not Exist
  • <object> - a JSON object:
    • lamports: <u64>, number of lamports assigned to this account
    • owner: < base-58 encoded string>, Pubkey of the program this account has been assigned to
    • data: <[string, encoding]|object>, data associated with the account, either as encoded binary data or JSON format {<program>: <state>}, depending on encoding parameter
    • executable: <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 rent
  • <null> - if the account at that Pubkey doesn't exist

Example

Request

cURL
1
curl --location --request POST 'https://solana-mainnet.g.alchemy.com/v2/demo/' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"jsonrpc": "2.0",
5
"id": 1,
6
"method": "getMultipleAccounts",
7
"params": [
8
[
9
"vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
10
"4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"
11
],
12
{
13
"dataSlice": {
14
"offset": 0,
15
"length": 0
16
}
17
}
18
]
19
}'
Copied!

Response

1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"context": {
5
"slot": 136100846
6
},
7
"value": [
8
{
9
"data": [
10
"",
11
"base64"
12
],
13
"executable": false,
14
"lamports": 410426055,
15
"owner": "11111111111111111111111111111111",
16
"rentEpoch": 314
17
},
18
{
19
"data": [
20
"",
21
"base64"
22
],
23
"executable": false,
24
"lamports": 2000000,
25
"owner": "11111111111111111111111111111111",
26
"rentEpoch": 314
27
}
28
]
29
},
30
"id": 1
31
}
Copied!