requestAirdrop RPC Method
Please note that the Airdrop method is subject to limits set by Solana. For more tools for getting Devnet SOL, check out our Guide on : A Complete Guide to Airdropping Test SOL on Solana
パラメータ
pubkey
文字列
読み込み中...
lamports
整数
読み込み中...
オブジェクト
オブジェクト
読み込み中...
commitment
文字列
読み込み中...
finalized
文字列
読み込み中...
confirmed
文字列
読み込み中...
processed
文字列
読み込み中...
返します
結果
読み込み中...
リクエスト
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"jsonrpc":"2.0", "id":1, "method":"requestAirdrop", "params": ["YOUR_WALLET_ADDRESS", 1000000000]}'
1curl https://docs-demo.solana-mainnet.quiknode.pro/ \2-X POST \3-H "Content-Type: application/json" \4--data '{"jsonrpc":"2.0", "id":1, "method":"requestAirdrop", "params": ["YOUR_WALLET_ADDRESS", 1000000000]}'
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.solana-mainnet.quiknode.pro/")67https = ネット::HTTP.new(url.ホスト, url.ポート)8https.use_ssl = true910リクエスト = ネット::HTTP::POST.new(URL)11リクエスト["Content-Type"] = "application/json"12リクエスト.本文 = JSON.dump({13「jsonrpc」: "2.0",14"id": 1,15"method": "requestAirdrop",16"params": [17"YOUR_WALLET_ADDRESS",18100000000019]20})2122回答 = https.リクエスト(リクエスト)23レスポンスを格納する.read_body24
1require "uri"2require "json"3require "net/http"45url = URI("https://docs-demo.solana-mainnet.quiknode.pro/")67https = ネット::HTTP.new(url.ホスト, url.ポート)8https.use_ssl = true910リクエスト = ネット::HTTP::POST.new(URL)11リクエスト["Content-Type"] = "application/json"12リクエスト.本文 = JSON.dump({13「jsonrpc」: "2.0",14"id": 1,15"method": "requestAirdrop",16"params": [17"YOUR_WALLET_ADDRESS",18100000000019]20})2122回答 = https.リクエスト(リクエスト)23レスポンスを格納する.read_body24
1import { createSolanaRpc, address, lamports } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");5const walletAddress = address("YOUR_WALLET_ADDRESS");6const airdropAmount = lamports(BigInt(1_000_000_000));78try {9const airdropSignature = await solanaRpc.requestAirdrop(walletAddress, airdropAmount).send();10console.log(airdropSignature);11} catch (error) {12console.error("Error requesting airdrop:", error);13}14})();15
1import { createSolanaRpc, address, lamports } from "@solana/kit";23(async () => {4const solanaRpc = createSolanaRpc("https://docs-demo.solana-mainnet.quiknode.pro/");5const walletAddress = address("YOUR_WALLET_ADDRESS");6const airdropAmount = lamports(BigInt(1_000_000_000));78try {9const airdropSignature = await solanaRpc.requestAirdrop(walletAddress, airdropAmount).send();10console.log(airdropSignature);11} catch (error) {12console.error("Error requesting airdrop:", error);13}14})();15
1const web3 = require("@solana/web3.js");2(async () => {3const url = "https://docs-demo.solana-mainnet.quiknode.pro/";4const solana = new web3.Connection(url);5console.log(6await solana.requestAirdrop(7new web3.PublicKey("YOUR_WALLET_ADDRESS"),810000000009)10);11})();12
1const web3 = require("@solana/web3.js");2(async () => {3const url = "https://docs-demo.solana-mainnet.quiknode.pro/";4const solana = new web3.Connection(url);5console.log(6await solana.requestAirdrop(7new web3.PublicKey("YOUR_WALLET_ADDRESS"),810000000009)10);11})();12
1from solana.rpc.api import Client2from solana.publickey import PublicKey3print(solana_client.request_airdrop(PublicKey("YOUR_WALLET_ADDRESS"), 1000000000))
1from solana.rpc.api import Client2from solana.publickey import PublicKey3print(solana_client.request_airdrop(PublicKey("YOUR_WALLET_ADDRESS"), 1000000000))
1use reqwest::header;2use reqwest::Client;3use std::error::Error;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut headers = header::HeaderMap::new();8headers.insert("Content-Type", "application/json".parse().unwrap());910let client = Client::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "requestAirdrop",16"params": [17"YOUR_WALLET_ADDRESS",18100000000019]20}21"#;22let response = client23.post("https://docs-demo.solana-mainnet.quiknode.pro/")24.headers(headers)25.body(json_data)26.send()27.await?;2829let body = response.text().await?;30println!("{}", body);3132Ok(())33}
1use reqwest::header;2use reqwest::Client;3use std::error::Error;45#[tokio::main]6async fn main() -> Result<(), Box<dyn Error>> {7let mut headers = header::HeaderMap::new();8headers.insert("Content-Type", "application/json".parse().unwrap());910let client = Client::new();11let json_data = r#"12{13"jsonrpc": "2.0",14"id": 1,15"method": "requestAirdrop",16"params": [17"YOUR_WALLET_ADDRESS",18100000000019]20}21"#;22let response = client23.post("https://docs-demo.solana-mainnet.quiknode.pro/")24.headers(headers)25.body(json_data)26.send()27.await?;2829let body = response.text().await?;30println!("{}", body);3132Ok(())33}
回答
1{2「jsonrpc」: "2.0",3"result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",4"id": 15}
1{2「jsonrpc」: "2.0",3"result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",4"id": 15}