Giter VIP home page Giter VIP logo

reward-scripts's Introduction

Staking Reward Script

For each reward epoch (every 3.5 days) script that calculates staking rewards will be run. Relevant data will be posted on this repository.

The process

  • Clone this repository
git checkout https://github.com/flare-foundation/reward-scripts.git
  • Set up (network) configuration file configs/networks/network_name.json
    • NETWORK: name of the network (e.g. flare). It should match the file name for the address configuration file deploys/<NETWORK>.json (e.g. flare)
    • RPC: RPC URL for the network
    • MAX_BLOCKS_FOR_EVENT_READS: how many blocks can be read with a single web3 API call (e.g. getAllEvents)
    • MAX_REQUESTS_PER_SECOND: how many requests per second can be made
    • REWARD_EPOCH: reward epoch for which rewards are calculated
    • REQUIRED_FTSO_PERFORMANCE_WEI: the amount of FTSO rewards that an FTSO provider needs to receive in a given epoch for its node to be eligible to receive staking rewards
    • BOOSTING_FACTOR: factor of boosting eligibility bond (BEB) validator received as a boost
    • MIN_FOR_BEB_GWEI: minimum total self-bond needed to be eligible to receive a boost
    • VOTE_POWER_CAP_BIPS: percentage of the network's total stake amount node can have for rewarding
    • UPTIME_VOTING_PERIOD_LENGTH_SECONDS: length of a period (starting at the given reward epoch) in which voters can cast a vote regarding nodes with high enough uptime
    • UPTIME_VOTING_THRESHOLD: number of votes a node needs to receive to be eligible for a reward
    • API_PATH: path to APIs which list active validators and delegators
    • REWARD_AMOUNT_EPOCH_WEI: reward amount to distribute in a given reward epoch
    • NUM_EPOCHS: number of epochs for which to sum reward amounts

If a configuration file doesn't exist or some parameters are missing, (those) parameters will have default values from configuration service. If a default value is undefined it will be read from the blockchain.

For the fastest execution RPC with unlimited number of requests should be used and parameter MAX_REQUESTS_PER_SECOND should be set to Infinity.

  • Install packages
yarn
  • Run the calculating staking rewards process
yarn process-staking-rewards

You can also run it with optional parameters from file (e.g. yarn process-staking-rewards -b 8 -f 111), which will override parameters set in the configuration file.

For each run output of the process is in folder generated-files/reward-epochs-<REWARD_EPOCH>.

To verify the official results posted in this repository one needs to update its configuration file with values from the configFileData object of a data.json file for some reward epoch.

Data for distributing rewards

Rewards will be distributed every four reward epochs, which means that every 14 days reward amounts from the past four reward epochs will be summed. This is achieved by running the process

yarn sum-staking-rewards

The config's file parameter REWARD_EPOCH specifies the latest reward epoch for which reward data is summed, and the parameter NUM_EPOCHS specifies the number of reward epochs for which reward data is summed.

Output of the process is a file epochs-<REWARD_EPOCH-NUM_EPOCHS+1>-<REWARD_EPOCH>, which is located in the folder generated-files/validator-rewards.

reward-scripts's People

Contributors

timotejvesel avatar aljazs-flare avatar bostjan-kovac avatar joshuagedwards avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.