requestAirdrop
Requests an airdrop of lamports to a Pubkey
Common use cases
| Development account funding | Request test SOL from faucet to fund keypairs during development on devnet or testnet. Used for initializing accounts, deploying programs, and executing test transactions without mainnet costs. |
| Automated test setup | Programmatically fund test accounts in CI/CD pipelines and automated test suites. Eliminates manual faucet interaction for ephemeral wallets, enabling repeatable test environments on local validators or devnet. |
Parameters
pubkey (string, required)
Pubkey of account to receive lamports, as a base-58 encoded string
lamports (u64, required)
Amount of lamports to airdrop
config (object, optional)
Configuration object containing the following fields:
Fields:
commitment(string): The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.
Request
- cURL
- JavaScript
- Python
curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "requestAirdrop",
"params": [
"83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
1000000000,
{
"commitment": "finalized"
}
]
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "requestAirdrop",
"params": [
"83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
1000000000,
{
"commitment": "finalized"
}
]
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "requestAirdrop",
"params": [
"83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
1000000000,
{
"commitment": "finalized"
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Replace mainnet with devnet in the URL to query devnet instead.
Response
{
"jsonrpc": "2.0",
"result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
"id": 1
}
Response Fields
Return value: string
Transaction Signature of the airdrop, as a base-58 encoded string
FAQ and Troubleshooting
Why does requestAirdrop return a 429 error?
Devnet faucet has strict rate limits. Wait 60+ seconds between requests, switch to a local validator with solana-test-validator, or request smaller amounts.
Why does requestAirdrop fail with "Internal error" (-32603)?
Some devnet nodes are dead or misconfigured. This is a devnet infrastructure issue. Retry the request or switch RPC endpoints. For reliable testing, use a local validator instead of devnet.
Should I confirm the airdrop transaction before checking balance?
Yes. Call confirmTransaction with the returned signature at your desired commitment level before assuming the balance has updated. The airdrop is not guaranteed to succeed without confirmation.
Can I use requestAirdrop on mainnet?
No. requestAirdrop only works on devnet and testnet networks. Mainnet requires purchasing SOL from exchanges or transferring from existing wallets.
Related Methods
getBalance
Check account balance after requesting airdrop. Essential for confirming the airdrop succeeded and lamports were credited to the target account.
getLatestBlockhash
Obtain recent blockhash for optional use with requestAirdrop config. Some implementations pass explicit blockhash for transaction construction.
External Resources
- Solana Official Documentation
- Solana Faucet - Web-based alternative for manual devnet/testnet SOL requests with GitHub authentication