---
# System prepended metadata

title: Consensus client reward APIs

---

# Consensus client reward APIs

---

## Motivation

Develop *APIs* that provide detailed *reward* data for Ethereum *validators*. 

---

## beaconcha.in rewards

![](https://i.imgur.com/lq1M4Bv.png)

---

## 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

![](https://i.imgur.com/Ko28FjS.png)

---

### 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

![](https://i.imgur.com/p3pyVUH.png)

---

## Future of the project

![](https://i.imgur.com/0FAEcbh.png)

---

## Honorable mention

![](https://i.imgur.com/3A9T4zL.png)


---

## Closing words

:heart: 
