RPC examples
Copy-paste Solana JSON-RPC examples for getBalance, getAccountInfo, and getTransaction in TypeScript, Rust, Python, and curl.
// updated 2026-06-04
Copy-paste working examples for the four most common languages.
Prerequisites
- An active Supanode Bundle subscription or free trial. Don't have one? Contact @supanode_tgs on Telegram.
- Your server's public IP registered in the Bundle IP allowlist (set up via Telegram).
- The RPC endpoint URL (default:
http://fra.supanode.xyz:8899).
Authorization is by IP, not by token. Requests from any IP outside your whitelist are rejected.
Test connection
Before writing code, verify your endpoint is reachable from a whitelisted IP:
curl http://fra.supanode.xyz:8899 \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"getSlot"}'
If you get a JSON response with a result field containing a slot number, your IP is correctly allowlisted and the connection works.
Get account info
Fetches account balance and owner for a given address.
import { Connection, PublicKey } from "@solana/web3.js";
const connection = new Connection("http://fra.supanode.xyz:8899", {
commitment: "confirmed",
});
const accountAddress = new PublicKey("YOUR_ACCOUNT_PUBKEY");
const accountInfo = await connection.getAccountInfo(accountAddress);
console.log("Balance (lamports):", accountInfo?.lamports);
console.log("Owner:", accountInfo?.owner.toBase58());
Get recent transactions for an address
curl http://fra.supanode.xyz:8899 \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getSignaturesForAddress",
"params": ["YOUR_ACCOUNT_PUBKEY", {"limit": 10}]
}'
getSignaturesForAddress returns up to 1,000 signatures per call. Follow up with individual getTransaction calls for each signature you want details on.
Production tips
-
Reuse connections. HTTP keep-alive is on by default in most clients. Don't create a new client per request.
-
Make sure your IP doesn't drift. If your server uses NAT or rotating egress IPs, requests will fail intermittently. See Authentication for IP allowlist details.
-
Backoff on
429. Rate-limit responses include aRetry-Afterheader where possible. Implement exponential backoff starting at 1 second. -
Choose commitment carefully.
confirmedis the safe default.finalizedadds ~13 seconds of latency. -
Batch when you can.
getMultipleAccounts(up to 100 accounts per call) is much cheaper than 100 individualgetAccountInfocalls. -
Don't poll for live data. If you find yourself running a tight
getAccountInfoloop, switch to WebSocketaccountSubscribeor gRPCaccountsstream.