Interacting with the Solana blockchain using the command line is a powerful way to manage your digital assets with precision and control. Whether you're testing transactions on devnet or preparing for mainnet interactions, understanding how to send and receive SOL tokens using the Solana CLI (Command Line Interface) is essential for developers, validators, and advanced users.
This guide walks you through the full process of setting up wallets, airdropping test tokens, transferring SOL between addresses, and verifying balances—all via terminal commands. We'll focus on practical usage while integrating core concepts like keypairs, public addresses, and transaction signing.
Testing Your Wallet
Before sharing your public key or sending real value, it's wise to verify that your wallet setup works correctly. You can do this using Solana’s devnet, a developer testing environment where tokens have no monetary value. This allows you to safely test transactions without financial risk.
We’ll walk through creating two wallets, airdropping test SOL to one, and transferring funds to the second—confirming both sending and receiving functionality.
Airdrop Test Tokens to Get Started
To begin, request an airdrop of 1 SOL on devnet:
solana airdrop 1 <YOUR_PUBLIC_KEY> --url https://api.devnet.solana.comReplace <YOUR_PUBLIC_KEY> with your wallet’s base58-encoded address. If you haven’t created a wallet yet, generate one first:
solana-keygen new --outfile my_wallet.jsonAfter running the airdrop command, you should see output confirming the transaction signature. If the balance doesn’t update as expected, troubleshoot with:
solana confirm -v <TRANSACTION_SIGNATURE>👉 Learn how to securely manage your crypto assets using advanced tools
Check Your Balance
Verify the airdrop succeeded by checking your wallet balance:
solana balance <YOUR_PUBLIC_KEY> --url https://api.devnet.solana.comYou should see:
1 SOLThis confirms your wallet is active and ready for transactions.
Create a Second Wallet Address
To simulate a transfer, create a second wallet address. This can be any type—paper, file-based, or hardware—but for simplicity, use an in-memory keypair:
solana-keygen new --no-passphrase --no-outfileThe output will display:
pubkey: GKvqsuNcnwWqPzzuhLmGi4rzzh55FhJtGizkhHaEJqiVCopy this public key—you’ll send tokens to it next.
Note: In real-world scenarios, never expose seed phrases or private keys. The examples here are for educational purposes only.
Transfer Tokens Between Wallets
Now, send 0.5 SOL from your first wallet to the second:
solana transfer \
--from my_wallet.json \
<RECIPIENT_PUBLIC_KEY> \
0.5 \
--allow-unfunded-recipient \
--url https://api.devnet.solana.com \
--fee-payer my_wallet.jsonReplace <RECIPIENT_PUBLIC_KEY> with the pubkey from the second wallet.
--allow-unfunded-recipient: Allows sending to addresses with zero balance.--fee-payer: Specifies which keypair pays transaction fees (usually the sender).
You’ll receive a transaction signature upon success.
Confirm Updated Balances
Check both wallets’ balances:
solana balance my_wallet.json --url https://api.devnet.solana.comExpected result: 0.499995 SOL — slightly less than 0.5 due to a 0.000005 SOL network fee.
And for the recipient:
solana balance <RECIPIENT_PUBLIC_KEY> --url https://api.devnet.solana.comExpected result: 0.5 SOL
This confirms successful transfer and reception.
Full Example Walkthrough
Here’s a complete sequence demonstrating all steps:
# Create first wallet (file system)
solana-keygen new --outfile my_solana_wallet.json
# Output: pubkey: DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK
# Airdrop 1 SOL
solana airdrop 1 DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com
# Check balance
solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com
# Output: 1 SOL
# Generate second wallet (paper-style, no file saved)
solana-keygen new --no-outfile
# Output: pubkey: 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv
# Transfer 0.5 SOL
solana transfer \
--from my_solana_wallet.json \
7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv \
0.5 \
--allow-unfunded-recipient \
--url https://api.devnet.solana.com \
--fee-payer my_solana_wallet.json
# Final balances
solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com
# Output: 0.499995 SOL
solana balance 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv --url https://api.devnet.solana.com
# Output: 0.5 SOLThis end-to-end example verifies your ability to securely manage keypairs and execute transactions.
How to Receive Tokens
To receive SOL or SPL tokens, you need a public address—this is derived from your wallet’s keypair. Anyone can send tokens to this address, but only someone with the corresponding private key can spend them.
Your public key (address) looks like this: DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK
It’s encoded in base58 and typically ranges from 32 to 44 characters. Share this freely when requesting payments.
👉 Discover secure ways to track and transfer digital assets across blockchains
How to Send Tokens
Sending SOL requires three things:
- Path to your sender keypair (e.g.,
my_wallet.json) - Recipient’s public key (base58 format)
- Amount of SOL to send
Use the solana transfer command:
solana transfer \
--from <SENDER_KEYPAIR_PATH> \
<RECIPIENT_PUBLIC_KEY> \
<AMOUNT> \
--url https://api.mainnet-beta.solana.com \
--fee-payer <FEE_PAYER_KEYPAIR>On mainnet, replace https://api.devnet.solana.com with the mainnet endpoint.
Always double-check:
- The recipient address is correct (Solana addresses are case-sensitive).
- You have enough balance to cover both the transfer and fees.
- The correct keypair is used for signing.
Core Keywords for SEO
- Solana CLI
- Send SOL tokens
- Receive SOL
- Solana devnet
- Wallet keypair
- Airdrop SOL
- Transfer SOL command
- Base58 public key
These terms naturally appear throughout the article, supporting search visibility without keyword stuffing.
Frequently Asked Questions
Q: What is the Solana CLI used for?
A: The Solana CLI is a command-line tool that lets you interact with the Solana blockchain—creating wallets, checking balances, sending tokens, deploying programs, and more—all from your terminal.
Q: Can I use hardware wallets with the Solana CLI?
A: Yes. Hardware wallets like Ledger are supported. You’ll reference them via URL paths (e.g., usb://ledger) instead of file paths when signing transactions.
Q: Why did I only receive 0.499995 SOL after sending 0.5?
A: The difference is the transaction fee (0.000005 SOL), deducted from the sender’s account. All on-chain operations require a small fee paid in SOL.
Q: Is it safe to use devnet for testing?
A: Yes. Devnet tokens have no real value, making it ideal for learning and development. However, never use real seed phrases or private keys in test environments.
Q: How do I recover my wallet if I lose access?
A: Use your 12-word seed phrase to regenerate the keypair. Always store this offline and never share it.
Q: Can I send tokens without funding the recipient first?
A: Yes, by using the --allow-unfunded-recipient flag. Without it, transfers fail if the recipient has no existing account balance.
👉 Start exploring decentralized finance with reliable crypto tools today