requestAirdrop – Solana
The requestAirdrop JSON-RPC method allows users to request an airdrop of lamports to a specified Solana Pubkey.
The requestAirdrop RPC Solana method facilitates funding test accounts with lamports.
This is essential for developers building and testing applications on Solana Devnet without requiring real funds. The airdrop is sent as a transaction to the provided account.
Supported Networks
This method is available on the following API endpoints:
Mainnet (limited availability)
Devnet (primary environment for airdrops)
Parameters
Required Parameters
string (required): The Pubkey of the account to receive the airdrop. This should be a base-58 encoded string.
integer (required): The number of lamports to airdrop, provided as a u64 integer.
Optional Parameters
object (optional): A configuration object containing:
commitment (string): Defines the level of finality for the request.
Result
The response returns a transaction signature of the airdrop.
Result Format
string: The transaction signature as a base-58 encoded string.
Request Example
API Endpoints
cURL Example
Response
A successful request returns the transaction signature of the airdrop.
Example Response
In this response:
result: The transaction signature confirming the airdrop.
Error Handling
Common requestAirdrop error scenarios:
Invalid Pubkey: If the provided Pubkey is invalid or not base-58 encoded.
Network issues: Connectivity problems with the Solana JSON-RPC API endpoints.
Insufficient faucet funds: When the Solana faucet runs out of lamports.
Example Error Response
Use Cases
The Solana requestAirdrop method is useful for:
Development environments: Funding test accounts on Devnet.
Blockchain education: Demonstrating transactions without using real funds.
Web3 applications: Simulating transaction activity.
Code requestAirdrop Example – Web3 Integration
Integration with Web3
By integrating Web3 requestAirdrop into Solana’s Core API, developers can fund test accounts, simulate transactions, and build reliable dApps without relying on real funds. This JSON-RPC method is essential for blockchain development on Solana Devnet.
Last updated