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
Check Current Configuration
View the CLI’s current cluster configuration:RPC URL field shows which cluster the CLI is currently targeting.
Set Cluster Target
Usesolana 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):- Testing applications
- Learning Solana development
- Obtaining free test tokens via airdrop
- Validator testing
Testnet
Connect to Testnet:- More stable environment than Devnet
- Testing before mainnet deployment
- Public validator participation
Mainnet Beta
Connect to Mainnet Beta (production network):Localhost
Connect to a local test validator:- Local development
- Fast iteration without network latency
- Testing without network constraints
Cluster Monikers
The CLI supports short moniker names for clusters:Custom RPC Endpoints
You can connect to custom RPC endpoints:- Using private RPC providers
- Connecting to custom clusters
- Using high-performance RPC services
Popular RPC Providers
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:Version Compatibility
Ensure your CLI version matches or exceeds the cluster version for best compatibility.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
View Cluster Nodes
Get Epoch Info
Check Slot
Per-Command Cluster Override
Override the configured cluster for a single command using the--url flag:
- 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
Switch Configs
Use the-C flag to specify a config file:
Set Default Config
Symlink your preferred config:Commitment Levels
Configure the commitment level for transaction confirmation:- processed - Fastest, query the most recent block
- confirmed - Balance between speed and finality (default)
- finalized - Slowest, maximum finality guarantee
Per-Command Commitment
Override for a single command:Common Cluster Operations
Get Cluster Stats
Get Leader Schedule
Get Transaction Count
Get Block Production
Request Airdrops (Devnet/Testnet)
On Devnet and Testnet, request free test tokens: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:- Check internet connectivity
- Verify RPC endpoint is correct
- Try a different RPC provider
- Increase RPC timeout:
Invalid URL
Ensure the URL is properly formatted:Version Mismatch Errors
Update your CLI to match cluster version:Best Practices
- Development: Always use Devnet or Localhost
- Testing: Use Testnet for final testing before mainnet
- Production: Only use Mainnet Beta for production deployments
- Separate Keypairs: Use different keypairs for each cluster
- Version Management: Keep CLI version updated
- Config Profiles: Maintain separate configs for each cluster
- Verify Cluster: Always verify which cluster you’re connected to before operations