///Snippet library
Copy. Paste. Ship.
Working recipes for the Solana RPC API calls you make every day. Each one uses standard JSON-RPC or PubSub methods: swap YOUR-ENDPOINT for your own URL and run it.
01
Check a wallet balance
The smallest useful Solana RPC call. Returns lamports; divide by 1e9 for SOL.
curlCurious mindsgetBalancecurl
Learn the concept: What is a Solana RPC node? →get-balance.sh
bash
02
Compare slots across commitment levels
Ask the same node for its processed, confirmed and finalized slot to see the gap between them.
TypeScriptDevelopersgetSlotcommitment
Learn the concept: Slots, blocks and commitment levels, explained →slots.ts
typescript
03
Stream new slots over WebSocket
Open a PubSub connection and print every slot as the node processes it. Includes a keep-alive ping.
JavaScriptTradersslotSubscribewebsocket
Learn the concept: 5 ways to get real-time Solana data, compared →slot-subscribe.mjs
javascript
04
List a wallet's recent transactions
Pull the latest signatures for an address and flag the failed ones. A starting point for wallet analytics.
PythonData analystsgetSignaturesForAddresspython
history.py
python
From lesson to live data
Run these against a real endpoint.
Every snippet works with a standard Solana RPC, WebSocket or gRPC endpoint. Get yours in under a minute.