Parameters
An array of addresses to query, as base-58 encoded strings
Response
Epoch for which reward occured
The slot in which the rewards are effective
Reward amount in lamports
Post balance of the account in lamports
Vote account commission when the reward was credited
Code Examples
Basic Request
curl http://rpc.orbitflare.com -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getInflationReward",
"params": [
[
"6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
"BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
],
{"epoch": 2}
]
}'
Using web3.js
import { Connection } from '@solana/web3.js';
const connection = new Connection('http://rpc.orbitflare.com');
const addresses = [
'6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu',
'BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2'
];
const rewards = await connection.getInflationReward(addresses, 2);
console.log(rewards);
Using Python
from solana.rpc.api import Client
client = Client("http://rpc.orbitflare.com")
addresses = [
"6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
"BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"
]
response = client.get_inflation_reward(addresses, 2)
print(response)
Notes
- Returns inflation rewards for a list of addresses
- Results are returned as an array in the same order as the input addresses
- A null value in the result array means that the address has not received rewards
- Commission field is only present for validators (null for regular accounts)
- Rewards are calculated at the end of each epoch
Best Practices
- Provide a list of valid addresses to avoid null responses
- Specify the epoch parameter if you need historical reward data
- Handle null values in the response array appropriately
- Use this method to track rewards for staking accounts
- Handle network errors and retry when appropriate