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

Define which keypair the CLI should use to sign transactions.

Generate a New Wallet

πŸ” Always back up your keypair safely and use hardware wallets for production.

View Wallet Address

Prints the public key from the currently configured wallet.


πŸ’° Wallet & Airdrops

Airdrop SOL (Devnet/Testnet Only)

Send test tokens to a wallet. Omit <ADDRESS> to airdrop to current wallet.

Check Wallet Balance

Returns the SOL balance for the configured wallet.

Transfer SOL

Add --fee-payer to specify another wallet that pays for transaction fees.


πŸ›°οΈ Blockchain Data Queries

View Account Data

Returns raw on-chain account information including:

  • Lamports

  • Owner Program

  • Data length

View Recent Blockhash

Shows the latest blockhash for manual signing workflows.

Get Transaction Details

Shows status, slot number, and confirmation level.

Fetch Recent Transactions (Historical RPC Support Required)


🧭 Epoch, Slot, and Leader Info

Epoch Info

Displays current epoch, slot progress, and leader schedule.

Slot Info

Outputs the current slot on the network.

Leader Schedule

Lists current validator leader rotation schedule.


πŸ“¦ Stake & Validator Operations

List Validators

Shows validator identity, vote accounts, commission, and more.

Stake Account Details

Returns staking status, delegated validator, and activation state.

Create Stake Account

Delegate Stake


πŸ”Ž Diagnostics & Debugging

Network Ping

Tests connectivity and latency to the cluster.

Show CLI Version

Compute Program Size & Fees

Useful to analyze deployed BPF bytecode.


πŸ“ File System & Permissions

Set strict file permissions:


🧠 Common Pitfalls & Solutions

Problem
Fix

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

Action
Command

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