# 节点收益发放工具
# 准备工作
- 获取bytom的源码,bytom源码地址:https://github.com/Bytom/bytom (opens new window)
- 本地安装mysql数据库,同时倒入表结构。表结构所在目录:bytom/toolbar/vote_reward/database/dump_reward.sql
# 配置文件
1、切换到cmd/votereward目录,执行go build -o votereward main.go编译生成votereward,创建reward.json配置文件 2、配置文件内容如下: example:
{
"node_ip": "http://127.0.0.1:9888", //个人节点的api的IP地址
"chain_id": "mainnet", //侧链的网络类型:主网(mainnet)、测试网(wisdom)、私有网络(solonet)
"mysql": { //mysql配置
"connection": {
"host": "127.0.0.1", //mysql服务地址
"port": 3306, //mysql端口
"username": "root", //mysql用户名
"password": "123456", //mysql密码
"database": "reward" //创建的数据库名称
},
"log_mode": false //默认
},
"reward_config": { //收益计算以及分配配置
"xpub": "9742a39a0bcfb5b7ac8f56f1894fbb694b53ebf58f9a032c36cc22d57a06e49e94ff7199063fb7a78190624fa3530f611404b56fc9af91dcaf4639614512cb64", // 共识节点的公钥,从网页钱包的设置中获取(是节点公钥,不是账户公钥)
"account_id": "bd775113-49e0-4678-94bf-2b853f1afe80", //发送给投票人收益的钱包ID
"password": "123456", //钱包ID对应的密码
"reward_ratio": 20, //分配给投票人的收益比列
"mining_address": "tn1qavhkza7mhsscfmlvthqvzscz7y2347jpeh7arw" //共识节点获取出块收益的地址,通过调用api接口获取: curl -x POST http://127.0.0.1:9888/get-mining-address -d '{}'
}
}
# 收益工具使用
# 1、参数配置
config_file: 配置文件,默认是reward.json,与启动命令在同一个目录 reward_start_height:计算收益区间的开始高度 reward_end_height:计算收益区间的结束高度
注:reward_start_height、reward_end_height是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
# 2、启动实例
./votereward --config_file reward.json --reward_start_height 600 --reward_end_height 1200
注:如果报错检查自己的配置文件参数。
← 水龙头 交易所对接指南(Java) →