EOSIO 4.0 测试网络启动教程

简介:

EOS4.0在昨天已经发布,本片文章将介绍EOS4.0网络的搭建过程。

与EOS3.0相比,EOS4.0无疑是具有重要意义的预发布版。其中对eosio.system合约的更改相当大。下面就来说一下搭建网络的具体步骤。

节点简介

首先说明一下,搭建测试网络的节点信息,以免后文更加清晰的讲述整个过程。

  1. node1(启动节点ip=111.11.11.111):
producer-name = eosio
http-server-address = 0.0.0.0:8888
p2p-listen-endpoint = 0.0.0.0:9876
p2p-peer-address = 222.22.22.222:9876
p2p-peer-address = 333.33.33.333:9876
enable-stale-production = true
  1. node2(启动节点:ip=222.22.22.222):
producer-name = eostea
http-server-address = 0.0.0.0:8888
p2p-listen-endpoint = 0.0.0.0:9876
p2p-peer-address = 111.11.11.111:9876
p2p-peer-address = 333.33.33.333:9876
enable-stale-production = false
  1. node3(启动节点:ip=333.33.33.333):
producer-name = eostea1
http-server-address = 0.0.0.0:8888
p2p-listen-endpoint = 0.0.0.0:9876
p2p-peer-address = 111.11.11.111:9876
p2p-peer-address = 222.22.22.222:9876
enable-stale-production = false

账号:lome, strahe, chare.

创建token

由于eosio.system已经没有发布代币的操作了,所有创建和发放代币只能通过eosio.token合约。

  1. 创建eosio.token账号
cleos  create account eosio eosio.token EOS67Cjewqdy9kiS3uAy8RRxuYFzc4BuhMZk1crw69tdH2cVQSMw5 EOS67Cjewqdy9kiS3uAy8RRxuYFzc4BuhMZk1crw69tdH2cVQSMw5

输出结果如下:

executed transaction: 4a96ee307283ca589fa9640f6e059b47bb25fae61c5b0cdb6a8810fa5a231131  288 bytes  218 us
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"eosio.token","owner":{"threshold":1,"keys":[{"key":"EOS67Cjewqdy9kiS3uAy8...
warning: transaction executed locally, but may not be confirmed by the network yet
  1. 发布eosio.token合约
cleos  set contract eosio.token eosio.token

结果如下:

Reading WAST/WASM from eosio.token/eosio.token.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: 04e7ef9d7434c9726b01ed964dfffc0d908f040993cb67c5a0138437e8f18e7f  8848 bytes  1421 us
#         eosio <= eosio::setcode               {"account":"eosio.token","vmtype":0,"vmversion":0,"code":"0061736d010000000182011560067f7e7f7f7f7f00...
#         eosio <= eosio::setabi                {"account":"eosio.token","abi":{"types":[],"structs":[{"name":"transfer","base":"","fields":[{"name"...
warning: transaction executed locally, but may not be confirmed by the network yet
  1. 创建EOS代币
cleos  push action eosio.token create '["eosio","1000000000.0000 EOS",0,0,0]' -p eosio.token

结果如下:

executed transaction: 49fda5d0a205d867c5f92dfe1ca272bc399957c50e34340b1526fa2016da693f  208 bytes  4586 us
#   eosio.token <= eosio.token::create          {"issuer":"eosio","maximum_supply":"1000000000.0000 EOS","can_freeze":0,"can_recall":0,"can_whitelis...
warning: transaction executed locally, but may not be confirmed by the network yet
  1. 发布代币
cleos  push action eosio.token issue '["eosio","1000000000.0000 EOS","issue"]' -p eosio

结果如下:

executed transaction: 33e6433957063ccea8c0afeb26c101b3064079622416b7e471e1e4a91d962124  216 bytes  632 us
#   eosio.token <= eosio.token::issue           {"to":"eosio","quantity":"1000000000.0000 EOS","memo":"issue"}
>> issueeosio balance: 1000000000.0000 EOS
warning: transaction executed locally, but may not be confirmed by the network yet

发布eosio.system合约

注意: 

  1. 必须创建代币后才能发布合约
  2. 运行节点的主机速度必须块否则,发布合约可能会失败最后内存在16G以上。
cleos  set contract eosio eosio.system

运行结果:

Reading WAST/WASM from eosio.system/eosio.system.wasm...
Using already assembled WASM...
Publishing contract...
executed transaction: ff766928a0488566628c2ff37260937ab7b6ff2c235d65e844606754d11284a8  40368 bytes  5581 us
#         eosio <= eosio::setcode               {"account":"eosio","vmtype":0,"vmversion":0,"code":"0061736d0100000001c1023060027f7e0060067f7e7e7f7f...
#         eosio <= eosio::setabi                {"account":"eosio","abi":{"types":[],"structs":[{"name":"buyrambytes","base":"","fields":[{"name":"p...
warning: transaction executed locally, but may not be confirmed by the network yet

创建账号

由于用cleos create account会出现以下错误:

$ cleos create account eosio lome2 EOS67Cjewqdy9kiS3uAy8RRxuYFzc4BuhMZk1crw69tdH2cVQSMw5 EOS67Cjewqdy9kiS3uAy8RRxuYFzc4BuhMZk1crw69tdH2cVQSMw5
Error 3080001: account using more than allotted RAM usage
Error Details:
account lome2 has insufficient ram bytes; needs 2996 has 0

错误原因是账户的ram不足,至于解决办法,笔者没有深究。所以直接用eosio.system中的newaccount操作创建账户。

创建账户代码如下:

cleos  system newaccount eosio eostea EOS8Ar1fUGtZxcJ8Rdkh3rc55Vqg3ariR6fdBV8zxz4WgTW3nT73L EOS8Ar1fUGtZxcJ8Rdkh3rc55Vqg3ariR6fdBV8zxz4WgTW3nT73L --stake-net '50.00 EOS' --stake-cpu '50.00 EOS'

执行结果如下:

1170388ms thread-0   main.cpp:418                  create_action        ] result: {"binargs":"0000000000ea3055000000001895315500200000"} arg: {"code":"eosio","action":"buyrambytes","args":{"payer":"eosio","receiver":"eostea","bytes":8192}}
1171112ms thread-0   main.cpp:418                  create_action        ] result: {"binargs":"0000000000ea3055000000001895315580f0fa020000000004454f530000000080f0fa020000000004454f530000000000"} arg: {"code":"eosio","action":"delegatebw","args":{"from":"eosio","receiver":"eostea","stake_net_quantity":"50.0000 EOS","stake_cpu_quantity":"50.0000 EOS","transfer":false}}
executed transaction: 8eae5e1e2d3ce126920fe2aa6e44376eb7c901a34dc820b0b95b0f33f8618375  424 bytes  2472 us
#         eosio <= eosio::newaccount            {"creator":"eosio","name":"eostea","owner":{"threshold":1,"keys":[{"key":"EOS8Ar1fUGtZxcJ8Rdkh3rc55V...
>> eosio created eostea
#         eosio <= eosio::buyrambytes           {"payer":"eosio","receiver":"eostea","bytes":8192}
>> eosout: 0.1192 EOS 68719484928. RAM 999999.8808 EOS
#         eosio <= eosio::delegatebw            {"from":"eosio","receiver":"eostea","stake_net_quantity":"5000.0000 EOS","stake_cpu_quantity":"5000....
>> from: eosio to: eostea net: 5000.0000 EOS cpu: 5000.0000 EOStotalsvoters
warning: transaction executed locally, but may not be confirmed by the network yet

注册BP

注意这里的url是节点的http-server-address

代码如下:

cleos  system regproducer eostea EOS8Ar1fUGtZxcJ8Rdkh3rc55Vqg3ariR6fdBV8zxz4WgTW3nT73L http://http-server-address:8888

执行结果如下:

1381671ms thread-0   main.cpp:418                  create_action        ] result: {"binargs":"00000000189531550003b03a1cb0fa44023cbdb8cda51c2e0f08baf39742a6f50a241f4eee7b92c78a831a687474703a2f2f3134392e3132392e38312e3136333a36363636"} arg: {"code":"eosio","action":"regproducer","args":{"producer":"eostea","producer_key":"EOS8Ar1fUGtZxcJ8Rdkh3rc55Vqg3ariR6fdBV8zxz4WgTW3nT73L","url":"http://149.129.81.163:6666"}}
executed transaction: 835e6a4f8a892b607deac57beb64ccd558e95344ead9218a8cd8f6b51e8b6b15  256 bytes  879 us
#         eosio <= eosio::regproducer           {"producer":"eostea","producer_key":"EOS8Ar1fUGtZxcJ8Rdkh3rc55Vqg3ariR6fdBV8zxz4WgTW3nT73L","url":"h...
warning: transaction executed locally, but may not be confirmed by the network yet

转账

由于要投票必须要有EOS账号,所以在这之前通过newaccount创建投票账号。然后进行转账。

代码如下:

cleos  push action eosio.token transfer '["eosio", "lome","1000000000.0000 EOS","vote"]' -p eosio

执行结果如下:

executed transaction: 160c0e2bbd405f567dcf28e0db5c6eff12e80cb08a58dd66b5115bde27a7f44c  224 bytes  736 us
#   eosio.token <= eosio.token::transfer        {"from":"eosio","to":"eostea","quantity":"10000.0000 EOS","memo":"vote"}
>> transfer from eosio to eostea 10000.0000 EOS
#         eosio <= eosio.token::transfer        {"from":"eosio","to":"eostea","quantity":"10000.0000 EOS","memo":"vote"}
#        eostea <= eosio.token::transfer        {"from":"eosio","to":"eostea","quantity":"10000.0000 EOS","memo":"vote"}
warning: transaction executed locally, but may not be confirmed by the network yet

锁定代币

代码如下:

cleos system delegatebw lome lome '25000000.0000 EOS' '25000000.0000 EOS' --transfer

执行结果如下:

1717800ms thread-0   main.cpp:1002                 operator()           ] act_payload: {"from":"eostea","receiver":"eostea","stake_net_quantity":"5000.0000 EOS","stake_cpu_quantity":"5000.0000 EOS","transfer":true}
1718159ms thread-0   main.cpp:418                  create_action        ] result: {"binargs":"0000000018953155000000001895315580f0fa020000000004454f530000000080f0fa020000000004454f530000000001"} arg: {"code":"eosio","action":"delegatebw","args":{"from":"eostea","receiver":"eostea","stake_net_quantity":"5000.0000 EOS","stake_cpu_quantity":"5000.0000 EOS","transfer":true}}
executed transaction: 2eece2e97c122bb8403137290f492508b0ae0d625bc1cf56fe01348125658139  232 bytes  1996 us
#         eosio <= eosio::delegatebw            {"from":"eostea","receiver":"eostea","stake_net_quantity":"5000.0000 EOS","stake_cpu_quantity":"5000...
>> from: eostea to: eostea net: 5000.0000 EOS cpu: 5000.0000 EOStotalsvoters
#   eosio.token <= eosio.token::transfer        {"from":"eostea","to":"eosio","quantity":"10000.0000 EOS","memo":"stake bandwidth"}
>> transfer from eostea to eosio 10000.0000 EOS
#        eostea <= eosio.token::transfer        {"from":"eostea","to":"eosio","quantity":"10000.0000 EOS","memo":"stake bandwidth"}
#         eosio <= eosio.token::transfer        {"from":"eostea","to":"eosio","quantity":"10000.0000 EOS","memo":"stake bandwidth"}
warning: transaction executed locally, but may not be confirmed by the network yet

投票

激动人心的时刻到了,我们要进行投票了,在这之前,我已经在lome,strahe,chare三个投票账户分别抵押了5千万EOS,可能许多朋友都猜到了,是的,需要150,000,000.0000 TOKENS投票才能解锁网络。

投票代码如下:

cleos system voteproducer prods lome eostea

结果如下:

2581429ms thread-0   main.cpp:418                  create_action        ] result: {"binargs":"0000000000a0248d0000000000000000010000000018953155"} arg: {"code":"eosio","action":"voteproducer","args":{"voter":"lome","proxy":"","producers":["eostea"]}}
executed transaction: 5a752a45a5b26613394fecd082cdd26b0726168731e37c85f1777dbba6dff093  208 bytes  1372 us
#         eosio <= eosio::voteproducer          {"voter":"lome","proxy":"","producers":["eostea"]}
>> orig total_votes: 4.034073698549329e+22 delta: 2.017036849274665e+26
warning: transaction executed locally, but may not be confirmed by the network yet

当你的投票数超过150M时,你的节点BP将开始产生区块。

后记: 这就是一个EOS4.0测试网络搭建的全过程,但其中还有许多的东西,笔者并未深究。

例如:
1.是否投票后需要锁定三天,取消抵押需要三天后才生效。
2.创建账号是否只能够使用eosio.system合约中的newaccount
等等。。

希望后来者提出更多的问题,也期望后来者能来解决问题,谢谢~

原文链接: https://eosfans.io/topics/454

目录
相关文章
|
2月前
|
机器学习/深度学习 PyTorch 算法框架/工具
目标检测实战(一):CIFAR10结合神经网络加载、训练、测试完整步骤
这篇文章介绍了如何使用PyTorch框架,结合CIFAR-10数据集,通过定义神经网络、损失函数和优化器,进行模型的训练和测试。
145 2
目标检测实战(一):CIFAR10结合神经网络加载、训练、测试完整步骤
|
2月前
|
安全 网络安全
Kali渗透测试:使用Armitage扫描网络
Kali渗透测试:使用Armitage扫描网络
63 3
|
1月前
|
存储 数据可视化 API
重磅干货,免费三方网络验证[用户系统+CDK]全套API接口分享教程。
本套网络验证系统提供全面的API接口,支持用户注册、登录、数据查询与修改、留言板管理等功能,适用于不想自建用户系统的APP开发者。系统还包含CDK管理功能,如生成、使用、查询和删除CDK等。支持高自定义性,包括20个自定义字段,满足不同需求。详细接口参数及示例请参考官方文档。
|
1月前
|
数据库连接 Go 数据库
Go语言中的错误注入与防御编程。错误注入通过模拟网络故障、数据库错误等,测试系统稳定性
本文探讨了Go语言中的错误注入与防御编程。错误注入通过模拟网络故障、数据库错误等,测试系统稳定性;防御编程则强调在编码时考虑各种错误情况,确保程序健壮性。文章详细介绍了这两种技术在Go语言中的实现方法及其重要性,旨在提升软件质量和可靠性。
29 1
|
1月前
|
机器学习/深度学习 自然语言处理 前端开发
前端神经网络入门:Brain.js - 详细介绍和对比不同的实现 - CNN、RNN、DNN、FFNN -无需准备环境打开浏览器即可测试运行-支持WebGPU加速
本文介绍了如何使用 JavaScript 神经网络库 **Brain.js** 实现不同类型的神经网络,包括前馈神经网络(FFNN)、深度神经网络(DNN)和循环神经网络(RNN)。通过简单的示例和代码,帮助前端开发者快速入门并理解神经网络的基本概念。文章还对比了各类神经网络的特点和适用场景,并简要介绍了卷积神经网络(CNN)的替代方案。
114 1
|
1月前
|
缓存 测试技术 Apache
告别卡顿!Python性能测试实战教程,JMeter&Locust带你秒懂性能优化💡
告别卡顿!Python性能测试实战教程,JMeter&Locust带你秒懂性能优化💡
53 1
|
2月前
|
自然语言处理 机器人 Python
ChatGPT使用学习:ChatPaper安装到测试详细教程(一文包会)
ChatPaper是一个基于文本生成技术的智能研究论文工具,能够根据用户输入进行智能回复和互动。它支持快速下载、阅读论文,并通过分析论文的关键信息帮助用户判断是否需要深入了解。用户可以通过命令行或网页界面操作,进行论文搜索、下载、总结等。
66 1
ChatGPT使用学习:ChatPaper安装到测试详细教程(一文包会)
|
1月前
|
编解码 安全 Linux
网络空间安全之一个WH的超前沿全栈技术深入学习之路(10-2):保姆级别教会你如何搭建白帽黑客渗透测试系统环境Kali——Liinux-Debian:就怕你学成黑客啦!)作者——LJS
保姆级别教会你如何搭建白帽黑客渗透测试系统环境Kali以及常见的报错及对应解决方案、常用Kali功能简便化以及详解如何具体实现
|
2月前
|
弹性计算 Kubernetes 网络协议
阿里云弹性网络接口技术的容器网络基础教程
阿里云弹性网络接口技术的容器网络基础教程
阿里云弹性网络接口技术的容器网络基础教程
|
2月前
|
机器学习/深度学习 数据采集 算法
目标分类笔记(一): 利用包含多个网络多种训练策略的框架来完成多目标分类任务(从数据准备到训练测试部署的完整流程)
这篇博客文章介绍了如何使用包含多个网络和多种训练策略的框架来完成多目标分类任务,涵盖了从数据准备到训练、测试和部署的完整流程,并提供了相关代码和配置文件。
64 0
目标分类笔记(一): 利用包含多个网络多种训练策略的框架来完成多目标分类任务(从数据准备到训练测试部署的完整流程)
下一篇
DataWorks