requestAirdrop

Requests an airdrop of lamports to a specified public key. This method is only available on devnet and testnet -- it will fail on mainnet-beta. It is the primary way for developers to fund accounts during development and testing. The airdrop amount is limited (typically 1-2 SOL per request on devnet) and may be rate-limited. Returns a transaction signature that can be used with confirmTransaction to verify the airdrop completed.

Parameters

#TypeRequiredDescription
1stringYesBase-58 encoded public key of the account to receive SOL
2u64YesAmount of lamports to airdrop
3objectNoConfiguration object

Configuration object fields:

FieldTypeDescription
commitmentstringCommitment level: processed, confirmed, or finalized

Response

Returns a single value:

FieldTypeDescription
resultstringTransaction signature of the airdrop (base-58)

Code Examples

cURL

1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2  "jsonrpc": "2.0",
3  "id": 1,
4  "method": "requestAirdrop",
5  "params": [
6    "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
7    1000000000
8  ]
9}'

TypeScript

1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2  method: "POST",
3  headers: { "Content-Type": "application/json" },
4  body: JSON.stringify({
5    jsonrpc: "2.0",
6    id: 1,
7    method: "requestAirdrop",
8    params: [
9      "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
10      1000000000
11    ]
12  }),
13});
14const { result } = await response.json();
15console.log("Airdrop signature:", result);

Python

1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4    "jsonrpc": "2.0",
5    "id": 1,
6    "method": "requestAirdrop",
7    "params": [
8        "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
9        1000000000
10    ]
11})
12result = response.json()["result"]
13print(f"Airdrop signature: {result}")

Rust

1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    let client = Client::new();
7    let res = client.post("http://[IP_ADDRESS]:[PORT]")
8        .json(&json!({
9            "jsonrpc": "2.0",
10            "id": 1,
11            "method": "requestAirdrop",
12            "params": [
13                "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg",
14                1000000000_u64
15            ]
16        }))
17        .send().await?
18        .text().await?;
19    println!("{}", res);
20    Ok(())
21}

Example Response

1{
2  "jsonrpc": "2.0",
3  "result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
4  "id": 1
5}