启动 Ethereum(上海) 主网全节点

这篇具有很好参考价值的文章主要介绍了启动 Ethereum(上海) 主网全节点。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

问题描述

采用最新的geth版本之后,按照之前的方法启动geth主网节点会出现如下问题:

启动 Ethereum(上海) 主网全节点

Post-merge network, but no beacon client seen. Please launch one to follow the chain!

问题原因

The above message is emitted when Geth is run without a consensus client on a post-merge proof-of-stake network. Since Ethereum moved to proof-of-stake Geth alone is not enough to follow the chain because the consensus logic is now implemented by a separate piece of software called a consensus client. This log message is displayed when the consensus client is missing. Read more about this on our consensus clients page.

当 Geth 在合并后权益证明网络上没有共识客户端的情况下运行时,会发出上述消息。 由于以太坊转向权益证明,仅靠 Geth 不足以跟踪链,因为共识逻辑现在由称为共识客户端的单独软件实现。 缺少共识客户端时会显示此日志消息。 在我们的共识客户页面上阅读更多相关信息。

新版本geth启动

下载、安装并启动一个共识客户端。安装参考文档在这儿。

3.1 使用clef创建账户

1. 编译clef客户端

注:如果不能访问github.com需要科学上网

//  下载ethertum源码
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum/cmd/clef/
// 需要科学上网
go build 

mv clef ../geth-linux

2. 生成账号

$ mkdir act
$ clef init

WARNING!

Clef is an account management tool. It may, like any software, contain bugs.

Please take care to
- backup your keystore files,
- verify that the keystore(s) can be opened with your password.

Clef is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.

Enter 'ok' to proceed:
> ok
The master seed of clef will be locked with a password.
Please specify a password. Do not forget this password!
Password: 

// 生成账号
$ clef newaccount --keystore [keystore path]

WARNING!

Clef is an account management tool. It may, like any software, contain bugs.

Please take care to
- backup your keystore files,
- verify that the keystore(s) can be opened with your password.

Clef is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.

Enter 'ok' to proceed:
> ok

## New account password

Please enter a password for the new account to be created (attempt 0 of 3)
> 
-----------------------
INFO [04-18|12:13:39.005] Your new key was generated               address=0x9E7b07952Fcb2197AF96964e08579f5a2E969FeC
WARN [04-18|12:13:39.005] Please backup your key file!             path=/home/baas/data/ethereum/acts/UTC--2023-04-18T04-13-37.353476343Z--9e7b07952fcb2197af96964e08579f5a2e969fec
WARN [04-18|12:13:39.005] Please remember your password! 
Generated account 0x9E7b07952Fcb2197AF96964e08579f5a2E969FeC

3. 启动clef

没搞清楚什么时候需要启动

// 连接主网
clef --keystore acts --configdir clef
// 连接其他网络,使用 --chainid 参数
clef --keystore acts --configdir clef --chainid 11155111

更多的chainid参考网站:chainlist.org

4. 启动Consensus Client

目前支持的Consesus客户端有:

  • Lighthouse: written in Rust
  • Nimbus: written in Nim
  • Prysm: written in Go
  • Teku: written in Java
  • Lodestar: written in Typescript

共识客户端必须以正确的端口配置启动,以建立到本地 Geth 实例的 RPC 连接。 在上面的例子中,localhost:8551 被授权用于此目的。 共识客户端都有一个类似于 --http-webprovider 的命令,它将暴露的 Geth 端口作为参数。
共识客户端还需要 Geth 的 jwt-secret 路径,以便验证它们之间的 RPC 连接。 每个共识客户端都有一个类似于 --jwt-secret 的命令,它将文件路径作为参数。 这必须与提供给 Geth 的 --authrpc.jwtsecret 路径一致。
共识客户端都暴露了一个Beacon API,可用于检查Beacon客户端的状态或通过使用Curl等工具发送请求来下载区块和共识数据。 有关这方面的更多信息,请参阅每个共识客户端的文档。

下面使用Prysm启动共识客户端。
信标链节点的类型如下:

由于没有ETH,所以只能启动`beacon`普通节点。
// 下载 prysm
mkdir consensus
cd consensus
mkdir prysm && cd prysm
curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh

// Generate JWT Secret
<!--信标节点和执行节点之间的 HTTP 连接需要使用 JWT 令牌进行身份验证。 有几种方法可以生成此 JWT 令牌:使用像这样的在线生成器。 将此值复制并粘贴到 jwt.hex 文件中。-->
<!--使用像 OpenSSL 这样的实用程序通过命令创建令牌:openssl rand -hex 32 |  tr -d "\n" > "jwt.hex"。-->
<!--使用执行客户端生成 jwt.hex 文件。-->
<!--使用 Prysm 生成 jwt.hex 文件:-->
<!--Optional. This command is necessary only if you've previously configured USE_PRYSM_VERSION-->
$ USE_PRYSM_VERSION=v4.0.0

<!--Required.-->
$ ./prysm.sh beacon-chain generate-auth-secret

beacon-chain介绍:

  • 信标链向以太坊生态系统引入了股权证明。
  • 它于 2022 年 9 月与最初的以太坊工作量证明链合并。
  • 信标链引入了现在保护以太坊的共识逻辑和块八卦协议。

5. 使用geth启动执行节点

为了连接到共识客户端,Geth 必须为客户端间 RPC 连接公开一个端口。
RPC 连接必须使用 jwtsecret 文件进行身份验证。 默认情况下创建并保存到 <datadir>/geth/jwtsecret,但也可以创建并保存到自定义位置,或者可以通过将文件路径传递给 --authrpc.jwtsecret 自行生成并提供给 Geth。 Geth 和共识客户端都需要 jwtsecret 文件。
然后必须将授权应用于特定地址/端口。 这是通过将地址传递给 --authrpc.addr 并将端口号传递给 --authrpc.port 来实现的。 向 --authrpc.vhosts 提供 localhost 或通配符 * 也是安全的,这样 Geth 就会接受来自虚拟主机的传入请求,因为它仅适用于使用 jwtsecret 进行身份验证的端口。

// 
geth --datadir /home/baas/data/ethereum/geth-data --authrpc.addr localhost --authrpc.port 8551 --authrpc.vhosts localhost --authrpc.jwtsecret consensus/prysm/jwt.hex --http --http.api eth,net --signer=clef/clef.ipc --http 

// 如果不想被其他节点发现,则增加 --nodiscover 参数

6. 启动共识节点

// Run a beacon node using Prysm
<!-- prysm.sh 和 jwt.hex 在同一目录-->
$ ./prysm.sh beacon-chain --execution-endpoint=http://localhost:8551 --jwt-secret=jwt.hex  --suggested-fee-recipient=0x9E7b07952Fcb2197AF96964e08579f5a2E969FeC
Latest Prysm version is v4.0.2.
Beacon chain is up to date.
Verifying binary integrity.
beacon-chain-v4.0.2-linux-amd64: OK
gpg: Signature made Thu 13 Apr 2023 12:01:31 PM CST
gpg:                using RSA key 0AE0051D647BA3C1A917AF4072E33E4DF1A5036E
gpg: Good signature from "Preston Van Loon <preston@pvl.dev>" [unknown]
gpg:                 aka "Preston Van Loon <preston@prysmaticlabs.com>" [unknown]
gpg:                 aka "Preston Van Loon <preston90@gmail.com>" [unknown]
gpg:                 aka "Preston Van Loon (0xf71E9C766Cdf169eDFbE2749490943C1DC6b8A55) <preston@machinepowered.com>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 0AE0 051D 647B A3C1 A917  AF40 72E3 3E4D F1A5 036E
Verified /home/baas/data/ethereum/consensus/prysm/dist/beacon-chain-v4.0.2-linux-amd64 has been signed by Prysmatic Labs.
Starting Prysm beacon-chain --execution-endpoint=http://localhost:8551 --jwt-secret=jwt.hex --suggested-fee-recipient=0x9E7b07952Fcb2197AF96964e08579f5a2E969FeC

Prysmatic Labs Terms of Use

By downloading, accessing or using the Prysm implementation (“Prysm”), you (referenced herein
as “you” or the “user”) certify that you have read and agreed to the terms and conditions below.

TERMS AND CONDITIONS: https://github.com/prysmaticlabs/prysm/blob/master/TERMS_OF_SERVICE.md


Type "accept" to accept this terms and conditions [accept/decline]: (default: decline):
// 输入 accept, 回车开始同步

7. 查看同步情况

状态监测项参考《Check node and validator status》

(1) geth node

$ geth attach http://localhost:8545
> eth.syncing
false

同步状态为 false 表示您的节点已完全同步。

(2)查看Beacon node 同步情况

$ curl http://localhost:3500/eth/v1/node/syncing | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   113  100   113    0     0  56500      0 --:--:-- --:--:-- --:--:-- 56500
{
  "data": {
    "head_slot": "8639",
    "sync_distance": "6239308",
    "is_syncing": true,
    "is_optimistic": false,
    "el_offline": true
  }
}
  • 当看到“is_syncing”:false 时,您的信标节点已与信标链完全同步。
  • 当您看到“is_optimistic”:false 时,您的信标节点会看到您的执行节点:
      1. 尚未启动,
      1. 尚未同步通过合并块,或
      1. 与执行层区块链完全同步。
$ curl http://localhost:8080/healthz
*prometheus.Service: OK
*execution.Service: ERROR, retryExecutionClientConnection: processPastLogs: no contract code at given address
*attestations.Service: OK
*blockchain.Service: OK
*sync.Service: ERROR, out of sync
*rpc.Service: ERROR, syncing
*p2p.Service: OK
*initialsync.Service: ERROR, syncing
*builder.Service: OK
*gateway.Gateway: OK

processPastLogs: no contract code at given address表名当前仍然在同步账本中。

(3)查看Beacon Node 和 Geth Node连接情况

$ curl http://localhost:3500/eth/v1alpha1/node/eth1/connections
{"currentAddress":"http://localhost:8551","currentConnectionError":"retryExecutionClientConnection: processPastLogs: no contract code at given address","addresses":["http://localhost:8551"],"connectionErrors":[]}

如果您看到 currentConnectionError: no contract code at given address,您的执行节点可能仍在同步。 否则,如果您没有看到任何错误,则您的信标节点已连接到您的执行节点。

所以等待几小时或者几天同步完成吧。文章来源地址https://www.toymoban.com/news/detail-466837.html

到了这里,关于启动 Ethereum(上海) 主网全节点的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Elasticsearch 集群某一节点修改 IP 后无法启动问题复盘

    集群版本:6.8.X 集群节点:5节点(三个节点为主+数据节点,另外两个独立数据节点)。 问题描述:由于IP冲突,修改了一台服务器的IP,然后5台配置改了一下一次重启,能启动,但是连不上,后台各种报错。 节点换 IP 原因探讨:宿主机服务器的IP地址和别的服务器IP 冲突,

    2024年02月16日
    浏览(27)
  • 虚拟机挂起/重启后导致K8s网络不通或服务启动后主节点无法访问问题

    3台linux服务器搭建的一个 kubeadm-k8s 的集群环境,(1 Master 2 Worker),  当断电或者虚拟机挂起恢复后出现 service 访问不了,pod之间ping不通或者集群搭建失败问题,但是K8s集群还是正常可以创建 deployment 以及调度 pod 到各个 node 上, 并且 node都处于 ready 的状态。 找到其中的 kube

    2024年02月08日
    浏览(46)
  • 采用Prometheus+Grafana+Altermanager搭建部署K8S集群节点可视化监控告警平台

    采用 \\\"Prometheus+Grafana\\\"的开源监控系统,安装部署K8S集群监控平台。 并使用Altermanager告警插件,配合使用企业微信,实现系统集群监控报警机制。 主机名称 IP地址 安装组件 m1 192.168.200.61 Prometheus+Grafana+Alertmanager+node_exporter m2 192.168.200.62 node_exporter m3 192.168.200.63 node_exporter n1 192

    2024年02月11日
    浏览(45)
  • 上海启动宽带大提速:电信免费体验最高升级100Mbps

    今日,中国电信上海公司宣布, 从3月18日起,将面向上海市宽带用户,启动“百万用户享百兆、高清电视再升级、网龄计划真回馈”的第七次“智慧城市”宽带大提速。 在网2年以上的上海电信家庭宽带用户,根据宽带网龄,可免费体验高清电视等增值服务包,指定套餐用户

    2024年02月08日
    浏览(36)
  • Zookeeper集群单节点启动成功但未同步其他节点数据

    首先排查节点启动是否正常: 在zookeeper的bin目录下执行:sh zkServer.sh status 判断当前节点数据leader 还是follower  节点都启动正常,但某一个zookeeper集群节点(下面简称“异常节点”)不同步其他节点数据,解决步骤: 1、查看异常节点的配置文件(**/zookeeper/conf/zoo.cfg) 2、找到

    2024年02月11日
    浏览(31)
  • redis 6个节点(3主3从),始终一个节点不能启动

    redis节点,始终有一个节点不能启动起来 修改了配置文件 protected-mode no,重启redis问题依然存在 说明机器内存没有了,所以会杀死节点

    2024年02月11日
    浏览(25)
  • 以太坊节点启动及同步方式

    0.前置知识 节点:客户端的软件。全节点、轻节点 客户端:一种以太坊的实现,提供RPC API端点方便用户控制客户端,标准的JSON RPC每个客户端都可以使用。geth、OpenEthereum(停止维护) 轻量同步:下载所有区块头、区块数据并对其进行随机验证 通过客户端与以太坊网络进行交互

    2024年01月25日
    浏览(28)
  • namenode节点无法启动解决方法

    1.分析原因: 可能出错的原因及解决方法: 多次初始化 这个问题一般是由于两次或两次以上的格式化NameNode( hadoop namenode -format )造成的, 2.想要重新格式化,删掉hadoop-2.10.1目录下的tmp文件夹: 执行命令:rm -rf tmp   (注意在执行格式化命令时一定要关闭hadoop集群后操作)

    2024年02月11日
    浏览(26)
  • elasticsearch-7.9.3 单节点启动配置

    一、elasticsearch-7.9.3 单节点启动配置 二、kibana-7.9.3-linux-x86_64 单节点启动配置

    2024年02月06日
    浏览(61)
  • 【PowerMockito:编写单元测试过程中采用when打桩失效的问题】

    正如上图所示,采用when打桩了,但是,实际执行的时候还是返回null。 打桩时直接用any() 但是这样可能出现一个mybatisplus的异常,所以在测试类中需要加入以下代码片段:

    2024年02月02日
    浏览(28)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包