getInflationReward
Returns the inflation / staking reward for a list of addresses for a given epoch. This is the primary method for querying historical staking rewards, which is essential for staking dashboards, tax reporting tools, and validator performance analysis. Each address receives its reward amount, effective slot, epoch, and commission at the time of the reward.
Parameters
| # | Type | Required | Description |
|---|---|---|---|
| 1 | array[string] | Yes | Array of base-58 encoded addresses to query (up to a maximum of about 1000) |
| 2 | object | No | Configuration object |
Configuration object fields:
| Field | Type | Description |
|---|---|---|
commitment | string | Commitment level: processed, confirmed, or finalized |
epoch | u64 | Epoch for which to query rewards. Defaults to the previous epoch |
minContextSlot | number | Minimum slot at which the request can be evaluated |
Response
Returns an array of reward objects (or null for addresses with no reward):
| Field | Type | Description |
|---|---|---|
[].epoch | u64 | The epoch for which the reward was earned |
[].effectiveSlot | u64 | The slot at which the reward became active |
[].amount | u64 | Reward amount in lamports |
[].postBalance | u64 | Post-reward account balance in lamports |
[].commission | `u8 | null` |
Code Examples
cURL
1curl http://[IP_ADDRESS]:[PORT] -X POST -H "Content-Type: application/json" -d '{
2 "jsonrpc": "2.0",
3 "id": 1,
4 "method": "getInflationReward",
5 "params": [
6 ["6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu", "BGsqMegLpV6zuPNGETrSECFQdDtaYcKjkrKBF8eLnNPb"],
7 { "epoch": 384 }
8 ]
9}'TypeScript
1const response = await fetch("http://[IP_ADDRESS]:[PORT]", {
2 method: "POST",
3 headers: { "Content-Type": "application/json" },
4 body: JSON.stringify({
5 jsonrpc: "2.0",
6 id: 1,
7 method: "getInflationReward",
8 params: [
9 [
10 "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
11 "BGsqMegLpV6zuPNGETrSECFQdDtaYcKjkrKBF8eLnNPb"
12 ],
13 { epoch: 384 }
14 ]
15 }),
16});
17const { result } = await response.json();
18result.forEach((r, i) => r && console.log(`Address ${i}: ${r.amount} lamports`));Python
1import requests
2
3response = requests.post("http://[IP_ADDRESS]:[PORT]", json={
4 "jsonrpc": "2.0",
5 "id": 1,
6 "method": "getInflationReward",
7 "params": [
8 [
9 "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu",
10 "BGsqMegLpV6zuPNGETrSECFQdDtaYcKjkrKBF8eLnNPb"
11 ],
12 {"epoch": 384}
13 ]
14})
15result = response.json()["result"]
16for i, r in enumerate(result):
17 if r: print(f"Address {i}: {r['amount']} lamports")Rust
1use reqwest::Client;
2use serde_json::json;
3
4#[tokio::main]
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6 let client = Client::new();
7 let res = client.post("http://[IP_ADDRESS]:[PORT]")
8 .json(&json!({
9 "jsonrpc": "2.0",
10 "id": 1,
11 "method": "getInflationReward",
12 "params": [
13 ["6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu", "BGsqMegLpV6zuPNGETrSECFQdDtaYcKjkrKBF8eLnNPb"],
14 {"epoch": 384}
15 ]
16 }))
17 .send().await?
18 .text().await?;
19 println!("{}", res);
20 Ok(())
21}Example Response
1{
2 "jsonrpc": "2.0",
3 "result": [
4 {
5 "epoch": 384,
6 "effectiveSlot": 166752000,
7 "amount": 2500000,
8 "postBalance": 500002500000,
9 "commission": null
10 },
11 null
12 ],
13 "id": 1
14}