DEV Community

Cover image for How to Airdrop SOL Using Solana CLI: Step-by-Step Guide
Sumana
Sumana

Posted on • Updated on

How to Airdrop SOL Using Solana CLI: Step-by-Step Guide

Looking to distribute SOL (Solana's native cryptocurrency) to your wallet using Solana CLI? This comprehensive guide will lead you through the process seamlessly, ensuring easy distribution of SOL to your specified addresses.

Installing Solana CLI

Begin by installing Solana CLI. If you haven't installed it yet, follow these instructions:

sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
Enter fullscreen mode Exit fullscreen mode

Verifying Installation

Confirm the successful installation by checking the version of Solana CLI:

solana --version
Enter fullscreen mode Exit fullscreen mode

Starting a Test Validator

To set up a local test validator for experimentation, execute:

solana-test-validator
Enter fullscreen mode Exit fullscreen mode

Configuring Solana CLI for Local Cluster

Connect Solana CLI to your local cluster by configuring the URL:

solana config set --url http://localhost:8899
Enter fullscreen mode Exit fullscreen mode

Generating a Wallet

Generate a new wallet to manage your SOL:

solana-keygen new --outfile ~/my-local-solana-wallet.json
Enter fullscreen mode Exit fullscreen mode

To view the contents of your wallet file, use:

cat ~/my-local-solana-wallet.json
Enter fullscreen mode Exit fullscreen mode

Importing Private Key into Phantom Wallet

Copy the private key from your wallet file and import it into your Phantom wallet.

Getting the Wallet Address

Retrieve your wallet's address:

solana address -k ~/my-local-solana-wallet.json
Enter fullscreen mode Exit fullscreen mode

Airdropping Funds

Finally, airdrop SOL to your wallet address:

solana airdrop <wallet address>
Enter fullscreen mode Exit fullscreen mode

With these simple steps, you've successfully airdropped SOL to your wallet using Solana CLI. Keep exploring Solana's features and stay tuned for more guides on leveraging its capabilities for your projects. Happy airdropping🚀!

Top comments (0)