getMultipleAccounts RPC Method
Parameters
array
string
Loading...
object
object
Loading...
commitment
string
Loading...
encoding
string
Loading...
dataSlice
string
Loading...
minContextSlot
integer
Loading...
Returns
result
Loading...
context
Loading...
apiVersion
Loading...
slot
Loading...
value
Loading...
data
Loading...
executable
Loading...
lamports
Loading...
owner
Loading...
rentEpoch
Loading...
space
Loading...
Request
curl https://docs-demo.solana-mainnet.quiknode.pro/ \ -X POST \ -H "Content-Type: application/json" \ --data '{"jsonrpc": "2.0","id": 1,"method": "getMultipleAccounts","params": [["vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg","4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"],{"dataSlice": {"offset": 0,"length": 0}}]}'
require "uri" require "json" require "net/http" url = URI("https://docs-demo.solana-mainnet.quiknode.pro/") https = Net::HTTP.new(url.host, url.port) https.use_ssl = true request = Net::HTTP::Post.new(url) request["Content-Type"] = "application/json" request.body = JSON.dump({ "jsonrpc": "2.0", "id": 1, "method": "getMultipleAccounts", "params": [ [ "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA" ], { "dataSlice": { "offset": 0, "length": 0 } } ] }) response = https.request(request) puts response.read_body
import { createSolanaRpc, address } from "@solana/kit"; (async () => { const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/"); const publicKey1 = address("vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg"); const publicKey2 = address("4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"); try { const accountsInfo = await solanaRpc.getMultipleAccounts([publicKey1, publicKey2]).send(); console.log(accountsInfo); } catch (error) { console.error("Error fetching multiple accounts info:", error); } })();
const web3 = require("@solana/web3.js"); (async () => { const publicKey = new web3.PublicKey( "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg" ); const solana = new web3.Connection("https://docs-demo.solana-mainnet.quiknode.pro/"); const publicKey2 = new web3.PublicKey( "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA" ); console.log(await solana.getMultipleAccountsInfo([publicKey, publicKey2])); })();
from jsonrpcclient import request, parse, Ok import logging import requests response = requests.post("https://docs-demo.solana-mainnet.quiknode.pro/", json=request("getMultipleAccounts", params=[["vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg","4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA"],{"dataSlice": {"offset": 0,"length": 0}}])) parsed = parse(response.json()) if isinstance(parsed, Ok): print(parsed.result) else: logging.error(parsed.message)
use reqwest::header; use reqwest::Client; use std::error::Error; #[tokio::main] async fn main() -> Result<(), Box<dyn Error>> { let mut headers = header::HeaderMap::new(); headers.insert("Content-Type", "application/json".parse().unwrap()); let client = Client::new(); let json_data = r#" { "jsonrpc": "2.0", "id": 1, "method": "getMultipleAccounts", "params": [ [ "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA" ], { "dataSlice": { "offset": 0, "length": 0 } } ] } "#; let response = client .post("https://docs-demo.solana-mainnet.quiknode.pro/") .headers(headers) .body(json_data) .send() .await?; let body = response.text().await?; println!("{}", body); Ok(()) }
Response
{ "jsonrpc": "2.0", "result": { "context": { "apiVersion": "2.1.21", "slot": 335501794 }, "value": [ null, { "data": [ "", "base64" ], "executable": false, "lamports": 2000000, "owner": "11111111111111111111111111111111", "rentEpoch": 18446744073709552000, "space": 80 } ] }, "id": 1 }
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free