solana-rpc-toolkit
Query Solana mainnet through the Helius RPC — current slot, SOL and token balances, transactions, blocks. Zero dependencies.
$ skillbank install solana-rpc-toolkit@1.0.0 # pins exactly 1.0.0 · README + changelog included
Overview
A zero-dependency Python CLI for the most-used Solana JSON-RPC methods, routed through Helius. No SDK, no npm, no virtualenv required — just Python 3.9+ and an API key. Handy for agents and scripts that need quick chain reads: slot height, wallet balances, SPL token accounts, transaction details, and block contents.
Installation
- Copy the
solana-rpc-toolkit/directory anywhere on yourPATH, or keep
it next to your project.
- Make the script executable (Unix):
``bash chmod +x scripts/solana.py ``
- Get a free API key at https://www.helius.dev and export it:
``bash export HELIUS_API_KEY="your-key-here" ``
No pip install needed — the script uses only the Python standard library.
Configuration
| Variable | Required | Description |
|---|---|---|
HELIUS_API_KEY | yes | Your Helius API key (free tier is fine). |
The key is sent as the api-key query parameter to https://mainnet.helius-rpc.com/, exactly how Helius documents it. The key is never printed, logged, or written anywhere by this tool.
Inputs
| Command | Arguments | Returns |
|---|---|---|
slot | — | Current slot number (int). |
balance | <base58-address> | SOL balance in lamports (int). |
token-accounts | <owner-address> | SPL token accounts with balances. |
tx | <signature> | Transaction detail (JSON). |
block | <slot> | Block contents (JSON). |
call | <method> [<params-json-array>] | Raw RPC passthrough for any method. |
All commands print JSON to stdout and exit non-zero with the provider's error on stderr when the RPC call fails.
Worked example
$ export HELIUS_API_KEY="..."
$ ./scripts/solana.py slot
326418805
$ ./scripts/solana.py balance 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
193420000
$ ./scripts/solana.py token-accounts 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU | head -c 300
{"context": {"slot": 326418810}, "value": [{"account": {...}, ...}]}...
$ ./scripts/solana.py call getHealth
"ok"
Safety notes
Read-only by design: every bundled command is a chain *read*. The generic call passthrough can invoke any RPC method, including sendTransaction — never pipe untrusted input into it, and keep your key out of shell history (prefer an env file or secret manager over export on shared machines).
Version history
- v1.0.02026-09-26
- Initial public release.
- Commands:
slot,balance,token-accounts,tx,block, plus rawcallpassthrough for any RPC method. - Auth via
HELIUS_API_KEYenvironment variable; zero dependencies (stdliburllibonly). - Tested against Helius mainnet:
getSlot,getBalance,getTokenAccountsByOwner,getTransaction,getBlock,getHealthall return expected shapes.