requestAirdrop - Solana
Example code for the requestAirdrop JSON-RPC method. Complete guide on how to use the requestAirdrop JSON-RPC method in the GetBlock Web3 documentation.
Parameters
Parameter
Type
Required
Description
Config Object
Field
Type
Required
Description
Request
curl --location --request POST 'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/' \
--header 'Content-Type: application/json' \
--data-raw '{
"jsonrpc": "2.0",
"method": "requestAirdrop",
"params": ["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4", 1000000000],
"id": "getblock.io"
}'const { Connection, PublicKey, LAMPORTS_PER_SOL } = require('@solana/web3.js');
const connection = new Connection('https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/', 'confirmed');
const airdropSignature = await connection.requestAirdrop(
new PublicKey('JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4'),
LAMPORTS_PER_SOL
);
console.log(airdropSignature);import requests
response = requests.post(
'https://shared.eu-central-1.getblock.io/<ACCESS-TOKEN>/',
headers={'Content-Type': 'application/json'},
json={
'jsonrpc': '2.0',
'method': 'requestAirdrop',
'params': ["JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4", 1000000000],
'id': 'getblock.io'
}
)
print(response.json()['result'])Response
Response Parameters
Parameter
Type
Description
Use Cases
Error Handling
Error Code
Message
Description
Last updated
Was this helpful?