# Consensus client reward APIs
---
## Motivation
Develop *APIs* that provide detailed *reward* data for Ethereum *validators*.
---
## beaconcha.in rewards

---
## Goal
Provide data on rewards paid to the validators broken down for each of their duties:
- `attestation_rewards`
- `block_rewards`
- `sync_committee_rewards`
---
## Milestones
1. Designing the beacon-API endpoints.
2. Implement those endpoints into one consensus client.
---
## Challenges
- Basic understanding of rewards.
- Alignment between the core devs.
- Rust.
- Understanding the codebase.
---
## Feedback

---
### Attestation ([PR #3822](https://github.com/sigp/lighthouse/pull/3822))
**Query:**
```bash
$ curl --data "[\"8663\", \"0xb0bd225a6202effca9986e8c3ed50b4f29f8b3154ef21337843d945877aadd6c9bf40ff39393f329cfb243e1dfde23ee\"]" -H "Content-Type:application/json" "http://localhost:5052/eth/v1/beacon/rewards/attestations/179550" | jq
```
**Output:**
```json
{
"execution_optimistic": false,
"data": {
"ideal_rewards": [
{
"effective_balance": "0",
"head": "0",
"target": "0",
"source": "0"
},
// omitted
{
"effective_balance": "32",
"head": "3360",
"target": "6314",
"source": "3478"
}
],
"total_rewards": [
{
"validator_index": "8663",
"head": "3360",
"target": 6314,
"source": 3478
},
{
"validator_index": "27563",
"head": "3360",
"target": 6314,
"source": 3478
}
]
}
}
```
---
### Block ([PR #3907](https://github.com/sigp/lighthouse/pull/3907))
**Query:**
```bash!
$ curl -H "Content-Type:application/json" "http://localhost:5052/eth/v1/beacon/rewards/blocks/5745617" | jq
```
**Output:**
```json!
{
"execution_optimistic": false,
"data": {
"proposer_index": "32632",
"total": "31843976",
"attestations": "30723010",
"sync_aggregate": "1120966",
"proposer_slashings": "0",
"attester_slashings": "0"
}
}
```
---
### Sync committee ([PR #3903](https://github.com/sigp/lighthouse/pull/3903))
**Query:**
```bash
$ curl --data "[\"8663\", \"0xb0bd225a6202effca9986e8c3ed50b4f29f8b3154ef21337843d945877aadd6c9bf40ff39393f329cfb243e1dfde23ee\"]" -H "Content-Type:application/json" "http://localhost:5052/eth/v1/beacon/rewards/sync_committee/5745617" | jq
```
**Output:**
```json
{
...
"data": [
{
"validator_index": "8663",
"reward": 15637
},
{
"validator_index": "27563",
"reward": 15637
}
]
}
```
---
## Future of the project

---
## Future of the project

---
## Honorable mention

---
## Closing words
:heart:
{"metaMigratedAt":"2023-06-17T22:09:24.125Z","metaMigratedFrom":"Content","title":"Consensus client reward APIs","breaks":true,"contributors":"[{\"id\":\"94e0e5b1-fd82-47db-9697-223211d8e33d\",\"add\":11763,\"del\":8866}]"}