livepeer/livepeerjs

View on GitHub
packages/explorer-2.0/data/claim-earnings.mdx

Summary

Maintainability
Test Coverage
Claiming your earnings is more of an accounting necessity than something that's
useful or valuable to a user as far as LPT is concerned. When an orchestrator
calls `reward()` the newly generated token sit in a pool that's credited towards
their total stake. Each delegator is entitled to some of this token. How much
they're owed needs to be calculated on a round-by-round basis and credited to
their account. Hence, when they claim earnings they are paying for this
calculation to take place on the blockchain, and the token to move from sitting
in a big pool, to being allocated towards them individually.

Fees that an orchestrators earns in ETH, are immediately distributed into a
delegator's account when they claim earnings however.

While delegators do need to do this calculation for every single round (day),
claiming earnings once can do the calculation for 100 rounds. The Livepeer
Explorer will automatically batch up requests per 50 rounds to optimise the
[gas](https://ethgasstation.info/blog/what-is-gas/) usage.

- Delegators or orchestrators claim earnings whenever they want to change their
  delegation status: unstake, stake towards another orhcestrator, stake more.
- Claiming earnings once can update their status for up to 100 rounds. So if
  it's been longer than 100 rounds since the last update, you may have to claim
  earnings multiple times.
- If it's been less than 100 rounds, this happens in the background when you
  stake or unstake, you don't need to proactively claim earnings.
- If you are not changing your stake, the most effective strategy is to just
  claim earnings once every 100 rounds. Or you can just wait and not do
  anything, and then call it, say 3 times if it's been 300 rounds.
- **CAUTION**: After you claim earnings for a round, you can not call it again
  for that round. That means that if the orchestrator earns more fees or calls
  `reward()` later in that round, you can not access those rewards or fees. To
  really optimize, change your staking status late in the round after most of
  the fees have been collected and `reward()` has been called.