RPC Patterns
Talk to validators via JSON-RPC and pubsub. Results appear in the same fence: same-line // comments when short, multiline // blocks below the sample when not.
Search across all documentation pages
Talk to validators via JSON-RPC and pubsub. Results appear in the same fence: same-line // comments when short, multiline // blocks below the sample when not.
Single account fetch.
// connection.getAccountInfo(pubkey, "confirmed")Batch account reads.
// connection.getMultipleAccountsInfo(pubkeys)Poll confirmation statuses.
// connection.getSignatureStatuses([sig])Websocket program logs.
// connection.onLogs(programId, cb, "confirmed")processed < confirmed < finalized.
// commitment: "confirmed"List token accounts.
// connection.getParsedTokenAccountsByOwner(owner, { programId: TOKEN_PROGRAM_ID })Scan program accounts - use wisely (filters/GQL indexers).
// connection.getProgramAccounts(programId, { filters })Fetch partial account data.
// dataSlice: { offset: 0, length: 32 }Parsed account data for known programs.
// encoding: "jsonParsed"Sample priority fees.
// connection.getRecentPrioritizationFees()Slot updates over ws.
// connection.onSlotChange(cb)Auth RPC with headers when required.
// new Connection(url, { httpHeaders: { Authorization: "..." } })Backoff and cache reads under public RPCs.
// retry with jitter on 429Cluster epoch info.
// connection.getEpochInfo()Node version string.
// connection.getVersion()Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, Rust 1.91.1, and @solana/kit 7.0.0.
Reviewed by Chris St. John·Last updated Jul 18, 2026