Skip to main content

Solana Clusters

Solana operates multiple clusters for different purposes:
  • Mainnet Beta - Production network with real economic value
  • Testnet - Stable testing network with public access
  • Devnet - Development network for developers and validators to test
  • Localhost - Local test validator for development
For detailed information about each cluster, see the Solana documentation on available clusters.

Check Current Configuration

View the CLI’s current cluster configuration:
solana config get
Output:
Config File: /home/solana/.config/solana/cli/config.yml
RPC URL: https://api.devnet.solana.com
WebSocket URL: wss://api.devnet.solana.com/ (computed)
Keypair Path: /home/solana/.config/solana/id.json
Commitment: confirmed
The RPC URL field shows which cluster the CLI is currently targeting.

Set Cluster Target

Use solana config set --url to change the target cluster. After setting a cluster, all subsequent commands will interact with that cluster.

Devnet

Connect to Devnet (recommended for development):
solana config set --url https://api.devnet.solana.com
Devnet is ideal for:
  • Testing applications
  • Learning Solana development
  • Obtaining free test tokens via airdrop
  • Validator testing

Testnet

Connect to Testnet:
solana config set --url https://api.testnet.solana.com
Testnet provides:
  • More stable environment than Devnet
  • Testing before mainnet deployment
  • Public validator participation

Mainnet Beta

Connect to Mainnet Beta (production network):
solana config set --url https://api.mainnet-beta.solana.com
Mainnet Beta involves real SOL with real economic value. Test thoroughly on Devnet or Testnet before deploying to Mainnet.

Localhost

Connect to a local test validator:
solana config set --url http://localhost:8899
Useful for:
  • Local development
  • Fast iteration without network latency
  • Testing without network constraints

Cluster Monikers

The CLI supports short moniker names for clusters:
solana config set --url mainnet-beta
# or just
solana config set --url m

Custom RPC Endpoints

You can connect to custom RPC endpoints:
solana config set --url https://your-custom-rpc.com
This is useful for:
  • Using private RPC providers
  • Connecting to custom clusters
  • Using high-performance RPC services
Many projects use dedicated RPC providers for improved reliability and performance:
  • Helius
  • QuickNode
  • Triton
  • Alchemy
  • Ankr
Some RPC providers require authentication. Check provider documentation for connection details.

WebSocket Configuration

The CLI automatically computes the WebSocket URL from the RPC URL. To set a custom WebSocket endpoint:
solana config set --ws wss://your-custom-ws.com
View current WebSocket URL:
solana config get websocket_url

Version Compatibility

Ensure your CLI version matches or exceeds the cluster version for best compatibility.
1

Check local CLI version

solana --version
Output:
solana-cli 2.0.0 (src:00000000; feat:123456789, client:Agave)
2

Check cluster version

solana cluster-version
Output:
2.0.0
3

Compare versions

The local CLI version should be greater than or equal to the cluster version.If your CLI is outdated, update it:
agave-install update
While not strictly required, version mismatches can cause compatibility issues or prevent access to newer features.

Verify Connectivity

After configuring a cluster, verify connectivity:

Get Cluster Version

solana cluster-version
Successful connection returns the version:
2.0.0

View Cluster Nodes

solana cluster-nodes
Displays all validators in the cluster:
IP Address      | Identity                                     | Version | Vote Account
----------------+----------------------------------------------+---------+---------------------------------------------
192.0.2.1:8001  | 8nP3jDvPwhTzv8VpE4pRi8pJGhhtC5T9kB8aU9Ltzfsg | 2.0.0   | 9QU2QSxhb24FUX3Tu2FpczXjpK3VYrvRudywSZaM29mF

Get Epoch Info

solana epoch-info
Shows current epoch information:
Block height: 123456789
Slot: 98765432
Epoch: 456
Transaction Count: 123456789012
Epoch Slot Range: [98765000..98820000]
Epoch Completed Percent: 45.12%
Epoch Completed Slots: 55432/55000 (100.79%)
Epoch Completed Time: 2d 3h 45m 12s / 4d 8h 0m 0s

Check Slot

solana slot
Returns current slot number:
98765432

Per-Command Cluster Override

Override the configured cluster for a single command using the --url flag:
solana balance <ADDRESS> --url devnet
This doesn’t change your configuration:
# Check balance on devnet
solana balance <ADDRESS> --url devnet

# Check balance on mainnet (without changing config)
solana balance <ADDRESS> --url mainnet-beta

# Current config remains unchanged
solana config get
Useful for:
  • Comparing data across clusters
  • One-off operations on different clusters
  • Scripts that need to query multiple clusters

Configuration Profiles

Manage multiple configurations using separate config files.

Create Multiple Configs

solana config set --url devnet --keypair ~/wallet-dev.json
cp ~/.config/solana/cli/config.yml ~/.config/solana/cli/config-devnet.yml

Switch Configs

Use the -C flag to specify a config file:
# Use devnet config
solana -C ~/.config/solana/cli/config-devnet.yml balance

# Use mainnet config
solana -C ~/.config/solana/cli/config-mainnet.yml balance

Set Default Config

Symlink your preferred config:
ln -sf ~/.config/solana/cli/config-devnet.yml ~/.config/solana/cli/config.yml

Commitment Levels

Configure the commitment level for transaction confirmation:
solana config set --commitment <LEVEL>
Available commitment levels:
  • processed - Fastest, query the most recent block
  • confirmed - Balance between speed and finality (default)
  • finalized - Slowest, maximum finality guarantee
solana config set --commitment processed

Per-Command Commitment

Override for a single command:
solana balance <ADDRESS> --commitment finalized

Common Cluster Operations

Get Cluster Stats

solana validators
Displays detailed validator information:
Identity                                     | Vote Account                                 | Commission | Last Vote    | Stake
---------------------------------------------+----------------------------------------------+------------+--------------+-------------------
8nP3jDvPwhTzv8VpE4pRi8pJGhhtC5T9kB8aU9Ltzfsg | 9QU2QSxhb24FUX3Tu2FpczXjpK3VYrvRudywSZaM29mF | 10%        | 98765432     | 1234567.890000000 SOL

Get Leader Schedule

solana leader-schedule
Shows upcoming leader slots for validators.

Get Transaction Count

solana transaction-count
Returns total transactions processed:
123456789012

Get Block Production

solana block-production
Displays block production statistics for current epoch.

Request Airdrops (Devnet/Testnet)

On Devnet and Testnet, request free test tokens:
solana airdrop 1
Request larger amounts:
solana airdrop 5
Specify recipient:
solana airdrop 1 <ADDRESS>
Airdrops are rate-limited. If requests fail, wait a few minutes and try again.
Airdrops are not available on Mainnet Beta. SOL must be purchased or transferred from another account.

Cluster-Specific Considerations

Devnet

  • Resets: May reset periodically
  • Stability: Less stable than Testnet or Mainnet
  • Airdrops: Available (rate-limited)
  • Features: May include experimental features

Testnet

  • Resets: Infrequent
  • Stability: More stable than Devnet
  • Airdrops: Available (rate-limited)
  • Features: Similar to Mainnet

Mainnet Beta

  • Resets: Never (production network)
  • Stability: Highest stability
  • Airdrops: Not available
  • Features: Production-ready features only
  • Cost: Real SOL required for transactions

Localhost

  • Control: Full control over network
  • Speed: Fastest for development
  • Isolation: Completely isolated
  • Features: Configure as needed

Troubleshooting

Connection Timeout

If commands timeout:
  1. Check internet connectivity
  2. Verify RPC endpoint is correct
  3. Try a different RPC provider
  4. Increase RPC timeout:
solana config get --url <URL> --rpc-timeout 60

Invalid URL

Ensure the URL is properly formatted:
# Correct
solana config set --url https://api.devnet.solana.com

# Incorrect
solana config set --url api.devnet.solana.com  # Missing https://

Version Mismatch Errors

Update your CLI to match cluster version:
agave-install update

Best Practices

  1. Development: Always use Devnet or Localhost
  2. Testing: Use Testnet for final testing before mainnet
  3. Production: Only use Mainnet Beta for production deployments
  4. Separate Keypairs: Use different keypairs for each cluster
  5. Version Management: Keep CLI version updated
  6. Config Profiles: Maintain separate configs for each cluster
  7. Verify Cluster: Always verify which cluster you’re connected to before operations

Quick Reference

solana config get

Next Steps

Stake Accounts

Manage stake accounts and delegate tokens

Vote Accounts

Create and manage validator vote accounts

Build docs developers (and LLMs) love