Solana CLI Usage Reference
The Solana CLI is a powerful toolset for developers, validators, and power users to interact with the Solana blockchain.
Beyond simple wallet and balance commands, it offers access to validator data, network health, block production, and configuration control.
⚙️ Environment & Configuration
View Active Configuration
solana config get
Displays:
RPC Endpoint
WebSocket Endpoint
Keypair Path
Commitment Level
Set RPC Cluster
solana config set --url https://api.devnet.solana.com
Common RPCs:
Devnet:
https://api.devnet.solana.com
Testnet:
https://api.testnet.solana.com
Mainnet:
https://api.mainnet-beta.solana.com
Set Wallet Keypair
solana config set --keypair ~/.config/solana/id.json
Define which keypair the CLI should use to sign transactions.
Generate a New Wallet
solana-keygen new --outfile ~/.config/solana/new-wallet.json
🔐 Always back up your keypair safely and use hardware wallets for production.
View Wallet Address
solana-keygen pubkey
Prints the public key from the currently configured wallet.
💰 Wallet & Airdrops
Airdrop SOL (Devnet/Testnet Only)
solana airdrop 2 <ADDRESS>
Send test tokens to a wallet. Omit <ADDRESS>
to airdrop to current wallet.
Check Wallet Balance
solana balance
Returns the SOL balance for the configured wallet.
Transfer SOL
solana transfer <RECIPIENT_ADDRESS> <AMOUNT> --allow-unfunded-recipient --url https://api.devnet.solana.com
Add --fee-payer
to specify another wallet that pays for transaction fees.
🛰️ Blockchain Data Queries
View Account Data
solana account <ADDRESS>
Returns raw on-chain account information including:
Lamports
Owner Program
Data length
View Recent Blockhash
solana block
Shows the latest blockhash for manual signing workflows.
Get Transaction Details
solana confirm <TRANSACTION_SIGNATURE>
Shows status, slot number, and confirmation level.
Fetch Recent Transactions (Historical RPC Support Required)
solana transaction-history <ADDRESS>
🧭 Epoch, Slot, and Leader Info
Epoch Info
solana epoch-info
Displays current epoch, slot progress, and leader schedule.
Slot Info
solana slot
Outputs the current slot on the network.
Leader Schedule
solana leader-schedule
Lists current validator leader rotation schedule.
📦 Stake & Validator Operations
List Validators
solana validators
Shows validator identity, vote accounts, commission, and more.
Stake Account Details
solana stake-account <STAKE_ACCOUNT_ADDRESS>
Returns staking status, delegated validator, and activation state.
Create Stake Account
solana-keygen new --outfile stake-keypair.json
solana create-stake-account stake-keypair.json <AMOUNT>
Delegate Stake
solana delegate-stake stake-keypair.json <VALIDATOR_VOTE_ADDRESS>
🔎 Diagnostics & Debugging
Network Ping
solana ping <ADDRESS>
Tests connectivity and latency to the cluster.
Show CLI Version
solana --version
Compute Program Size & Fees
solana program dump <PROGRAM_ID> ./dump.so
Useful to analyze deployed BPF bytecode.
📁 File System & Permissions
Recommended Wallet Location
~/.config/solana/id.json
Set strict file permissions:
chmod 600 ~/.config/solana/id.json
🧠 Common Pitfalls & Solutions
RPC timeout or rate limit
Try switching to another public or private RPC
"Account not found" error
Create an associated token account or check funding
Wallet not recognized
Run solana config get
and verify keypair path
Airdrop fails
Confirm you're on devnet/testnet and wallet exists
🧾 Reference Command Summary
View config
solana config get
Change RPC
solana config set --url <RPC>
Set wallet
solana config set --keypair <KEYPAIR_PATH>
Generate wallet
solana-keygen new
Airdrop SOL
solana airdrop 2 <ADDRESS>
Check balance
solana balance
Transfer SOL
solana transfer <TO> <AMOUNT>
Check epoch info
solana epoch-info
Query transaction
solana confirm <TX_SIGNATURE>
List validators
solana validators
For complete CLI docs and updates, visit the official Solana reference: https://docs.solana.com/cli
Last updated