getInflationReward
Returns the inflation / staking reward for a list of addresses for an epoch
Common use cases
| Staking Dashboard - Display Recent Rewards | Display current epoch staking rewards for a wallet's stake accounts. Fetch wallet's stake accounts with getProgramAccounts(StakeProgram), call getInflationReward with current epoch from getEpochInfo(), handle null returns for inactive accounts, and display rewards alongside validator commission rates. |
| APY Calculator - Annualized Yield from Per-Epoch Data | Calculate accurate annualized percentage yield from per-epoch reward data. Fetch latest reward with getInflationReward(), compute rate_change = amount / (postBalance - amount), get epoch schedule with getEpochSchedule(), calculate epochs_per_year from slot timing, then compute APY = rate_change * epochs_per_year * 100. |
| Historical Rewards Export - Multi-Epoch Aggregation | Generate CSV export of all historical staking rewards for tax reporting. Loop through epochs from stake activation to current epoch, call getInflationReward() per epoch, aggregate non-null results, fetch timestamps with getBlockTime() for effective_slot, and export with epoch boundaries calculated from getEpochSchedule(). |
| Validator Performance Comparison | Compare validator reward performance across multiple epochs for due diligence. Query inflation rewards for stake accounts delegated to different validators, normalize by stake amount and commission rates, track consistency across epochs to identify performance patterns, and flag validators with frequent null rewards indicating missed slots or poor performance. |
Parameters
pubkey (array, optional)
An array of addresses to query, as base-58 encoded strings
config (object, optional)
Configuration object containing the following fields:
Fields:
commitment(string): The commitment describes how finalized a block is at that point in time. See Configuring State Commitment.epoch(u64): An epoch for which the reward occurs. If omitted, the previous epoch will be usedminContextSlot(number): The minimum slot that the request can be evaluated at
Request
- cURL
- JavaScript
- Python
curl https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getInflationReward",
"params": [
[
"6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
"BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
],
{
"epoch": 800,
"commitment": "finalized"
}
]
}'
// Using fetch
const response = await fetch('https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"jsonrpc": "2.0",
"id": 1,
"method": "getInflationReward",
"params": [
[
"6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
"BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
],
{
"epoch": 800,
"commitment": "finalized"
}
]
})
});
const data = await response.json();
console.log(data);
import requests
import json
url = 'https://solana-mainnet.api.syndica.io/api-key/YOUR_API_KEY'
headers = {'Content-Type': 'application/json'}
data = {
"jsonrpc": "2.0",
"id": 1,
"method": "getInflationReward",
"params": [
[
"6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
"BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
],
{
"epoch": 800,
"commitment": "finalized"
}
]
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
Replace mainnet with devnet in the URL to query devnet instead.
Response
{
"jsonrpc": "2.0",
"result": [
{
"epoch": 2,
"effectiveSlot": 224,
"amount": 2500,
"postBalance": 499999442500
},
null
],
"id": 1
}
Response Fields
Return value: array
The result field will be a JSON array of objects containing:
FAQ and Troubleshooting
Why does getInflationReward return small percentages like 0.04% instead of the ~7% APY I expect?
getInflationReward returns rewards for a single epoch only, not annualized. Solana has approximately 182 epochs per year (2.5 days per epoch). If you receive 0.04% per epoch, your annualized yield is roughly 0.04% × 182 = 7.3% APY. To calculate APY accurately: rate = amount / (postBalance - amount), epochs_per_year = (365 * 24 * 60 * 60) / (epochSchedule.slotsPerEpoch * 0.4 seconds), APY = rate * epochs_per_year * 100.
Why does getInflationReward return null for some epochs?
Null returns indicate the address did not earn rewards in that epoch. Common reasons: (1) Stake account was inactive or warming up during that epoch, (2) Stake account was deactivated or cooling down, (3) Validator missed blocks and earned no rewards, (4) Epoch is outside RPC node's historical data retention window, or (5) Address is not a stake/vote account. Check stake activation state and validator performance for the target epoch.
Should I pass my wallet address or stake account address to getInflationReward?
Pass your stake account public key (derived from createStake), not your wallet address. Rewards are credited to stake accounts, not wallet SOL accounts. Find your stake accounts with getProgramAccounts(StakeProgram) filtered by your wallet as withdrawer/staker authority. Passing a wallet address will return null since wallets don't earn staking rewards directly.
How do I get lifetime rewards totals instead of per-epoch data?
getInflationReward only returns rewards for a single epoch at a time. To calculate lifetime total, you must loop through all epochs from stake activation to current epoch, calling getInflationReward(addresses, epoch) for each. Sum the amount field from non-null responses. Note: This can be slow (10-30 seconds per call), and historical data may not be available beyond RPC node's retention window (typically 1-2 years on most providers).
What does the commission field in the response represent?
The commission field shows the validator's commission percentage at the time the reward was distributed. This is the percentage of staking rewards the validator retained before distributing the remainder to delegators. For example, commission: 10 means the validator kept 10% and distributed 90% to stake delegators. This field is only present for stake account rewards, not for vote account queries. Commission rates affect your net rewards and vary by validator (typically 0-10%).
Related Methods
getEpochInfo
Use to determine current epoch number for latest rewards queries and validate epoch boundaries.
getEpochSchedule
Essential for calculating epoch boundary timestamps and converting per-epoch yields to APY. Provides slotsPerEpoch and firstNormalSlot needed for accurate time-based calculations.
getBlockTime
Fetch Unix timestamp for effectiveSlot to display reward distribution date/time. Required for historical rewards export with accurate timing.
getInflationRate
Returns current network-wide inflation rate including validator/foundation splits. Useful for contextualizing individual rewards within broader network economics.
External Resources
- Solana Official Documentation
- Solana Staking Guide - Official guide covering staking mechanics, validator selection, and reward distribution. Essential reading for understanding what getInflationReward measures.
- Solana Inflation Design - Technical documentation explaining Solana's inflation schedule, validator reward calculation formulas, and commission mechanics. Use to understand the math behind reward amounts.