# Node reward tool
# Prepare
- get Bytom source code:https://github.com/Bytom/bytom (opens new window)
- install mysql and import table. table refer to below bytom/toolbar/vote_reward/database/dump_reward.sql
# Configure file
go to
cmd/votereward
,rungo build -o votereward main.go
to compilevotereward
,createreward.json
filewrite the information to
reward.json
below
example:
{
"node_ip": "http://127.0.0.1:9888", //your node ip
"chain_id": "mainnet", //network type:mainnet,wisdom,solonet
"mysql": { //mysql
"connection": {
"host": "127.0.0.1", //mysql server
"port": 3306, //mysql port
"username": "root", //mysql username
"password": "123456", //mysql password
"database": "reward" //database name
},
"log_mode": false //default
},
"reward_config": { //reward calculation and distribution configuration
"xpub": "9742a39a0bcfb5b7ac8f56f1894fbb694b53ebf58f9a032c36cc22d57a06e49e94ff7199063fb7a78190624fa3530f611404b56fc9af91dcaf4639614512cb64", // node xpub(node xpub, not account xpub, you can see node xpub in core status)
"account_id": "bd775113-49e0-4678-94bf-2b853f1afe80", //reward send from this account
"password": "123456", //account password
"reward_ratio": 20, //reward distribution ratio
"mining_address": "tn1qavhkza7mhsscfmlvthqvzscz7y2347jpeh7arw" //node can get reward from this address,you can use api to get it: curl -x POST http://127.0.0.1:9888/get-mining-address -d '{}'
}
}
# Getting start
# Parameter configuration
config_file: default reward.json
reward_start_height:the block height that reward start calculation
reward_end_height: the block height that reward ended
note:reward_start_height、reward_end_height must be a multiple of 100
distribution of reward.
Usage:
votereward [flags]
Flags:
--config_file string config file. default: reward.json (default "reward.json")
--help help for reward
--reward_end_height uint The end height of the distributive income reward interval, It is a multiple of the pos consensus cycle(100). example: 1200
--reward_start_height uint The starting height of the distributive income reward interval, It is a multiple of the pos consensus cycle(100). example: 600
# Run the tool
./votereward --config_file reward.json --reward_start_height 600 --reward_end_height 1200
Note:check your parameter if you got error