> ## Documentation Index
> Fetch the complete documentation index at: https://solana.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> This page is part of the Solana developer documentation at https://solana.com/developers/docs. Append `.md` to any docs URL, or send `Accept: text/markdown`, to get the page as Markdown.
> Index of all pages: https://solana.com/llms.txt. Per-section indexes such as https://solana.com/developers/docs/payments/llms.txt are smaller; prefer them when working on one task.
> Coding agents: install the official Solana skill for current APIs and conventions with `npx skills add https://github.com/solana-foundation/solana-dev-skill` (also served at https://solana.com/SKILL.md).
> Code in the cookbook and task pages comes from tested example files. Prefer it over writing API calls from memory.

# getInflationReward

> Returns the inflation reward credited to each supplied address for an epoch. Depending on the supplied address, this may be a staking reward or a voting reward.

<Info>
  **Source**

  [`get_inflation_reward`](https://github.com/anza-xyz/agave/blob/v4.3.2/rpc/src/rpc.rs#L703)
</Info>

<RequestExample>
  ```bash cURL
  curl https://api.devnet.solana.com -s -X POST \
    -H "Content-Type: application/json" \
    -d '
    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "getInflationReward",
      "params": [
        [
          "5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN",
          "6v2RcyyqG3NTusX4PEQESHB8t7SVM4Nw2bMvkqBtkA3t"
        ],
        {
          "commitment": "finalized"
        }
      ]
    }
  '
  ```

  ```ts Kit
  import { address, createSolanaRpc } from "@solana/kit";

  const rpc_url = "https://api.devnet.solana.com";
  const rpc = createSolanaRpc(rpc_url);

  // A devnet vote account and a stake account delegated to it
  let addresses = [
    address("5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN"),
    address("6v2RcyyqG3NTusX4PEQESHB8t7SVM4Nw2bMvkqBtkA3t")
  ];

  // No epoch: returns rewards for the previous epoch
  let inflationReward = await rpc.getInflationReward(addresses).send();

  console.log(inflationReward);
  ```

  ```ts web3.js
  import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";

  const connection = new Connection(clusterApiUrl("devnet"), "confirmed");

  // A devnet vote account and a stake account delegated to it
  let addresses = [
    new PublicKey("5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN"),
    new PublicKey("6v2RcyyqG3NTusX4PEQESHB8t7SVM4Nw2bMvkqBtkA3t")
  ];

  // No epoch: returns rewards for the previous epoch
  let inflationReward = await connection.getInflationReward(addresses);

  console.log(inflationReward);
  ```

  ```rs Rust
  use anyhow::Result;
  use solana_client::nonblocking::rpc_client::RpcClient;
  use solana_commitment_config::CommitmentConfig;
  use solana_sdk::pubkey;

  #[tokio::main]
  async fn main() -> Result<()> {
      let client = RpcClient::new_with_commitment(
          String::from("https://api.devnet.solana.com"),
          CommitmentConfig::confirmed(),
      );

      // A devnet vote account and a stake account delegated to it
      let addresses = [
          pubkey!("5ZWgXcyqrrNpQHCme5SdC5hCeYb2o3fEJhF7Gok3bTVN"),
          pubkey!("6v2RcyyqG3NTusX4PEQESHB8t7SVM4Nw2bMvkqBtkA3t"),
      ];

      // No epoch: returns rewards for the previous epoch
      let inflation_reward = client.get_inflation_reward(&addresses, None).await?;

      println!("{:#?}", inflation_reward);

      Ok(())
  }
  ```
</RequestExample>

<ResponseExample>
  ```json Response
  {
    "jsonrpc": "2.0",
    "result": [
      {
        "epoch": 1198,
        "effectiveSlot": 517968000,
        "amount": 24261688778539,
        "postBalance": 17781431900499765,
        "commission": null
      },
      {
        "epoch": 1198,
        "effectiveSlot": 517968004,
        "amount": 1275961233057,
        "postBalance": 38960646030861694,
        "commission": null
      }
    ],
    "id": 1
  }
  ```
</ResponseExample>

## Parameters

<ParamField body="addresses" type="array" required>
  An array of addresses to query, as base-58 encoded strings
</ParamField>

<ParamField body="config" type="object">
  Configuration object containing the following fields:

  <Expandable title="properties" defaultOpen>
    <ParamField body="commitment" type="string" default="finalized">
      Values: `processed`, `confirmed`, `finalized`

      Solana RPC uses the following commitment levels:

      | Value       | Description                                                                                                                                                                               |
      | ----------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
      | `processed` | Return data from the highest slot this node has processed. This is the newest view, but the block can still be skipped.                                                                   |
      | `confirmed` | Return data from the same slot as `finalized`. Kept for compatibility and planned for removal in a later release.                                                                         |
      | `finalized` | Return data from the highest slot with a finalization certificate, from votes by 80% of stake in one round or 60% of stake in each of two rounds. This is the strongest commitment level. |
    </ParamField>

    <ParamField body="epoch" type="u64">
      An epoch for which the reward occurs. If omitted, the previous epoch will be
      used
    </ParamField>

    <ParamField body="minContextSlot" type="number">
      The minimum slot that the request can be evaluated at

      ```json Example
      { "minContextSlot": 341197000 }
      ```
    </ParamField>
  </Expandable>
</ParamField>

## Result

<ResponseField name="result" type="array">
  The result field will be a JSON array whose elements are either reward objects
  or `null` when no reward data is available for the corresponding input address:

  <Expandable title="properties" defaultOpen>
    <ResponseField name="epoch" type="u64">
      Epoch for which reward occurred
    </ResponseField>

    <ResponseField name="effectiveSlot" type="u64">
      The slot in which the rewards are effective
    </ResponseField>

    <ResponseField name="amount" type="u64">
      Reward amount in lamports
    </ResponseField>

    <ResponseField name="postBalance" type="u64">
      Post balance of the account in lamports
    </ResponseField>

    <ResponseField name="commission" type="u8 | null">
      Vote account commission when the reward was credited
    </ResponseField>
  </Expandable>
</ResponseField>
