in-solana by Supanode

getInflationReward — Solana RPC Method

getInflationReward returns the staking reward earned by one or more accounts for a given epoch. The reward is calculated based on the account’s delegated stake and the epoch’s inflation rate.

Parameters

NameTypeRequiredDescription
addressesstring[]YesArray of base-58 encoded addresses (stake accounts or vote accounts).
commitmentstringNoprocessed, confirmed, or finalized. Default: finalized.
epochu64NoThe epoch to query. Defaults to the previous epoch.
minContextSlotnumberNoMinimum slot at which the request can be evaluated.

Request

curl -X POST https://api.mainnet-beta.solana.com \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "getInflationReward",
    "params": [
      ["6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu"],
      {"epoch": 789}
    ]
  }'

TypeScript (@solana/kit)

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

const rpc = createSolanaRpc("https://api.mainnet-beta.solana.com");
const rewards = await rpc
  .getInflationReward(
    [address("6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu")],
    { epoch: 789n }
  )
  .send();

if (rewards[0]) {
  console.log(`Reward: ${rewards[0].amount} lamports in epoch ${rewards[0].epoch}`);
}

Response

{
  "jsonrpc": "2.0",
  "result": [
    {
      "amount": 2500000,
      "effectiveSlot": 341100000,
      "epoch": 789,
      "postBalance": 1002500000,
      "commission": 5
    }
  ],
  "id": 1
}
FieldTypeDescription
amountu64Reward amount in lamports.
effectiveSlotu64The slot at which the reward became active.
epochu64The epoch the reward applies to.
postBalanceu64Account balance after the reward was applied, in lamports.
commissionu8 or nullVote account commission at the time of the reward. null for stake accounts queried directly.

If the account did not earn a reward for the epoch (not staked, or not active during that epoch), the corresponding array entry is null.

Common errors

  • Epoch not available — rewards for very old epochs may not be available on non-archival nodes. The result entry will be null.
  • Invalid address — a malformed base-58 address returns a parse error.
  • Too many addresses — some RPC providers limit the number of addresses per call (typically 5-100).

Performance

The response time depends on the number of addresses queried. Querying a single address is fast. Large batches (100+ addresses) may take several seconds. The method reads reward data from the node’s reward history, which may be limited to recent epochs on non-archival nodes.

FAQ

Which accounts earn inflation rewards? Stake accounts that are delegated to a validator earn inflation rewards. The validator’s vote account receives the commission portion. Non-staked SOL accounts do not earn rewards.

How often are rewards distributed? Rewards are distributed once per epoch (approximately every 2 days). They are applied at the epoch boundary and reflected in account balances at the start of the next epoch.

What is the commission field? Commission is the percentage the validator takes from staking rewards before distributing the remainder to delegators. A commission of 5 means the validator keeps 5% of the rewards.

Can I query rewards for any epoch? You can query any epoch that the node has data for. Non-archival nodes typically keep reward data for the last several epochs. For historical data, use an archival RPC endpoint.

Why is the result null for my account? The account was not staked or was not active during the requested epoch. Only accounts with active delegated stake earn inflation rewards.

Parameters

ParameterTypeRequiredDescriptionDefault
addressesarrayYesArray of base-58 encoded addresses to query, as staker accounts.—
commitmentstringNoCommitment level: processed, confirmed, or finalized.finalized
epochu64NoEpoch to query rewards for. Defaults to the previous epoch.—
minContextSlotnumberNoMinimum slot at which the request can be evaluated.—

Updated: