This repository contains a Node.js script that calculates monthly earnings for ICON Network validators and potential staking rewards for users.
To execute the script, clone the repo, install the required packages and then execute the main script:
git clone git@github.com:icon-community/icon-validator-earnings-calculator.git
cd icon-validator-earnings-calculator
npm install
npm run start
Validator earnings come from two sources:
- Iwage: Fixed amount distributed equally among all active validators
- Iprep: Variable amount based on validator's power and commission rate
Total Monthly Earnings = Monthly Iwage + (Iprep * Commission Rate)
Staker rewards come from the validator's Iprep rewards after the validator's commission:
- Total Iprep Rewards = (Validator Power * Iglobal * Iprep) / Total Network Power
- Validator Commission = Total Iprep Rewards * Commission Rate
- Staker Pool = Total Iprep Rewards * (1 - Commission Rate)
- Individual Staker Reward = Staker Pool * (Staker Amount / Total Delegation)
Annual Percentage Rate (APR) is calculated as:
APR = (Monthly Staker Reward * 12 / Stake Amount) * 100
The script provides detailed information for each validator:
- Main statistics (earnings, delegation, rewards, commission rate, APR)
- Detailed reward breakdown (Iprep, Iwage, commission, staker rewards)
- Best staking option based on highest APR
- All calculations are based on current network conditions
- Actual rewards may vary based on network changes and validator performance
- Higher APR often correlates with lower total delegation
- Consider validator reliability and performance beyond just APR