← All posts

How to airdrop SOL on the devnet to your wallet

• Written by Josh Wolff

Here we discuss how to airdrop SOL on the devnet to your wallet.

We use the Solana CLI to receive the airdrop.

We also have a custom airdrop function that’s separate from the main Solana airdrop function. Ours is designed for reliability when testing so you can easily automate your scripts. The main Solana airdrop function is heavily limited.

Airdropping SOL to your wallet on the devnet consists of two steps — recovering your wallet and then running the airdrop command.

Prerequesites

Install the Solana CLI.

Recover Your Public Key

If you already have a public key address, then skip this step. Otherwise, you can derive your public key as follows.

Open up a new terminal window to type a command.

Recover your keypair file. (In order to avoid overwriting any existing keypair file you have, make sure to write to a nonexistent file.)

solana-keygen recover --outfile temp-keypair.json

This will use the CLI’s default derivation path.

Enter the mnemonic phrase and passphrase when prompted. Ensure that the public key returned is what you were expecting. If so, enter “y.”

If you don’t have a mnemonic phrase yet, generate one easily with the Blockchain API’s endpoint here.

If not, you might have created the wallet with a separate interface (e.g., Phantom wallet), which uses a different derivation path. To see our tutorial on Solana derivation paths, see here.

You can now use this public key to get your airdrop.

Get the Airdrop

Replace “8m24W8DvoJ9p1ANDcNbyZMQTgPV9Vrr8DtxApsE4oBTQ” below with your public key address.

solana airdrop 1 8m24W8DvoJ9p1ANDcNbyZMQTgPV9Vrr8DtxApsE4oBTQ

If Solana returns a 429 error (too many requests) or other such error, try connecting via a VPN to get a new IP address.

If you do get a 429, which you will inevitably run into if using in production or frequently at all, you can use our airdrop endpoint for reliably and predictably getting an airdrop!

Hope this helps!

Please check out the Blockchain API’s documentation for endpoints that can help you develop faster and more reliably.

If you have any questions, feel free to email us at info [(at)] the blockchainapi.com or open up a new GitHub issue on our GitHub repository.

Written by Josh Wolff

Hi! I'm Josh. I'm building a platform to make interacting with blockchains easy. The blog highlights how to use the API, feature developments, newletters, and other important information.