OpenInfra.sh is now live - Solana infrastructure, included with every server. LEARN MORE HERE >

OpenInfra.shopeninfra.sh

requestAirdrop

Requests a faucet transaction that transfers lamports to the supplied Pubkey.

Request

Send a JSON-RPC 2.0 POST request with method: "requestAirdrop". The params array takes a base-58 encoded public key, the number of lamports to airdrop, and an optional configuration object.

curl · JSON-RPCjson
{  "jsonrpc": "2.0",  "id": 1,  "method": "requestAirdrop",  "params": [    "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",    1000000000,    {      "commitment": "finalized"    }  ]}

@solana/kit

kit.tsts
import { address, createSolanaRpc, lamports } from "@solana/kit";import { LAMPORTS_PER_SOL } from "@solana/web3.js"; const rpc_url = "https://rpc.openinfra.sh";const rpc = createSolanaRpc(rpc_url); let receiver = address("4kg8oh3jdNtn7j2wcS7TrUua31AgbLzDVkBZgTAe44aF");let airdropAmt = lamports(BigInt(1 * LAMPORTS_PER_SOL)); let signature = await rpc.requestAirdrop(receiver, airdropAmt).send(); console.log(signature);

@solana/web3.js

web3.tsts
import {  Connection,  LAMPORTS_PER_SOL,  PublicKey,  clusterApiUrl} from "@solana/web3.js"; const connection = new Connection("https://rpc.openinfra.sh", "confirmed"); let receiver = new PublicKey("4kg8oh3jdNtn7j2wcS7TrUua31AgbLzDVkBZgTAe44aF");let airdropAmt = 1 * LAMPORTS_PER_SOL; let sig = await connection.requestAirdrop(receiver, airdropAmt); console.log(sig);

Rust

main.rsrs
use anyhow::Result;use solana_client::nonblocking::rpc_client::RpcClient;use solana_commitment_config::CommitmentConfig;use solana_sdk::{native_token::LAMPORTS_PER_SOL, pubkey}; #[tokio::main]async fn main() -> Result<()> {    let client = RpcClient::new_with_commitment(        String::from("https://rpc.openinfra.sh"),        CommitmentConfig::confirmed(),    );     let receiver = pubkey!("4kg8oh3jdNtn7j2wcS7TrUua31AgbLzDVkBZgTAe44aF");    let lamports = 1 * LAMPORTS_PER_SOL;     let transaction_signature = client.request_airdrop(&receiver, lamports).await?;    loop {        if client.confirm_transaction(&transaction_signature).await? {            break;        }    }     println!("{}", transaction_signature);     Ok(())}

Parameters

ParameterTypeRequiredDescription
pubkeystringYesPubkey of the account to receive lamports, as a base-58 encoded string.
lamportsu64YesAmount of lamports to airdrop.
configobjectNoOptional configuration object. See fields below.
config.commitmentstringNoDesired finality level for the faucet transaction. Accepted values: processed, confirmed, finalized (default).
config.recentBlockhashstringNoUse this recent blockhash for the faucet transaction instead of the node's current confirmed blockhash.

commitment values

ValueDescription
processedReturn data from the highest slot this node has processed on the fork it currently considers best. This is the newest view, but it can still change if the cluster switches forks.
confirmedReturn data from the highest slot that at least two-thirds of active stake has directly voted to confirm. More stable than processed, but a weaker guarantee than finalized.
finalizedReturn data from the highest slot that the cluster recognizes as finalized. The slot has reached maximum vote lockout in validators' vote towers and is recognized by at least two-thirds of active stake. This is the strongest commitment level.

recentBlockhash example

{ "recentBlockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N" }

Response

response.jsonjson
{  "jsonrpc": "2.0",  "result": "4cdd1oX7cfVALfr26tP52BZ6cSzrgnNGtYD7BFhm6FFeZV5sPTnRvg6NRn8yC6DbEikXcrNChBM5vVJnTgKhGhVu",  "id": 1}

The result is a transaction signature string, as a base-58 encoded value. You can use this signature to confirm the airdrop landed on chain.

FieldTypeDescription
resultstringTransaction signature of the airdrop, as a base-58 encoded string.