Practical overview
When it fits
Use it when you want a terminal-based Rust example for a specific Solana operation and can supply the endpoint, public keys, and—where required—a signer keypair.
Who it is for
- Developers learning how Rust programs interact with Solana.
- Developers who want command-line examples for specific wallet, token, NFT or account-inspection tasks.
Documented uses
- Generate a wallet and print its public key and private-key representations.
- Create an SPL token mint, mint tokens, or check an associated token balance.
- Find an NFT owner or list NFT mint addresses held by a wallet.
- Inspect an account creation timestamp, listen for slot updates, or fetch an on-chain Anchor IDL.
- Transfer SOL with a memo and priority fee, or wrap SOL into the signer’s WSOL associated token account.
Requirements & limits
- The documented entry point is
cargo run --. - Chain queries and operations require the command-specific Solana RPC URL; the pubsub command uses a WebSocket URL.
- Transaction commands require a signer keypair, and minting additionally requires that signer to be the mint authority.
- The new-wallet command prints private-key material in Base58 and JSON formats.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Check an associated SPL token balance
Print the balance for a wallet and SPL token mint using the documented command.
Before you start
- A Solana RPC endpoint
- The wallet public key
- The SPL token mint account public key
- The Rust project available to run with Cargo
Steps
Choose an RPC endpoint and collect the wallet and mint public keys.
Run the command below.
cargo run -- associated-token-balance --rpc-url --wallet-pubkey --mint-account-pubkey
Expected outcome
The command prints the associated token account balance.
Guide limitations
- The command requires the RPC URL and both public keys.
- The documentation describes the command but does not provide a broader wallet or token-management workflow.
Listen for Solana slot updates
Listen to slotSubscribe events and print a specified number of updates.
Before you start
- A Solana WebSocket endpoint
- The Rust project available to run with Cargo
Steps
Choose a Solana WebSocket endpoint.
Run the command below with the desired number of updates.
cargo run -- pubsub --ws-url --count
Expected outcome
The command listens for slotSubscribe events and prints updates up to the requested count.
Guide limitations
- The command requires a WebSocket endpoint; the documented default count is five.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 17 October 2026
- Original website title
- ronanyeah/solana-rust-examples · Official homepage title · retained in its source language

