changed 2 years ago
Published Linked with GitHub

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)

Query:

$ curl --data "[\"8663\", \"0xb0bd225a6202effca9986e8c3ed50b4f29f8b3154ef21337843d945877aadd6c9bf40ff39393f329cfb243e1dfde23ee\"]" -H "Content-Type:application/json" "http://localhost:5052/eth/v1/beacon/rewards/attestations/179550" | jq

Output:

{
  "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)

Query:

$ curl -H "Content-Type:application/json" "http://localhost:5052/eth/v1/beacon/rewards/blocks/5745617" | jq

Output:

{
  "execution_optimistic": false,
  "data": {
    "proposer_index": "32632",
    "total": "31843976",
    "attestations": "30723010",
    "sync_aggregate": "1120966",
    "proposer_slashings": "0",
    "attester_slashings": "0"
  }
}

Sync committee (PR #3903)

Query:

$ curl --data "[\"8663\", \"0xb0bd225a6202effca9986e8c3ed50b4f29f8b3154ef21337843d945877aadd6c9bf40ff39393f329cfb243e1dfde23ee\"]" -H "Content-Type:application/json" "http://localhost:5052/eth/v1/beacon/rewards/sync_committee/5745617" | jq

Output:

{
  ...
  "data": [
    {
      "validator_index": "8663",
      "reward": 15637
    },
    {
      "validator_index": "27563",
      "reward": 15637
    }
  ]
}

Future of the project


Future of the project


Honorable mention


Closing words

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Select a repo