赞
踩
采用最新的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 不足以跟踪链,因为共识逻辑现在由称为共识客户端的单独软件实现。 缺少共识客户端时会显示此日志消息。 在我们的共识客户页面上阅读更多相关信息。
下载、安装并启动一个共识客户端。安装参考文档在这儿。
clef
创建账户clef
客户端注:如果不能访问github.com
需要科学上网
// 下载ethertum源码
git clone https://github.com/ethereum/go-ethereum.git
cd go-ethereum/cmd/clef/
// 需要科学上网
go build
mv clef ../geth-linux
$ 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
没搞清楚什么时候需要启动
// 连接主网
clef --keystore acts --configdir clef
// 连接其他网络,使用 --chainid 参数
clef --keystore acts --configdir clef --chainid 11155111
更多的chainid参考网站:chainlist.org
目前支持的Consesus客户端有:
共识客户端必须以正确的端口配置启动,以建立到本地 Geth 实例的 RPC 连接。 在上面的例子中,localhost:8551 被授权用于此目的。 共识客户端都有一个类似于 --http-webprovider 的命令,它将暴露的 Geth 端口作为参数。
共识客户端还需要 Geth 的 jwt-secret 路径,以便验证它们之间的 RPC 连接。 每个共识客户端都有一个类似于 --jwt-secret 的命令,它将文件路径作为参数。 这必须与提供给 Geth 的 --authrpc.jwtsecret 路径一致。
共识客户端都暴露了一个Beacon API,可用于检查Beacon客户端的状态或通过使用Curl等工具发送请求来下载区块和共识数据。 有关这方面的更多信息,请参阅每个共识客户端的文档。
下面使用Prysm
启动共识客户端。
信标链节点的类型如下:
// 下载 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
介绍:
为了连接到共识客户端,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 参数
// 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, 回车开始同步
状态监测项参考《Check node and validator status》
$ geth attach http://localhost:8545
> eth.syncing
false
同步状态为 false 表示您的节点已完全同步。
$ 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
时,您的信标节点会看到您的执行节点:
$ 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
表名当前仍然在同步账本中。
$ 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
,您的执行节点可能仍在同步。 否则,如果您没有看到任何错误,则您的信标节点已连接到您的执行节点。
所以等待几小时或者几天同步完成吧。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。