TriportRPC

getInflationReward

POSThttps://api.triport.io/v1/sol

Returns the inflation / staking reward earned by a list of addresses for a given Solana epoch.

Solanasol_read_rpcfree+ — 20 / 60 / 200 / 600 RPS (free / basic / pro / business)

getInflationReward returns the inflation (staking) reward credited to each of a list of addresses for a single epoch. Each address in the request maps to one entry in the returned array, in the same order as the input. The reward amount is reported in lamports (1 SOL = 1,000,000,000 lamports), so divide by 1e9 to display a SOL figure.

Only stake accounts and vote accounts earn inflation rewards. If an address is not a reward-bearing account, or earned no reward for the requested epoch, its slot in the result array is null. The array length always equals the number of addresses you passed.

By default the reward for the previous epoch is returned. Pass epoch in the config object to query a specific historical epoch. Note that nodes only retain reward data for a limited window of recent epochs; very old epochs may no longer be available.

Parameters

JSON-RPC params is a positional array: [addresses, config?].

addressesarray of string (base-58)required
List of account public keys to look up rewards for. Each must match ^[1-9A-HJ-NP-Za-km-z]{32,44}$.
configobjectoptional
Optional configuration object (see below).
commitmentstringoptional
Commitment level: processed, confirmed, or finalized.
epochintegeroptional
The epoch to query rewards for. Defaults to the previous epoch.
minContextSlotintegeroptional
Minimum slot the request must be evaluated at.

Response

The first address earned a reward of 2500000 lamports (0.0025 SOL) for epoch 612. The second address is not a reward-bearing account for that epoch, so its entry is null.

amountinteger
Reward amount credited, in lamports.
effectiveSlotinteger
The slot at which the reward became effective.
epochinteger
The epoch for which the reward was paid.
postBalanceinteger
The account balance, in lamports, after the reward was applied.
commissioninteger
Vote-account commission, as a percentage, in effect when the reward was credited.

Errors

Errors are returned in the standard JSON-RPC error envelope. See the shared errors reference for the full envelope shape and shared codes.

CodeMeaningWhen it happens
-32602Invalid paramsaddresses is missing, contains an invalid base-58 string, or config is malformed.
401UnauthorizedMissing or invalid Authorization: Bearer key.
429Rate limitedMore than your tier's RPS for sol_read_rpc (20 / 60 / 200 / 600).

Examples

JavaScript (fetch)

const res = await fetch("https://api.triport.io/v1/sol", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.TRIPORT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    jsonrpc: "2.0",
    id: 1,
    method: "getInflationReward",
    params: [
      [
        "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
        "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2",
      ],
      { epoch: 612 },
    ],
  }),
});


const { result } = await res.json();
result.forEach((reward, i) => {
  if (reward === null) console.log(`address ${i}: no reward`);
  else console.log(`address ${i}: ${reward.amount / 1e9} SOL @ epoch ${reward.epoch}`);
});

TypeScript SDK (@triport/sdk)

import { TriportClient } from "@triport/sdk";


const client = new TriportClient({ apiKey: process.env.TRIPORT_API_KEY });


const rewards = await client.solana.getInflationReward(
  [
    "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
    "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2",
  ],
  { epoch: 612 }
);


for (const [i, reward] of rewards.entries()) {
  if (reward === null) console.log(`address ${i}: no reward`);
  else console.log(`address ${i}: ${reward.amount / 1e9} SOL @ epoch ${reward.epoch}`);
}

Python (triport-sdk)

import os
from triport import TriportClient


client = TriportClient(api_key=os.environ["TRIPORT_API_KEY"])


rewards = client.solana.get_inflation_reward(
    [
        "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
        "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2",
    ],
    epoch=612,
)


for i, reward in enumerate(rewards):
    if reward is None:
        print(f"address {i}: no reward")
    else:
        print(f"address {i}: {reward['amount'] / 1e9} SOL @ epoch {reward['epoch']}")

Notes

  • Order and length are preserved: the result array has exactly one entry per requested address, in the same order. A null entry means that address earned no reward for the epoch (e.g. it is not a stake or vote account).
  • Lamports, not SOL: amount and postBalance are integer lamport counts. Divide by 1e9 for a SOL figure.
  • Default epoch: when epoch is omitted, the reward for the previous epoch is returned.
  • History window: reward data is only retained for a limited number of recent epochs; requests for very old epochs may return null.
  • Related methods: use getEpochInfo to discover the current epoch and getInflationRate for the cluster-wide inflation rate.