Core RPC Methods
The essential read methods every Solana client uses: account info, balances, program scans, and batch fetches.
Search across all documentation pages
The essential read methods every Solana client uses: account info, balances, program scans, and batch fetches.
Quick-reference recipe card - copy-paste ready.
import { createSolanaRpc, address } from "@solana/kit";
const rpc = createSolanaRpc("https://api.devnet.solana.com");
await rpc.getAccountInfo(pubkey, { encoding: "base64" }).send();
await rpc.getBalance(pubkey).send();
await rpc.getMultipleAccounts([pk1, pk2]).send();
await rpc.getProgramAccounts(programId, { encoding: "base64" }).send();When to reach for this:
import { createSolanaRpc, address } from "@solana/kit";
const rpc = createSolanaRpc("https://api.devnet.solana.com");
const SYSTEM_PROGRAM = address("11111111111111111111111111111111");
const wallet = address("YOUR_WALLET_PUBKEY");
const [balance, accountInfo, multi] = await Promise.all([
rpc.getBalance(wallet, { commitment: "confirmed" }).send(),
rpc.getAccountInfo(SYSTEM_PROGRAM, { encoding: "base64" }).send(),
rpc.getMultipleAccounts([wallet, SYSTEM_PROGRAM], {
commitment: "confirmed",
encoding: "base64",
}).send(),
]);
console.log({
lamports: balance.value,
systemExecutable: accountInfo.value?.executable,
multiCount: multi.value?.length,
});What this demonstrates:
getBalance returns lamports for system-owned wallets.getAccountInfo returns owner, lamports, data, executable flag.getMultipleAccounts batches up to provider limits in one RPC round trip.commitment and encoding options.base64 encoding is standard for binary program data; jsonParsed works for some SPL programs on supporting nodes.getProgramAccounts without filters scans entire program space - expensive on mainnet.value means account does not exist at chosen commitment.| Method | Returns | Cost |
|---|---|---|
getAccountInfo | Single account | Low |
getBalance | Lamports only | Low |
getMultipleAccounts | Up to N accounts | Medium |
getProgramAccounts | All matching accounts | High without filters |
// Prefer address() helper for base58 pubkeys
import { address, assertIsAddress } from "@solana/kit";
const mint = address("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
assertIsAddress(mint);value: null crashes naive parsers. Fix: null-check before decoding.base64.getMultipleAccounts length. Fix: chunk into batches of 100 or per provider docs.confirmed refresh. Fix: poll or subscribe after transactions.
| Alternative | Use When | Don't Use When |
|---|---|---|
DAS getAsset | NFT/compressed metadata | Custom program accounts |
| Geyser/Yellowstone | Indexer-scale streaming | Simple wallet balance |
solana account CLI | One-off debugging | Production app reads |
| Helius enhanced APIs | Parsed token balances | Provider lock-in unacceptable |
base64 for generic program data; jsonParsed when provider documents SPL support for your account type.
Depends on provider - chunk 50-100 pubkeys per call as a safe default.
Yes - total lamports in the account; token accounts hold separate balances per mint.
Scans all accounts owned by program - always add filters on mainnet.
Yes - point RPC URL at http://127.0.0.1:8899.
Use Anchor/codama clients or Borsh layouts matching on-chain structs.
confirmed after user transactions; processed only for low-stakes live counters.
No server-side cache guarantees - treat as live read; add your own TTL cache carefully.
getProgramAccounts scans by owner program; getMultipleAccounts fetches explicit pubkeys you already know.
Yes - pass encoding: "base64" in params objects with full TypeScript checking.
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 19, 2026