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

目录
相关文章
|
3月前
|
人工智能 数据可视化 测试技术
Postman 性能测试教程:快速上手 API 压测
本文介绍API上线后因高频调用导致服务器告警,通过Postman与Apifox进行压力测试排查性能瓶颈。对比两款工具在批量请求、断言验证、可视化报告等方面的优劣,探讨API性能优化策略及行业未来发展方向。
Postman 性能测试教程:快速上手 API 压测
|
3月前
|
安全 网络协议 算法
Nmap网络扫描工具详细使用教程
Nmap 是一款强大的网络发现与安全审计工具,具备主机发现、端口扫描、服务识别、操作系统检测及脚本扩展等功能。它支持多种扫描技术,如 SYN 扫描、ARP 扫描和全端口扫描,并可通过内置脚本(NSE)进行漏洞检测与服务深度枚举。Nmap 还提供防火墙规避与流量伪装能力,适用于网络管理、渗透测试和安全研究。
555 1
|
5月前
|
JSON JavaScript 测试技术
用Postman玩转电商API:一键测试+自动化请求教程
Postman 是电商 API 测试的高效工具,涵盖基础配置、自动化测试、环境管理与请求自动化,助你快速提升开发效率。
|
5月前
|
JSON 监控 API
在线网络PING接口检测服务器连通状态免费API教程
接口盒子提供免费PING检测API,可测试域名或IP的连通性与响应速度,支持指定地域节点,适用于服务器运维和网络监控。
560 0
|
8月前
|
测试技术
Fast网络速度测试工具
Fast是由Netflix提供的网络速度测试工具,可快速测量用户的下载、上传速度及延迟。其全球可用、无广告干扰,并支持多种设备。测试自动进行,结果以Mbps显示。此外,用户可通过“Show more info”查看上传速度和延迟(含缓冲膨胀)。Fast以其简单快捷的特点,帮助用户了解网络性能并解决潜在问题,是评估网速的理想选择。
794 0
Fast网络速度测试工具
|
4月前
|
前端开发 Java jenkins
Jmeter压力测试工具全面教程和使用技巧。
JMeter是一个能够模拟高并发请求以检查应用程序各方面性能的工具,包括但不限于前端页面、后端服务及数据库系统。熟练使用JMeter不仅能够帮助发现性能瓶颈,还能在软件开发早期就预测系统在面对真实用户压力时的表现,确保软件质量和用户体验。在上述介绍的基础上,建议读者结合官方文档和社区最佳实践,持续深入学习和应用。
971 10
|
3月前
|
监控 测试技术 API
n8n自动化测试教程 (1):环境搭建与初识n8n
n8n是一款开源、可视化的工作流自动化工具,测试工程师可通过拖拽节点快速构建API测试流程,实现测试编排、数据管理、自动化监控与告警等功能,提升测试效率与覆盖率。
|
4月前
|
JSON 安全 测试技术
什么是API接口测试?这可能是全网最全的教程了!
API 是应用程序间的“中间人”,用于实现通信和数据交换。随着微服务架构的普及,API 数量激增,其质量对系统稳定性至关重要。API 测试可验证功能、性能与安全性,帮助开发者在部署前发现并修复问题,提升系统可靠性。测试内容包括请求方法、URL、请求头、请求体、响应状态码与响应数据等。常用工具如 Postman、AREX 可辅助测试,确保 API 在不同场景下的正确性与稳定性。
|
8月前
|
数据采集 存储 监控
Python 原生爬虫教程:网络爬虫的基本概念和认知
网络爬虫是一种自动抓取互联网信息的程序,广泛应用于搜索引擎、数据采集、新闻聚合和价格监控等领域。其工作流程包括 URL 调度、HTTP 请求、页面下载、解析、数据存储及新 URL 发现。Python 因其丰富的库(如 requests、BeautifulSoup、Scrapy)和简洁语法成为爬虫开发的首选语言。然而,在使用爬虫时需注意法律与道德问题,例如遵守 robots.txt 规则、控制请求频率以及合法使用数据,以确保爬虫技术健康有序发展。
1185 31
|
8月前
|
域名解析 API PHP
VM虚拟机全版本网盘+免费本地网络穿透端口映射实时同步动态家庭IP教程
本文介绍了如何通过网络穿透技术让公网直接访问家庭电脑,充分发挥本地硬件性能。相比第三方服务受限于转发带宽,此方法利用自家宽带实现更高效率。文章详细讲解了端口映射教程,包括不同网络环境(仅光猫、光猫+路由器)下的设置步骤,并提供实时同步动态IP的两种方案:自建服务器或使用三方API接口。最后附上VM虚拟机全版本下载链接,便于用户在穿透后将服务运行于虚拟环境中,提升安全性与适用性。
440 7

热门文章

最新文章