erigon icon indicating copy to clipboard operation
erigon copied to clipboard

[Caplin] Add support to query balances/effective balances over a range of epochs/slots

Open angusscott opened this issue 1 year ago • 1 comments

Rationale

We regularly require the timeseries of all balances for given validator(s) over a range of epochs and slots, so we can analyse the rewards earned by our validators. Ideally behaviour would be similar to fashion as the pre-existing /eth/v1/beacon/states/{state_id}/validator_balances API call, with the exclusion of state_id argument

angusscott avatar Jun 21 '24 15:06 angusscott

So, I would not add an endpoint that does what you do, I would instead make /eth/v1/beacon/states/{state_id}/validator_balances have the option to return effective balances too.

The reason for this is that it wont speed up your algo significantly.

The way you should use the endpoint should be by taking a large amount of validators and batch return their balances. The cost of querying one validator vs many is not as different as you might think, the cost is amortized. You want, however, to query the endpoint AS LITTLE AS POSSIBLE, not to return as little validators as possible.

Giulio2002 avatar Jun 22 '24 14:06 Giulio2002