# Implementation Details

## Rewards Estimation

Estimated rewards calculation uses the current status of the blockchain to approximate the amount of FTM rewarded for participating in staking. The network uses a proof-of-stake consensus variant to ensure the security of the data inside the blockchain structure.

To calculate the rewards, we use the `baseRewardPerSecond`

value of the latest sealed epoch, but the total staked amount of tokens is calculated elsewhere. The epoch provides the total value of self-staked tokens and the amount of total delegated tokens within that epoch. However, the self-staked total does not account for temporarily offline nodes and includes delegated stakes in the process of being undelegated. Consequently, this value is not accurate for our calculations.

To get the current total staked value, we iterate all the staking records and collect the total staked amount from individual staking.

## Delegation Limits

The delegation limit is determined by multiplying the staker's current self-staked amount by a fixed rate specified in the SFC contract. Currently, the maximum allowed delegations are set at 15 times the self-staked FTM.

To calculate the remaining delegation limit, we subtract the current delegated amount from the total limit. This value is provided by the API, so you don't need to perform the calculation manually. Note that tokens in the process of undelegation are not included in the delegated amount and therefore do not count towards the delegation limit.

Last updated