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

news2024/9/27 7:43:28

问题描述

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

老版geth失败原因

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,您的执行节点可能仍在同步。 否则,如果您没有看到任何错误,则您的信标节点已连接到您的执行节点。

所以等待几小时或者几天同步完成吧。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/430223.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

PyTorch深度学习实战 | 神经网络的优化难题

即使我们可以利用反向传播来进行优化&#xff0c;但是训练过程中仍然会出现一系列的问题&#xff0c;比如鞍点、病态条件、梯度消失和梯度爆炸&#xff0c;对此我们首先提出了小批量随机梯度下降&#xff0c;并且基于批量随机梯度下降的不稳定的特点&#xff0c;继续对其做出方…

SpringBoot集成Dubbo启用gRPC协议

文章目录前言项目结构代码示例父工程api moduleservice module注意事项区别本文记录下SpringBoot集成Dubbo启用gRPC协议&#xff0c;以及与原生 gRPC 在代码编写过程中的区别。 下面还有投票&#xff0c;帮忙投个票&#x1f44d; 前言 Dubbo 在 2.7.5 版本开始支持原生 gRPC 协…

【软件测试】浅了解什么是软件测试及开发测试模型

目录 1.什么是软件测试&#xff1f; 2.什么是需求&#xff1f; 3.什么是测试用例 4.什么是软件错误&#xff08;bug&#xff09;&#xff1f; 5.开发模型和测试模型 5.1软件的生命周期 5.2瀑布模型 5.3螺旋模型 5.4软件测试V模型 5.5软件测试w模型 6.软件测试的生命周…

Redis第二十九讲 Redis集群发布订阅模式以及Redis集群事务

Redis集群状态下的发布订阅 在Redis的几个基本数据结构介绍中,有讲过List数据结构,可以使用List的阻塞特性实现订阅消费,关于Redis的底层数据结构可以参考我的这篇博客:Redis第六讲 Redis之List底层数据结构实现 底层数据结构基本操作可以看我的这篇博客,Redis第十五讲 R…

【从零到Offer】- 泛型

泛型是个啥 ​ Java 泛型是 JDK 5 中引入的一个新特性&#xff0c;其提供了编译时类型安全检测机制&#xff0c;该机制允许程序员在编译时检测到非法的类型。泛型的本质是参数化类型&#xff0c;也就是说所操作的数据类型被指定为一个参数。 ​ 通过将数据类型参数化&#xf…

用opencv+playwright过滑动验证码

目录 梳理思路 编写代码 总结与提高 在本节&#xff0c;我们将使用opencv和playwright这两个库通过QQ空间的滑动验证码。 梳理思路 1. 使用playwright打开浏览器&#xff0c;访问qq空间登录页面。 2. 点击密码登录。 3. 输入账号密码并点击登录。 4. 出现滑动验证码图片后…

大型语言模型综述,非常详细,格局打开!A Survey of Large Language Models

大型语言模型综述&#xff0c;非常详细&#xff0c;格局打开&#xff01;A Survey of Large Language Models 返回论文和资料目录 论文地址 项目地址 1.导读 讲得通俗易懂&#xff0c;且格局拉满&#xff01;基本覆盖了自ChatGPT以来的AI比较火的事件&#xff0c;还多次提到…

AI 模型首次有了国家标准!头部大厂参与编制,辐射 AMD

3月17日&#xff0c;国内首个面向人工智能生成式模型的国家标准正式公开&#xff0c;并向社会征求意见。 该标准全称为《信息技术神经网络表示与模型压缩第一部分&#xff1a;卷积神经网络》 &#xff08;GB&#xff0f;T 42382&#xff0e;1&#xff0d;2023&a…

【Linux系统下安装JDK】

一&#xff0c;linux下载JDK最方便快捷的方式&#xff1a;yum 1&#xff0c;执行下方命令&#xff0c;查看可安装java版本。 yum -y list java*2&#xff0c;选择一个进行安装&#xff0c;带-devel的安装的是jdk&#xff0c;而不带-devel的安装的是jre 3&#xff0c;安装命令…

【springBoot篇1】概念、创建和运行

目录 一、什么是springBoot&#xff1f;为什么要学springBoot springBoot的优点&#xff1a;(5点) 优点1&#xff1a;快速集成框架 优点2&#xff1a;内置了Tomcat容器 优点3&#xff1a;快速部署项目 优点4&#xff1a;少配置&#xff0c;多注解 优点5&#xff1a;支持更…

机器学习中的公平性

文章目录机器学习公平性评估指标群体公平性指标个人公平性指标引起机器学习模型不公平的潜在因素提升机器学习模型公平性的措施机器学习公平性 定义&#xff1a; 机器学习公平性主要研究如何通过解决或缓解“不公平”来增加模型的公平性&#xff0c;以及如何确保模型的输出结果…

生信刷题之ROSALIND——Part 1

目录写在前面1、Counting DNA NucleotidesProblemSample DatasetSample OutputCodeOutput2、Transcribing DNA into RNAProblemSample DatasetSample OutputCodeOutput3、Complementing a Strand of DNAProblemSample DatasetSample OutputCodeOutput4、Rabbits and Recurrence…

Android操作系统介绍

目录 Android 名词 Android LOGO 体系架构 Android系统架构 Linux 内核 硬件抽象层&#xff08;HAL&#xff09; Android Runtime 原生C/C库 Java API框架 系统应用 应用组件 活动 &#xff08;Activity) 服务 &#xff08;Service &#xff09; 广播接收器 &…

BLOOM模型结构详解

《BLOOM: A 176B-Parameter Open-Access Multilingual Language Model》 论文地址: https://arxiv.org/pdf/2211.05100.pdf 代码地址: transformers库-modeling_bloom.py BigScience 官方提供的代码链接并没有找到完整的模型实现代码,只有提示说模型结构代码是在 Megatron 的…

JS 中深拷贝的几种爱恨情仇

页面开发中&#xff0c;经常会碰到需要对数据进行某些处理操作&#xff0c;又不想影响原先的数据&#xff0c;所会经常将数据进行拷贝&#xff0c;当然这里指的是深拷贝。 深拷贝和浅拷贝的区别&#xff1f; 深拷贝通通俗点来讲呢&#xff0c;其实就是不管当前要操作的数据层级…

目标检测算法——YOLOv5/v7/v8改进结合涨点Trick之Wise-IoU(超越CIOU/SIOU)

超越CIOU/SIOU | Wise-IoU助力YOLO强势涨点&#xff01;&#xff01;&#xff01; 论文题目&#xff1a;Wise-IoU: Bounding Box Regression Loss with Dynamic Focusing Mechanism 论文链接&#xff1a;https://arxiv.org/abs/2301.10051 ​ 近年来的研究大多假设训练数据中的…

Java实现发送邮件(定时自动发送邮件)

系列文章目录 Redis缓存穿透、击穿、雪崩问题及解决方法Spring Cache的使用–快速上手篇分页查询–Java项目实战篇全局异常处理–Java实战项目篇 该系列文章持续更新&#xff0c;更多的文章请点击我的主页查看哦&#xff01; 文章目录 目录 系列文章目录 文章目录 前言 一…

算法训练第五十七天 | 647. 回文子串、516.最长回文子序列、动态规划总结篇

动态规划part17 647. 回文子串题目描述思路暴力解法动态规划双指针法 516.最长回文子序列题目描述思路 动态规划总结篇动划基础背包问题系列打家劫舍系列股票系列子序列系列总结 647. 回文子串 题目链接&#xff1a;647. 回文子串 参考&#xff1a;https://programmercarl.com…

hot100:数组——31、33

31. 下一个排列 思路&#xff1a;其实这道题的意思就是&#xff0c;简单地说&#xff0c;就是找到一个比现有的给出的数组代表的值大的最小的数 比如给出的数组是[1,2,3]&#xff0c;它代表的数值是123&#xff0c;现有的元素组成的数值中&#xff0c;比123大的有很多&#xf…

3.6 n维随机变量

学习目标&#xff1a; 学习n维随机变量需要掌握一定的数学知识&#xff0c;包括多元微积分、线性代数和概率论等。要学习n维随机变量&#xff0c;我会采取以下步骤&#xff1a; 复习相关的数学知识&#xff1a;首先&#xff0c;我会复习多元微积分、线性代数和概率论的基本知…