This repo contains the docker files of CryptoLab website for and only for W3f Open Grant Program Commitee to inspect and verify the result of the proposal https://github.com/w3f/Open-Grants-Program/blob/master/applications/cryptolab-staking-reward-collector-front-end.md
To start the website,
- fill in a subscan API key in field
subscanApiKey
in./staking-rewards-collector/config/config.js
.
Without doing it, Subscan API can return captcha html which the program cannot handle if you call the Staking Rewards Collector frequently.
- docker-compose build
- docker-compose up
Then you can open the url http://127.0.0.1:3030/tools/dotSR to enter the Staking Rewards tool.
- Copy and paste either a Polkadot or a Kusama address on the Search for Stash ID field
You can see the rewards of the stash.
You can change the search criteria by clicking the filter icon.
You can download the rewards report of either .csv and .json by clicking the download icon
If you entered an incorrect address or a stash with no rewards collected, the page would show a snakebar to tell you that CryptoLab cannot find the result.
To compile and run CryptoLab website, you need to clone the following projects from github.
Polkadot Staking Site (https://github.com/cryptolab-network/polkadot-staking-site)
CryptoLab WebServer (https://github.com/cryptolab-network/cryptolab-web-server)
Chain Data Collector (https://github.com/cryptolab-network/chain-data-collector)
Staking Rewards Collector (https://github.com/cryptolab-network/staking-rewards-collector)
You can clone them to a same root folder, for example,
root
|
-> polkadot-staking-site
-> cryptolab-web-server
-> chain-data-collector
-> staking-rewards-collector
and compile each by
- Polkadot Staking Site
npm install
npm run build
- Copy the content in
./dist
folder to/www/static
in cryptolab-web-server folder
cd ./dist
cp -r . ../../cryptolab-web-server/www/static
- CryptoLab WebServer
cargo build --release
- rename
sample.json
in./config
toconfig.json
or create your own config file.
{
"db_address": "127.0.0.1",
"db_port": 27017,
"kusama_db_name": "kusama",
"polkadot_db_name": "polkadot",
"db_has_credential": false,
"db_username": "",
"db_password": "",
"port": 3030,
"cors_url": ["http://127.0.0.1:3030", "http://localhost:3030", "http://127.0.0.1:8080"],
"new_cache_folder": "../chain-data-collector/cache/kusama",
"new_cache_folder_polkadot": "..//chain-data-collector/cache/polkadot",
"staking_rewards_collector_dir": "../staking-rewards-collector",
"serve_www": true
}
- Chain Data Collector
npm install
npm run build
- rename
sample.json
in./config
folder todev.json
or create your owndev.json
.
module.exports = {
PORT: 3000,
KUSAMA_WSS: 'wss://kusama.api.onfinality.io/public-ws',
POLKADOT_WSS: 'wss://polkadot.api.onfinality.io/public-ws',
API_1KV_KUSAMA: 'https://kusama.w3f.community',
API_1KV_POLKADOT: 'https://polkadot.w3f.community',
MONGO_ACCOUNT: '',
MONGO_PASSWORD: '',
MONGO_URL: '127.0.0.1',
MONGO_PORT: 27017,
MONGO_DBNAME: 'kusama',
MONGO_DBNAME_POLKADOT: 'polkadot',
PAGE_SIZE: 1500,
}
detailed config information can be found in the README in each repo.
- Staking Rewards Collector
npm install
cp ./config/sample.js ./config/config.js
and fill in thesubscanApiKey
field with a subscan API key.
I can provide the tester our API key in private. So if you need it, please contact me.
- Mongo DB
You have to setup your own MongoDB in order to run the whole project. We use MongoDB Community Server v4.4.4
Follow these steps to start the CryptoLab website,
- Start mongoDB. (e.g. mongod --dbpath .\data\cryptoLab)
- Go to
./chain-data-collector
and runnpm run startKusama
andnpm run startPolkadot
- Go to
./cryptolab-web-server
and runcargo run --release
- Go to http://127.0.0.1:3030/tools/dotSR on your browser and you would see the staking rewards collector webpage
-
rename
sample.json
in./config
toconfig.json
or create your own config file. -
Go to
./cryptolab-web-server
and runcargo test
The CryptoLab website is composed of several services.
-
Chain Data Collector This repo contains the services to collect chain data from both chains.
-
CryptoLab Web Server This repo serves as the web server of CryptoLab
-
Polkadot Staking Site This repo contains the front end of the CryptoLab
-
Staking Rewards Collector This is an external repo which the CryptoLab used for collecting staking rewards