/kin-rewards-engine

Primary LanguagePythonMIT LicenseMIT

KRE

Kin Rewards Engine

This repository contains code which powers the Kin Rewards Engine (KRE). Note that this repository is a work in progress and additional code will be added periodically.

Information flow

The KRE has 4 primary steps:

  1. Data is collected from the blockchain and pushed to a PostgreSQL database via the History Collector.
  2. PostgreSQL data is extracted and pushed to BigQuery*.
  3. This raw data is processed daily to calculate payouts (and also serves as a basis for dashboards).
  4. Every week this processed data it used to create the XDR (and other) payout files used to execute payments.

*Note that at this time, this step is beyond the scope of this repository.

The core components of the KRE run as pipelines (DAGs) on Airflow. You can read more about Airflow here. These DAGs are directed acyclic graphs of tasks. The work for steps 3) and 4) of the Kin Reward Engine are done in kre_2.py and payout_report.py respectively. These DAGs are run with daily and weekly schedules respectively. While the code detailing 2) is absent, we have included the schemas of relevant BigQuery tables.

Contributing

Review the HowToContribute guide before contributing.