用steem官方docker镜像中的命令行钱包cli_wallet将账号提升为见证人witness账号
目录
1. 目标
2. 主要流程
3. 搭建本地环境
4. 获取官方镜像
5. docker方式运行 cli_wallet
6. 导入账号的密钥
7. 生成见证人需要的密钥对
8. 更新见证人到steem链上
9. 投票给新发布的见证人
1. 目标
steem中的见证人witness账号,只是普通账号,最一个特别的声明.但可惜的是,网络上找不到完整有效的最新中文教程,怎么把普通账号升级为见证人账号.
目前steem刚完成硬分叉22,在源代码中的代号为HF22,网络上的英文教程和以及第三方工具都已经无法操作.
所以本文不依赖第三方工具,直接利用steem官方docker镜像中的命令行钱包 cli_wallet
,将账号提升为见证人账号.这样做,更加安全.
cli_wallet 是 Steem 的命令行钱包,可直接和 Steem 节点交互,完成很多重要的钱包相关的操作;升级账号为见证人,也可以通过这个钱包实现.
不过cli_wallet需要Steem节点支持WebSocket RPC(ws/wss),暂时以比较容易访问的wss://steemd.privex.io
作为交互节点服务器.后续可以出专门的教程,搭建自己的节点服务器.
2. 主要流程
- 搭建本地环境
- 获取官方镜像
- docker方式运行 cli_wallet
- 导入账号的密钥
- 生成见证人需要的密钥对
- 更新见证人到steem链上
- 投票给新发布的见证人
3. 搭建本地环境
ubuntu18.04 安装 docker
这里以ubuntu18.04为例,安装docker包:
$ sudo apt update && sudo apt install git containerd docker.io -y
启动服务:$ service docker restart
查看日志:$ systemctl status docker.service
添加专用系统账户 steemd
添加专用系统账户 steemd,并加入到 docker 组,steemd用户可直接运行docker:
$ sudo adduser steemd
$ sudo usermod -aG sudo steemd
$ sudo usermod -aG docker steemd
$ sudo su - steemd
4. 获取官方镜像
使用steem官方的 docker 镜像(也可以自己从github上下载源码编译):
$ docker pull steemit/steem
查看获取情况 :
$ docker images | grep steemit
steemit/steem latest 1326e0 1 weeks ago 2.24GB
如果无法访问官方 docker.com/docker.io ,可修改镜像源:
$ sudo vi /etc/docker/daemon.json
{
"registry-mirrors": ["https://registry.docker-cn.com","http://hub-mirror.c.163.com"]
}
其他可选:
- 中国科技大学:https://docker.mirrors.ustc.edu.cn
- Docker 官方中国区:https://registry.docker-cn.com
- 网易:http://hub-mirror.c.163.com
- 阿里云:https://pee6w651.mirror.aliyuncs.com
5. docker方式运行 cli_wallet
以docker镜像方式运行 cli_wallet:
$ docker run -it steemit/steem /usr/local/steemd-default/bin/cli_wallet -s wss://steemd.privex.io
返回信息:
Logging RPC to file: logs/rpc/rpc.log
Starting a new wallet
36ms main.cpp:169 main ] wdata.ws_server: wss://steemd.privex.io
Please use the set_password method to initialize a new wallet before continuing
new >>>
首次使用,需要设置本地钱包密码:
new >>> set_password yourpwd
返回信息:
new >>> set_password yourpwd
set_password yourpwd
null
locked >>>
解锁钱包:
locked >>> unlock yourpwd
返回信息:
locked >>> unlock yourpwd
unlock yourpwd
null
unlocked >>>
如无反应,可能是 cli_wallet 断开了和steem节点间的连接;则ctrl+d退出,重新登录 cli_wallet
6. 导入账号的密钥
导入账号的钱包密钥(active key):
unlocked >>> import_key 5J-account-active-key
返回信息:
import_key 5J-account-active-key
3571ms wallet.cpp:42 save_wallet_file ] saving wallet to file wallet.json
true
unlocked >>>
7. 生成见证人需要的密钥对
生成见证人打包区块所需要的密钥对:
unlocked >>> suggest_brain_key
suggest_brain_key
{
"brain_priv_key": "WACE be your words COGNATE",
"wif_priv_key": "5J-wif_priv_key-str",
"pub_key": "STM-pub_key-str"
}
unlocked >>>
其中:
wif_priv_key
为私钥,见证人节点服务器运行steemd时需要配置的密钥,用来生产区块时的签名;pub_key
为公钥,需要发布到steem区块链上,供全网应用。
8. 更新见证人到steem链上
用 'update_witness' 命令将公钥
pub_key
发布到链上:unlocked >>> update_witness "tex.fund" "https://tex.fund" "STM-pub_key-str" {"account_creation_fee":"3.000 STEEM","maximum_block_size":655360,"sbd_interest_rate":0} true
其中:
- "tex.fund" : 为见证人账号
- "https://tex.fund": 为见证人链接,可以是独立官网,也可以是steemit官网 #witness-category 标签下的见证人公告贴子,方便别人了解.
返回信息:
{
"ref_block_num": 26255,
"ref_block_prefix": 597975414,
"expiration": "2019-10-13T15:03:09",
"operations": [[
"witness_update",{
"owner": "tex.fund",
"url": "https://tex.fund",
"block_signing_key": "STM6MiTh",
"props": {
"account_creation_fee": "3.000 STEEM",
"maximum_block_size": 655360,
"sbd_interest_rate": 0,
"account_subsidy_budget": 797,
"account_subsidy_decay": 347321
},
"fee": "0.000 STEEM"
}
]
],
"extensions": [],
"signatures": [
"1f6b5aba87d2da1"
],
"transaction_id": "fe24df02c",
"block_num": 37250704,
"transaction_num": 14
}
9. 投票给新发布的见证人
自己先给自己的见证人投一票吧:浏览器打开 https://steemitwallet.com/~witnesses .