CitShares--挖矿配置方法
环境准备
目前CTS提供了基于Ubuntu 16.04的可执行程序。因此,我们建议直接采用Ubuntu 16.04环境进行挖矿。
CTS的数据量还比较小,当前只需要1G内存即可流畅运行。如果需要在其他环境挖矿,就需要自己去编译了。
源码路径在:https://github.com/citshares/bitshares-core
下载地址
https://github.com/citshares/bitshares-core/releases安装环境
这部分跟BTS一模一样。
首先,需要安装部分依赖包:
sudo apt-get update
sudo apt-get install autoconf cmake make automake libtool git libboost-all-dev libssl-dev g++ libcurl4-openssl-dev
运行witness
下载witness_node ,运行
./witness_node --replay-blockchain --rpc-endpoint 127.0.0.1:11010
--replay-blockchain: 告诉witness_node每次运行时都重新遍历一遍数据。因为CTS不允许喂价低于买单价,因此每次重启witness_node都需要将以往数据遍历一次。这个过程耗时不多。
--rpc-endpoint: rpc的控制端口,接下来要用命令行钱包从这个端口连接
这时witness_node 会自己同步数据,这个过程大概半个小时,实际看网速情况。
witness_node 就是我们常说的重节点。我们将来的挖矿就需要它。但是,在正式挖矿之前,我们需要配置一下挖矿的账户,这里需要命令行钱包。
运行命令行钱包cli_wallet
打开另外一个终端,运行
./cli_wallet -s ws://127.0.0.1:11010
-s 后面接的 ws://127.0.0.1:11010就是上面witness_node 开放的控制接口
这时,我们看到的是如下的命令提示符:
new >>>
因为第一次打开,因此需要我们创建一个密码。这个密码是钱包的解锁密码,只在本地有效:
new >>> set_password 123456
set_password 123456
null
locked >>>
此时密码已经创建成功,需要我们解锁后才能进一步操作:
locked >>> unlock 123456
unlock 123456
null
unlocked >>>
然后是导入你的CTS账户,这里,我们以miner-test为例。
命令格式为
import_keys 账户名 私钥 true
其中,私钥需要在网页钱包https://www.citshares.org/ 的 权限那一页(Permissions),找到
Active Permissions标签,点击下面的钥匙获取。可以参考这篇帖子:
https://steemit.com/cts/@citshares/citshares实际命令如下:
unlocked >>> import_key miner-test 5KgqzpMULCcB6eyEAhK64bgErtjgm5nFUgPK3cwPtxRbFEeZi6w true
import_key miner-test 5KgqzpMULCcB6eyEAhK64bgErtjgm5nFUgPK3cwPtxRbFEeZi6w true
2854162ms th_a wallet.cpp:799 save_wallet_file ] saving wallet to file wallet.json
2854163ms th_a wallet.cpp:818 save_wallet_file ] saved successfully wallet to tmp file wallet.json.tmp
2854163ms th_a wallet.cpp:824 save_wallet_file ] validated successfully tmp wallet file wallet.json.tmp
2854163ms th_a wallet.cpp:828 save_wallet_file ] renamed successfully tmp wallet file wallet.json.tmp
2854163ms th_a wallet.cpp:835 save_wallet_file ] successfully saved wallet to file wallet.json
2854164ms th_a wallet.cpp:476 copy_wallet_file ] backing up wallet wallet.json to after-import-key-b6856118.wallet
true
unlocked >>>
看到true之后,就说明我们导入成功。接下来,我们导入余额
命令格式为:
import_balance 用户名 [私钥] true
跟导入账户类似,只不过私钥需要用 [] 符号括起来。具体命令如下:
unlocked >>> import_balance miner-test [5KgqzpMULCcB6eyEAhK64bgErtjgm5nFUgPK3cwPtxRbFEeZi6w] true
import_balance miner-test [5KgqzpMULCcB6eyEAhK64bgErtjgm5nFUgPK3cwPtxRbFEeZi6w] true
[]
unlocked >>>
挖矿要成为见证人,需要升级账户,这里要花费几百个CTS, 没有CTS朋友可以在帖子下面留言,我会免费给你CTS。
升级账户:
unlocked >>> upgrade_account miner-test true
upgrade_account miner-test true
{
"ref_block_num": 58815,
"ref_block_prefix": 1460128007,
"expiration": "2019-02-01T03:36:00",
"operations": [[
8,{
"fee": {
"amount": 69470219,
"asset_id": "1.3.0"
},
"account_to_upgrade": "1.2.3144",
"upgrade_to_lifetime_member": true,
"extensions": []
}
]
],
"extensions": [],
"signatures": [
"2008c6abb6859eef53c849f45ea11e7292c691b5939ce43bfaeed1f94142fe6e4a7d3d8da98599822675bf5c1e8367881818876507c671d62f8b4e6b19355f169d"
]
}
unlocked >>>
创建见证人:
unlocked >>> create_witness miner-test "
https://www.citshares.org" true
create_witness miner-test "
https://www.citshares.org" true
{
"ref_block_num": 59085,
"ref_block_prefix": 2779994760,
"expiration": "2019-02-01T03:49:30",
"operations": [[
20,{
"fee": {
"amount": 28945924,
"asset_id": "1.3.0"
},
"witness_account": "1.2.3144",
"url": "
https://www.citshares.org",
"block_signing_key": "CTS8EP18sKptFf9J9rZFyrds1L6ysjd2LteHa2zMNhd4Yov8nNxWD"
}
]
],
"extensions": [],
"signatures": [
"1f693ae409818df4cf0156a1744a9737febcf58da6a3be99b3d3dcd882343dc8b5761572af44ccc74f1e64e14b07a8dd76644876e19635eebffb5a4045fe445404"
]
}
unlocked >>>
此时,见证人已经创建成功,我们可以看一下自己的见证人编号:
unlocked >>> get_witness miner-test
get_witness miner-test
{
"id": "1.6.13",
"witness_account": "1.2.3144",
"last_aslot": 0,
"signing_key": "CTS8EP18sKptFf9J9rZFyrds1L6ysjd2LteHa2zMNhd4Yov8nNxWD",
"vote_id": "1:25",
"total_votes": 0,
"url": "
https://www.citshares.org",
"total_missed": 0,
"last_confirmed_block_num": 0
}
unlocked >>>
我们可以看到,miner-test的见证人编号是 1.6.13.
接下来,为自己的见证人投票:
unlocked >>> vote_for_witness miner-test miner-test true true
vote_for_witness miner-test miner-test true true
{
"ref_block_num": 59130,
"ref_block_prefix": 381798052,
"expiration": "2019-02-01T03:51:45",
"operations": [[
6,{
"fee": {
"amount": 811,
"asset_id": "1.3.0"
},
"account": "1.2.3144",
"new_options": {
"memo_key": "CTS6NWLS4WYQuACRMf8HBjC9yWDPQkcEymwqNbmkYQMKeNLvv7DJz",
"voting_account": "1.2.5",
"num_witness": 0,
"num_committee": 0,
"votes": [
"1:25"
],
"extensions": []
},
"extensions": {}
}
]
],
"extensions": [],
"signatures": [
"1f0c638e6cc0a969498901d5b607c78a7fd539932b6203048b8c07bb99dfd72edc0e99951406a8f7cf2871c5e42a257f9f0aa6768a14396a161ceb72524aa933b0"
]
}
unlocked >>>
大家可以把要挖矿的账户留言给我们,我们会为大家投票。
接下来是创建一个专门用于挖矿的密钥对:
unlocked >>> suggest_brain_key
suggest_brain_key
{
"brain_priv_key": "COMPOLE SCUTULA ANNELID SHINILY LITER LIMNIAD TERRAL OSELA DEFROST MORICHE RABIES SUING CAR SHOEMAN SALITE GLANS",
"wif_priv_key": "5J8P7YrjVrxU93PYAGpv4SxyZvhGUqMgBZEUr4B6D1UW2YCeTCC",
"pub_key": "CTS5qKNzpPbbaVyX5v6b3Ma6PJLw63dWBgAazSG8o7Mu3d8AAMGuV"
}
unlocked >>>
记下上面的pub_key与wif_priv_key.这将是我们用于挖矿的密钥对。将上面的公钥发布出去。
unlocked >>> update_witness miner-test "
https://steemit.com/cts/@citshares/citshares" CTS5qKNzpPbbaVyX5v6b3Ma6PJLw63dWBgAazSG8o7Mu3d8AAMGuV true
update_witness miner-test "
https://steemit.com/cts/@citshares/citshares" CTS5qKNzpPbbaVyX5v6b3Ma6PJLw63dWBgAazSG8o7Mu3d8AAMGuV true
{
"ref_block_num": 59201,
"ref_block_prefix": 2203175663,
"expiration": "2019-02-01T03:55:18",
"operations": [[
21,{
"fee": {
"amount": 5789,
"asset_id": "1.3.0"
},
"witness": "1.6.13",
"witness_account": "1.2.3144",
"new_url": "
https://steemit.com/cts/@citshares/citshares",
"new_signing_key": "CTS5qKNzpPbbaVyX5v6b3Ma6PJLw63dWBgAazSG8o7Mu3d8AAMGuV"
}
]
],
"extensions": [],
"signatures": [
"206921a27d7e069e7f08c8013e6e1f66cac7e3524737f64a5406869f83386446867b8091e4261daa63ed3d23871f1969ead8ad48ed1c603033638550f1b76882fa"
]
}
unlocked >>>
切记,上面使用的是pub_key,千万不要把私钥发布出去。
接下来,配置我们的witness_node ,将挖矿的密钥对配置进去。
回到运行witness_node 的终端,用Ctrl - C 将原来的witness_node 停止。
打开当前 witness_node_data_dir目录下的config.ini文件。
添加如下的两行数据:
witness-id = "1.6.13"
private-key = ["CTS5qKNzpPbbaVyX5v6b3Ma6PJLw63dWBgAazSG8o7Mu3d8AAMGuV","5J8P7YrjVrxU93PYAGpv4SxyZvhGUqMgBZEUr4B6D1UW2YCeTCC"]
再次运行witness_node:
./witness_node --replay-blockchain --rpc-endpoint 127.0.0.1:11010
接下来就是等待。
等待投票数量大于一定阈值。可以在cli_wallet的命令行下,用如下的命令查询是否是活动见证人:
unlocked >>> get_global_properties
在其中的active_witnesses 这一项,查看是否包含对应的 "1.6.13" id即可。
提取挖矿收益
正在cli_wallet的命令行下运行:
withdraw_vesting miner-test 1000 CTS true
允许提取的金额可以通过
get_witness miner-test
查看