# requestAirdrop – Solana

{% hint style="success" %}
The **requestAirdrop** RPC Solana method facilitates funding test accounts with lamports.
{% endhint %}

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

### 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

```json
https://go.getblock.io/<ACCESS-TOKEN>/
```

#### cURL Example

{% tabs %}
{% tab title="curl" %}

```json
curl --location "https://go.getblock.io/<ACCESS-TOKEN>/" -XPOST \
--header "Content-Type: application/json" \
--data '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "requestAirdrop",
    "params": [
      "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
      1000000000
    ]
}'
```

{% endtab %}
{% endtabs %}

### Response

A successful request returns the transaction signature of the airdrop.

#### Example Response

```json
{
  "jsonrpc": "2.0",
  "result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
  "id": 1
}
```

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

```json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32602,
    "message": "Invalid Pubkey"
  },
  "id": 1
}
```

### 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

{% tabs %}
{% tab title="JavaScript" %}

```javascript
const axios = require('axios');

const url = "https://go.getblock.io/<ACCESS-TOKEN>/";
const headers = { "Content-Type": "application/json" };

const payload = {
  jsonrpc: "2.0",
  id: 1,
  method: "requestAirdrop",
  params: [
    "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri",
    1000000000
  ]
};

const requestAirdrop = async () => {
  try {
    const response = await axios.post(url, payload, { headers });

    if (response.status === 200 && response.data.result) {
      console.log("Airdrop Transaction Signature:", response.data.result);
    } else {
      console.error("Unexpected response:", response.data);
    }
  } catch (error) {
    console.error("requestAirdrop error:", error.response?.data || error.message);
  }
};

requestAirdrop();
```

{% endtab %}
{% endtabs %}

### 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.getblock.io/api-reference/solana-sol/requestairdrop-solana.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
