Linux command
solana 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Check wallet balance
solana balance
Check balance
solana balance [address]
Get current cluster configuration
solana config get
Set cluster
solana config set --url [devnet|testnet|mainnet-beta]
Create a new keypair
solana-keygen new
Airdrop SOL
solana airdrop [amount]
Transfer SOL
solana transfer [recipient_address] [amount]
Deploy a program
solana program deploy [path/to/program.so]
说明
solana is the command-line interface for interacting with the Solana blockchain. It provides tools for managing wallets, transferring tokens, deploying programs (smart contracts), staking, and querying blockchain state. The CLI connects to Solana clusters via JSON-RPC. Three main clusters are available: mainnet-beta (production), testnet (testing), and devnet (development). Configuration is stored in ~/.config/solana/cli/config.yml. Keypairs for signing transactions can be generated with solana-keygen and are typically stored as JSON files. The CLI is the primary interface for Solana validators and program developers.
参数
- -u, --url _URL_
- URL for Solana's JSON RPC endpoint or cluster moniker (devnet, testnet, mainnet-beta).
- -k, --keypair _KEYPAIR_
- Filepath or URL to a keypair for signing transactions.
- -C, --config _FILEPATH_
- Configuration file to use.
- --no-address-labels
- Do not use address labels in output.
- --skip-preflight
- Skip the preflight transaction simulation.
- --skip-seed-phrase-validation
- Skip validation of seed phrases.
- --commitment _LEVEL_
- Return information at the selected commitment level (processed, confirmed, finalized).
- --use-quic
- Use QUIC protocol when sending transactions.
- --ws _URL_
- WebSocket URL for the Solana cluster.
- --output _FORMAT_
- Output format: json, json-compact.
- -h, --help
- Print help information.
- -V, --version
- Print version information.
FAQ
What is the solana command used for?
solana is the command-line interface for interacting with the Solana blockchain. It provides tools for managing wallets, transferring tokens, deploying programs (smart contracts), staking, and querying blockchain state. The CLI connects to Solana clusters via JSON-RPC. Three main clusters are available: mainnet-beta (production), testnet (testing), and devnet (development). Configuration is stored in ~/.config/solana/cli/config.yml. Keypairs for signing transactions can be generated with solana-keygen and are typically stored as JSON files. The CLI is the primary interface for Solana validators and program developers.
How do I run a basic solana example?
Run `solana balance` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -u, --url _URL_ do in solana?
URL for Solana's JSON RPC endpoint or cluster moniker (devnet, testnet, mainnet-beta).