w3f / staking-rewards-collector

Apache License 2.0
77 stars 33 forks source link

Staking Rewards Collector v1.7.3

Disclaimer

Everyone using this tool does so at his/her own risk. Neither I nor Web3 Foundation guarantee that any data collected is valid and every user is responsible for double-checking the results of this tool. In addition to potential bugs in this code, you are relying on third-party data: Subscan's API is used to collect staking data and CoinGecko's API is used to collect daily price data.

This is no tax advice: Every user is responsible to do his/her own research about how stake rewards are taxable in his/her regulatory framework.

Changelog

Version 1.7.3

Thanks to the contributors.

For all changes see the changelog.md

What can it do?

How to run?

Requirements:

git clone git@github.com:w3f/staking-rewards-collector.git
cd staking-rewards-collector
cp config/userInput.json.sample config/userInput.json
# Change the parameters inside the config/userInput.json to your needs.
yarn
yarn start

Tutorial

For a more detailed tutorial on how to set up the script, please go here.

How to use it?

Input

The program takes several inputs in the config/userInput.json file.

Staking Rewards:

Price Data:

Output:

Output

After the tool executed successfully, it creates two files in the root folder. The JSON file contains some meta-data (e.g., sum of rewards and estimate of annualized return rate) and the CSV file gives the most important information in a table and thereby printable format.

CSV Output

The CSV output file contains a row for every payout within the time frame where at least one staking reward occurred. Example output:

example csv output

JSON Output

The JSON output file contains a summary of the data as well as a list of objects for every day of the specified time-period (regardless of whether staking rewards occured). If your standard OS text editor does not format the file properly, you can copy the data and insert it to http://jsonviewer.stack.hu/ (click at "format" after paste). Example output:

example json output

The JSON Output contains:

Summary

Additional Data

List of objects

A list with objects for every day in your specified range. In the price of numbers (e.g. amountPlank) multiple staking rewards are added. In the case of strings, those are concanated.

Troubleshooting

Donations

This tool is free and stays free to use. But if this tool is useful for you and you feel generous, feel free to donate :)