揭秘见证人系列:如何成为一名见证人?(简介版)

in HIVE CN 中文社区2 months ago

自从2018年9月23日我的见证人出了第一个块以来,时间已经过去了近六年。这期间我发帖介绍过见证人的选择方、见证人收益等诸多方面的内容,但是如何成为一名见证人呢?

<p dir="auto"><img src="https://images.hive.blog/DQmTqegF1ThhsCkyGA1cTZgqoYmytKo3iuR4pKXMNaZJose/image.png" alt="image.png" /><br /> (图源 :<a href="https://pixabay.com/vectors/rocket-science-spaceship-space-3122690/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">pixabay) <p dir="auto">如果五六年前有人问我这个问题,趁着自己弄见证人的热乎劲,或许能说上一二;而现在虽然见证人节点跑得还算稳定,但是如何从头做起,我也有点懵圈。 <p dir="auto">所以努力回想一下自己当初如何去弄的,以及这些年做见证人了解到的信息,简单说一下如何成为一名见证人。 <h1>准备服务器 <p dir="auto">见证人做的最主要的一件事就是运行见证人节点,原则上只要配置够用且能上网的机器就可以拿来跑见证人节点,比如说我家里的大台机。 <p dir="auto">但是家庭网络的稳定性很难保证,如果不稳定、延迟大,那么轮到自己出块时,丢块就会成为家常便饭。经常丢块的见证人肯定不受欢迎的啦。 <p dir="auto">所以想运行见证人节点,首先要有一台配置够用、带宽够大、网络稳定的服务器(或者VPS)。 <p dir="auto">当年我刚开始做见证人时买了两台如下配置的VPS: <blockquote> <p dir="auto">16核心E5-2697<br /> 64G内存<br /> 1280G的SSD存储 <p dir="auto">为什么要买两台呢,当然是一主一备喽,如果主力见证人出问题(或者升级)就拿备份的顶上。 <p dir="auto">这两台VPS每月耗费我640美元,因为我的见证人排名较低,做了好久见证人,我都是巨亏的,哭死。 <p dir="auto">现在回头看,当年一下子上两台VPS简直就是败家,完全可以主力节点用VPS,家里电脑上运行备份节点。而且配置方面,运行节点32G内存也够用。当然了,有条件的话,内存越大越好喽。 <p dir="auto">我现在主力见证人用的是这个配置:<br /> <img src="https://images.hive.blog/DQmU4sCKV1PikYNTLRoacAVMWH4pF2GZmWL3KdL7JGwRf3P/image.png" alt="image.png" /> <p dir="auto">上述配置每月192美元,目前我的见证人节点收益也就刚刚够支付这个费用的(再跌就又到亏损状态了),这还只是VPS费用,没算人力呀,家里电脑的费用+电费等等,说是为爱发电,一点不假呀。 <p dir="auto">服务器准备就绪后,需要安装Ubuntu 22.04.4 LTS,然后根据自己的需求,做适当的加固,不然三两天被黑,就成笑话了。 <h1>编译 & 运行hived <p dir="auto">运行HIVE见证人节点,其实就是运行hived程序,所以我们首先需要编译hived。 <p dir="auto">编辑hived的具体操作可以参考<a href="https://gitlab.syncad.com/hive/hive/-/blob/master/doc/building.md" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">Building hived (Hive blockchain P2P node),别忘记同时编译命令行钱包,我们需要用它来进行一些设置工作。 <p dir="auto">这里说一下为什么要自己编译而不是使用网上现成的二进制文件,这是因为hived可能时不时地发布新版本或者硬分叉之类的,自己编译就可以第一时间更新节点,而不用等别人发布新版本的二进制文件。 <p dir="auto">(顺便插一句,编译可以在其它机器上完成,配置(尤其是CPU主频、线程数)越高的机器,编译起来越快一些。) <p dir="auto">编译完成后,我们就可以在服务器上运行自己的HIVE节点啦。 <p dir="auto">初次运行,我们还需要同步区块链历史数据。 <p dir="auto">好多年以前,数据量不是很大的时候,我们可以直接从链上同步数据,但是当前未压缩版本的block_log数据已经高达934G(压缩版本当前为488G,这个数据不同机器上可能不同),直接从链上同步将会耗费很长时间。 <p dir="auto"><a href="https://gtg.openhive.network/get/blockchain/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">block_log以及block_log.artifacts的直接下载。<span>好在<a href="/@gtg">@gtg 大佬提供压缩版本 <p dir="auto">我们下载相应的文件到对应的目录,然后replay(重播)区块链即可。 <p dir="auto">这里着重提两项设置,一个是<strong><em>在内存中replay/run HIVE节点,在设置文件中: <blockquote> <p dir="auto">将:shared-file-dir = "blockchain"<br /> 修改为:shared-file-dir = /dev/shm <p dir="auto">如果使用压缩模式,那么配置文件中需要添加如下设置: <blockquote> <p dir="auto"><code>enable-block-log-compression = 1<br /> <code># Block log zstd compression level 0 (fast, low compression) - 22 (slow, high compression)<br /> <code>block-log-compression-level = 15 <h1>启用见证人 <p dir="auto">好,现在我们已经有了服务器并将HIVE节点编译&运行起来,这是所有HIVE节点都要做的事情。那么作为见证人节点,又要做些什么呢? <p dir="auto"><span>首先我们需要一个账户,这个可以是我们现有的账户也可以是独立的账户,比如我就直接用<a href="/@oflyhigh">@oflyhigh,有的见证人则用类似 <a href="/@oflyhigh.witness">@oflyhigh.witness这样的账户。 <p dir="auto">有了见证人账户后,我们还需要给它准备一对出块密钥对,我们可以使用自己习惯的工具生成密钥对,命令行钱包指令如下: <blockquote> <p dir="auto"><code>suggest_brain_key <p dir="auto">上述指令会生成如下密钥对: <blockquote> <p dir="auto"><code>"brain_priv_key": "TANGY VOYAGER SALIVAL BOGGISH REFEREE ARGOTIC AZIMENE JACKASS EMBAR TOILING ENDOW VALGUS BEHOOT SYNEMA BOOD BOOLYA",<br /> <code>"wif_priv_key": "5KcXsZuHRSxc4R6STHDzg3r8VXu69SuQM7QcRPFW9MoS67D7EUf",<br /> <code>"pub_key": "STM7TfdVScSioLUbAsj9X5PcpZP8xBigAiYsRUvmZM39iXRzXogKf" <p dir="auto">接下来要做的事情就是在节点配置文件中添加见证人相关设置,比如: <blockquote> <p dir="auto"><code>witness = "oflyhigh"<br /> <code>private-key = 5KcXsZuHRSxc4R6STHDzg3r8VXu69SuQM7QcRPFW9MoS67D7EUf <p dir="auto">然后,别忘记启用见证人插件(其它插件则根据个人需要启用): <blockquote> <p dir="auto"><code>plugin = witness <p dir="auto">接下来,我们在网络上启用 \注册见证人,命令行钱包指令如下(需要对应账户的active key以上权限): <blockquote> <p dir="auto"><code>update_witness "username" "见证人网站或者介绍url" "STM7TfdVScSioLUbAsj9X5PcpZP8xBigAiYsRUvmZM39iXRzXogKf" {"account_creation_fee":"3.000 HIVE","maximum_block_size":65536,"hbd_interest_rate":2000} true <p dir="auto">做完这些以后,就可以开始拉票,然后等待见证人出块啦。可以使用如下工具查询见证人排名以及出块、丢块情况: <blockquote> <p dir="auto"><span><a href="https://www.cutehive.com/witnesses.php" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://www.cutehive.com/witnesses.php <h1>其它信息 <p dir="auto">以上就是运行一个见证人节点的简单介绍。 <p dir="auto">除此之外,见证人们还要及时更新区块链系统的一些参数(<code>witness_update)以及发布喂价(<code>feed_publish)等,来维持HIVE区块链的稳定运行。 <p dir="auto">为了避免见证人节点崩溃导致丢块等,见证人们还需要设置备份节点以及监控\切换脚本来完成故障时主备切换等等。 <p dir="auto">还有就是及时跟进处理各种版本更新、硬分叉等等,有能力的还要参与代码开发、编写等等等等。 <p dir="auto">总之,除了运行见证人节点外,还要尽可能地为HIVE区块链做贡献,这样才是一个合格的见证人,才能得到更多用户的投票支持哦。 <p dir="auto"><img src="https://images.hive.blog/DQmPv6vqX14Yn1CSfRP3KioCXKBMRri9Kj2VDacEbwSNX1h/image.png" alt="image.png" /><br /> (图源 :<a href="https://pixabay.com/photos/men-beers-cheers-toast-bottles-1854191/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">pixabay) <p dir="auto">这里顺便求一下见证人票: <blockquote> <p dir="auto"><br /> 更欢迎<strong><em><a href="https://hivesigner.com/sign/account-witness-proxy?proxy=oflyhigh&approve=1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">设置@oflyhigh 成为你的见证人代理哦!非常感谢!<span>欢迎大家支持见证人:<a href="/@abit">@abit 以及 <a href="/@oflyhigh">@oflyhigh <h1>相关链接 <ul> <li><strong><em><a href="https://hivesigner.com/sign/account-witness-proxy?proxy=oflyhigh&approve=1" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">设置@oflyhigh 成为你的见证人代理 <li><span><a href="https://www.cutehive.com/witnesses.php" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://www.cutehive.com/witnesses.php <li><span><a href="https://gtg.openhive.network/get/blockchain/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://gtg.openhive.network/get/blockchain/ <li><span><a href="https://gitlab.syncad.com/hive/hive/" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://gitlab.syncad.com/hive/hive/ <li><span><a href="https://gitlab.syncad.com/hive/hive/-/blob/master/doc/building.md" target="_blank" rel="noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://gitlab.syncad.com/hive/hive/-/blob/master/doc/building.md
Sort:  

Actually, you don't have to explicitly set compression settings in your config.ini file, and it's actually better if you omit them and just use defaults.

Thank you very much for the information.

Of course - whenever you need help with anything Hive / witness related feel free to ask, either in comments or on #witness channel on OpenHive.Chat

感谢O哥的分享,专业的事情交给专业的人去做,见证人这碗饭,我肯定是吃不了了😂

不,你可以见证爱情,小影

感谢O哥这样的大佬们,运行节点,我们才能流畅使用hive前端

看来成为见证人付出蛮多的呀👍

谢谢O哥的辛苦付出

没想到这么复杂,O哥真厉害,永远支持你!