> For the complete documentation index, see [llms.txt](https://docs.coinvera.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.coinvera.io/integration/solana/rpc/getinflationreward.md).

# getInflationReward

The `getInflationReward` RPC method enables querying **inflation rewards** (staking rewards) for one or more accounts for a specific epoch. These rewards are credited to **stake accounts**, and the method is crucial for tracking, auditing, or verifying staking-based earnings.

***

### ✅ Common Use Cases

* **🔍 Verify Staking Rewards**: Confirm that a stake account received rewards for a specific epoch.
* **📊 Track Reward History**: Retrieve rewards across multiple epochs to analyze trends or build a payout log.
* **🔐 Audit Validator Payouts**: While validators don’t receive rewards directly, this method allows validating rewards received by their associated vote/stake accounts.

***

### 🛠️ Request Parameters

The method accepts:

#### 1. `addresses` (array of strings) — **Required**

* A list of **base-58 encoded public keys**.
* These can be stake accounts, vote accounts, or other account types.
* Some providers (like Helius) support large batches (e.g., up to 1005 addresses for paid users).

#### 2. `config` (object) — *Optional*

Contains:

| Field            | Type    | Description                                                                           |
| ---------------- | ------- | ------------------------------------------------------------------------------------- |
| `commitment`     | string  | Commitment level (`processed`, `confirmed`, or `finalized`). Default: `finalized`.    |
| `epoch`          | integer | The epoch number to query. If omitted, defaults to the most recently completed epoch. |
| `minContextSlot` | integer | Ensures the query is evaluated at a slot at least this recent.                        |

***

### 📤 Example Request

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "getInflationReward",
  "params": [
    ["AccountPublicKey1", "AccountPublicKey2"],
    {
      "epoch": 512,
      "commitment": "finalized"
    }
  ]
}
```

***

### 📥 Response Structure

Returns an **array of results**, in the same order as the `addresses` array. Each element is either:

* An object with reward info
* `null` if the account received no rewards or didn’t exist in the epoch

#### Reward Object Fields:

| Field           | Type | Description                                                  |
| --------------- | ---- | ------------------------------------------------------------ |
| `epoch`         | u64  | Epoch number for the reward                                  |
| `effectiveSlot` | u64  | Slot in which the reward was applied                         |
| `amount`        | u64  | Reward amount in **lamports**                                |
| `postBalance`   | u64  | Account balance after reward application                     |
| `commission`    | u8   | Validator’s commission percentage (*only for vote accounts*) |

***

**Code Examples**

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

```javascript
const fetch = require('node-fetch');

async function getInflationReward(rpcUrl) {
  try {
    const response = await fetch(rpcUrl, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({
        jsonrpc: '2.0',
        id: 1,
        method: 'getInflationReward',
        "params": [
            [
              "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
              "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
            ],
            {
              "epoch": 822,
              "commitment": "finalized"
            }
          ]
      }),
    });

    const data = await response.json();
    
    // Print the exact full response
    console.log('Full RPC Response:');
    console.log(JSON.stringify(data, null, 2));
    
    return data;
  } catch (error) {
    console.error('Error getting health:', error.message);
    return null;
  }
}

// Example usage
const RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key';

getInflationReward(RPC_URL);
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

def get_inflation_reward(rpc_url):
    try:
        response = requests.post(
            rpc_url,
            headers={
                'Content-Type': 'application/json',
            },
            json={
                'jsonrpc': '2.0',
                'id': 1,
                'method': 'getInflationReward',
                'params': [
                    [
                        '6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu',
                        'BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2'
                    ],
                    {
                        'epoch': 822,
                        'commitment': 'finalized'
                    }
                ]
            }
        )
        
        data = response.json()
        
        # Print the exact full response
        print('Full RPC Response:')
        print(json.dumps(data, indent=2))
        
        return data
        
    except Exception as error:
        print(f'Error getting health: {error}')
        return None

# Example usage
RPC_URL = 'https://rpc.coinvera.io/?x-api-key=your-coinvera-x-api-key'
get_inflation_reward(RPC_URL)
```

{% endtab %}
{% endtabs %}

**Example Response**

```json
{
  "jsonrpc": "2.0",
  "error": {
    "code": -32004,
    "message": "Block not available for slot 355536000"
  },
  "id": 1
}
```

***

### 💡 Developer Tips

* **Epoch Timing**: Rewards are **calculated at the end** of an epoch and **credited at the start** of the next.
* **Effective Slot**: Indicates when the reward was actually applied.
* **Null Entries**: May mean:
  * The account didn't exist
  * No rewards were applicable (e.g., inactive or insufficient stake)
  * The reward was zero
* **Batch Requests**: Avoid overloading providers with large batches if you're not sure about their rate limits.
* **Use with getEpochInfo**: To dynamically determine the current or most recent epoch before querying.

***

### 📘 Summary

The `getInflationReward` RPC method is an essential tool for any staking dashboard, validator analytics tool, or protocol-level reward verification system. It gives granular visibility into how inflation rewards are distributed per epoch across stake accounts.
