用steem官方docker镜像中的命令行钱包cli_wallet将账号提升为见证人witness账号

in #zzan5 years ago (edited)

用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. 主要流程

  1. 搭建本地环境
  2. 获取官方镜像
  3. docker方式运行 cli_wallet
  4. 导入账号的密钥
  5. 生成见证人需要的密钥对
  6. 更新见证人到steem链上
  7. 投票给新发布的见证人

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"]
}

其他可选:

  1. 中国科技大学:https://docker.mirrors.ustc.edu.cn
  2. Docker 官方中国区:https://registry.docker-cn.com
  3. 网易:http://hub-mirror.c.163.com
  4. 阿里云: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 >>> 

其中:

  1. wif_priv_key 为私钥,见证人节点服务器运行steemd时需要配置的密钥,用来生产区块时的签名;
  2. 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
其中:

  1. "tex.fund" : 为见证人账号
  2. "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 .
投票给新发布的见证人

Sort:  

太详细了,很多教程都是把账号的active key作为见证人的密钥,很显然不符合逻辑.还是这篇文章讲密钥对,比较合理.

靠,你们搞帮派啦?还是拖拉机啊!

高啊搞啊!shop

你好鸭,manabot3!

@manabank给您叫了一份外卖!

@annepink 萍萍 迎着闪电 徒步 给您送来
四喜丸子

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~
@onepagex

需要啊,节点服务不需要见证人账号(但是不能生产区块数据了).见证人账号也设置到节点服务的配置中,全网才能计算有效时间,还需要投票数量,连着累积,才能出块,获得奖励呢.

除非用于研发,否则没有人投票,很难参与区块生产吧?很费钱?

Hello @acu.fund! You are amazing!


command: !thumbup is powered by witness @justyy and his contributions are: https://steemyy.com
More commands are coming!

你好鸭,acu.fund!

@sherryzhou给您叫了一份外卖!

@honoru 米高 迎着台风 骑着飞鸽 给您送来
高端大气巧克力

吃饱了吗?跟我猜拳吧! 石头,剪刀,布~

如果您对我的服务满意,请不要吝啬您的点赞~
@onepagex

进不了TOP20,好像都亏钱呢,目前steem都跌倒TOP 88了,谁敢投啊?

就当一个博客内容的备份平台,不花钱,不是挺好的?

进TOP20不太容易呢,中文区一个也没有,没见过不重视中文市场,能搞好的区块链项目.

靠这个挣钱?想钱想疯了吧?你

Steem Flag Rewards mention comment has been approved for SFR Token Issuance!

Tokens will be transferrred when the flagged content reaches payout.

Thank you for reporting this abuse, @lebin.

  • collusive voting
    The votes on the content follows a repeated pattern suggestive of collusion between multiple users and /or alt accounts resulting in signficant overvaluation of content.

This post was submitted via our Discord Community channel. Check us out on the following link!
SFR Discord

是应该扩大中文社区的世界影响力,好文就要走出世界,应该组织一个翻译队,也翻译成韩文、日文.

可惜,我也只会英文.
很期待会日韩文,是什么样子?:)美女比较多吧?
steem上中文社区美女不多吧?

中文区有哪些见证人啊?应该有个中文区的群组,大家即时交流互动.

别用WX了,都FQ了,还用!discord最好

中文区有几个见证人大牛啊?有TOP20的吗?扶持一下新手吗:(

老大,怎么被downvote了?默哀一下!呵呵

@ocdb25 @threespeak
能知道你们为何为这篇文章downvote吗?这是篇原创文章啊?!内容有问题吗?谢谢
Can I know why you downvote for this article? This is an original article?! Is there a problem with the content?thanks

Steem Flag Rewards mention comment has been approved for SFR Token Issuance!

Tokens will be transferrred when the flagged content reaches payout.

Thank you for reporting this abuse, @lebin.

  • collusive voting
    The votes on the content follows a repeated pattern suggestive of collusion between multiple users and /or alt accounts resulting in signficant overvaluation of content.

This post was submitted via our Discord Community channel. Check us out on the following link!
SFR Discord

Steem Flag Rewards mention comment has been approved for SFR Token Issuance!

Tokens will be transferrred when the flagged content reaches payout.

Thank you for reporting this abuse, @lebin.

  • collusive voting
    The votes on the content follows a repeated pattern suggestive of collusion between multiple users and /or alt accounts resulting in signficant overvaluation of content.

This post was submitted via our Discord Community channel. Check us out on the following link!
SFR Discord