Solana CLI Basics
10 examples to get you started with the Solana CLI - 7 basic and 3 intermediate.
Search across all documentation pages
10 examples to get you started with the Solana CLI - 7 basic and 3 intermediate.
Install the Agave toolchain (Solana CLI 3.0.10 ships with Agave 4.1.1):
sh -c "$(curl -sSfL https://release.anza.xyz/v4.1.1/install)"
solana --version
# solana-cli 3.0.10Add the install directory to your PATH if the installer prompts you. You need a default keypair before sending transactions - see Keypairs with solana-keygen.
Confirm the CLI and cluster tooling match your pinned stack.
solana --version
agave-install --versionsolana-cli 3.0.10 when aligned with Agave 4.1.1.agave-install (see Version Management).Related: Toolchain Overview - how the pieces fit together
See which RPC URL, keypair, and commitment level the CLI uses.
solana config getRPC URL is where every command sends JSON-RPC requests.Keypair Path is the signing identity for transfers and deploys.Commitment defaults to confirmed - good for dev workflows.Related: RPC Basics - commitment levels explained
Switch the CLI to Solana's public devnet for free airdrops and testing.
solana config set --url devnet
solana config getdevnet resolves to the public devnet RPC endpoint.mainnet-beta only when you intend to spend real SOL.Related: Airdrops & Balances - fund your dev wallet
Target a solana-test-validator instance on your machine.
solana config set --url http://127.0.0.1:8899
solana config get8899 is the default JSON-RPC port for solana-test-validator.Related: solana-test-validator - start a local cluster
Tell the CLI which keypair signs outgoing transactions.
solana config set --keypair ~/.config/solana/id.json
solana addresssolana address prints the public key derived from the keypair file.Related: Keypairs with solana-keygen - generate and recover keys
Read lamports for the configured keypair.
solana balance
solana balance <PUBKEY>Related: Airdrops & Balances - request devnet SOL
Verify the RPC endpoint is reachable and producing slots.
solana cluster-version
solana slotcluster-version confirms the validator software version on the cluster.slot returns the current slot - if it stalls, your RPC may be unhealthy.Related: RPC Providers - when to use a dedicated RPC
Route the CLI through a provider URL while keeping the same commands.
solana config set --url "https://devnet.helius-rpc.com/?api-key=YOUR_KEY"
solana config get
solana slotRelated: RPC Providers - provider trade-offs
Tune how finalized a read must be before the CLI returns.
solana config set --commitment finalized
solana config getprocessed is fastest but can roll back on forks.confirmed is the default sweet spot for dev and most scripts.finalized is safest for treasury operations but slower.Related: RPC Basics - commitment semantics
Capture settings so CI and teammates use the same cluster and keypair.
solana config get --json > solana-config.json
cat solana-config.jsonagave-install version pins for reproducibility.Related: Solana CLI Best Practices - repeatable team workflows
Stack versions: This page was written for Agave 4.1.1, Solana CLI 3.0.10, Anchor 0.32.1, anchor-lang 0.32.1, Rust 1.91.1, @solana/kit 7.0.0, Surfpool 0.12.0, and LiteSVM 0.6.x.
Reviewed by Chris St. John·Last updated Jul 16, 2026