如何加入 Verkle 测试网络

本文档介绍了如何在 Verkle 测试网络(verkle-gen-devnet-4)上设置节点,包括克隆必要的代码仓库,安装和配置共识客户端 Lighthouse 和执行客户端 Geth。文章提供了详细的步骤和代码示例,用于生成 JWT Token,初始化 Geth 的 genesis 文件,以及配置和运行 Lighthouse 和 Geth 客户端以连接到 Verkle 测试网络。

如何加入 Verkle 开发网络

更新 (2024年3月12日): 变更为 verkle-gen-devnet-4

👋 简介

本指南将演示如何在 Verkle 测试网 (verkle-gen-devnet-4) 上设置节点。请注意,当前的 Verkle 测试网变化非常频繁,因此某些配置可能已过时。但是,总体设置流程应该大致相同。

⚙️ 准备

1. 克隆存储库
git clone https://github.com/ethpandaops/verkle-devnets/

稍后我们将需要来自上述存储库的配置和创世文件。

2. 创建目录
mkdir consensus execution

稍后我们将在各自的文件夹中处理共识客户端和执行客户端。

3. 生成 JWT Token
openssl rand -hex 32 | tr -d "\n" > "jwt.hex"

JWT Token是验证共识客户端和执行客户端之间的 HTTP 连接所必需的。

到目前为止,你的文件夹应具有以下结构:

├── consensus
├── execution
├── jwt.hex
└── verkle-devnets

🔵 共识客户端 (Lighthouse)

在编写本指南时,只有 Lighthouse 和 Lodestar 支持 Verkle 测试网。在这里,我们将使用 Lighthouse。

首先,进入共识客户端文件夹:

cd consensus
1. 克隆存储库
git clone -b verkle-trees-capella https://github.com/macladson/lighthouse
2. 构建二进制文件

按照官方指南 构建 Lighthouse 二进制文件。

3. 运行共识客户端
/root/.cargo/bin/lighthouse beacon_node \
 --datadir /home/eth-verkle/consensus/lighthouse/data-seed \
 --testnet-dir /home/eth-verkle/verkle-devnets/network-configs/gen-devnet-4 \
 --boot-nodes "enr:-Iq4QF2WB38aEbYwA-zuXk-yZQgTsLmx7cKe8eJ_7jY4CL_eFzOD694n37UCigxi0obDpK0YVInLNK3bxyjQX_Kfuq-GAYwBEDLMgmlkgnY0gmlwhICMaGCJc2VjcDI1NmsxoQJJ3h8aUO3GJHv-bdvHtsQZ2OEisutelYfGjXO4lSg8BYN1ZHCCIyk" \
 --execution-endpoint "http://localhost:8551" \
 --jwt-secrets "/home/eth-verkle/jwt.hex" \
 --metrics

一些注意事项:

  • --testnet-dir: 这指向你刚刚克隆的 verkle-devnets 存储库的 network-configs/gen-devnet-4 文件夹。
  • --boot-nodes: 请参考此文件

如果你需要有关所有标志的更多详细信息,请执行 /root/.cargo/bin/lighthouse --help

当你启动节点时,你应该会看到类似这样的内容:

Nov 26 12:55:59.572 INFO Logging to file                         path: "/home/eth-verkle/consensus/lighthouse/data-seed/beacon/logs/beacon.log"
Nov 26 12:55:59.573 INFO Lighthouse started                      version: Lighthouse/v4.5.0-2ffb8a9
Nov 26 12:55:59.573 INFO Configured for network                  name: custom (/home/eth-verkle/verkle-devnets/network-configs/gen-devnet-4)
Nov 26 12:55:59.574 INFO Data directory initialised              datadir: /home/eth-verkle/consensus/lighthouse/data-seed
Nov 26 12:55:59.574 INFO Deposit contract                        address: 0x6f22ffbc56eff051aecf839396dd1ed9ad6bba9d, deploy_block: 0
Nov 26 12:55:59.671 INFO Starting from known genesis state       service: beacon
Nov 26 12:55:59.738 INFO Block production enabled                method: json rpc via http, endpoint: Auth { endpoint: "http://localhost:8551/", jwt_path: "/home/eth-verkle/jwt.hex", jwt_id: None, jwt_version: None }
...

🟢 执行客户端 (Geth)

在编写本指南时,只有 Geth 支持 Verkle 测试网。

首先,进入执行客户端文件夹:

cd execution
1. 克隆存储库
git clone -b kaustinen-with-shapella https://github.com/gballet/go-ethereum
2. 构建二进制文件
cd go-ethereum
make geth
3. 初始化创世块
./build/bin/geth init --datadir node /home/eth-verkle/verkle-devnets/network-configs/gen-devnet-4/genesis.json

我们正在使用 verkle-devnets 存储库中包含的 genesis.json 文件。

4. 运行执行客户端
./build/bin/geth --datadir node \
 --networkid=69420 \
 --http \
 --http.api "net,eth,debug,engine,web3" \
 --ws \
 --ws.api "net,eth,debug,engine,web3" \
 --http.corsdomain "*" \
 --syncmode full \
 --authrpc.addr=0.0.0.0 \
 --authrpc.vhosts "*" \
 --authrpc.jwtsecret "/home/eth-verkle/jwt.hex" \
 --bootnodes="enode://3cc0be5b2cd2831b938525198885783c250b2345e16e41d9116f1a15e4584a4703868bc5013072d7125d6ef07579903105e96d666c08531c1e0f0c3acbe92f0c@78.47.30.10:30303?discport=30303" \
 --metrics \
 --metrics.addr 0.0.0.0 \

你应该看到类似这样的内容:


INFO [11-28|10:17:22.650] Starting Geth on Ethereum mainnet...
INFO [11-28|10:17:22.650] Bumping default cache on mainnet         provided=1024 updated=4096
INFO [11-28|10:17:22.650] Enabling metrics collection
INFO [11-28|10:17:22.650] Enabling stand-alone metrics HTTP endpoint address=0.0.0.0:6060
INFO [11-28|10:17:22.650] Starting metrics server                  addr=http://0.0.0.0:6060/debug/metrics
INFO [11-28|10:17:22.657] Maximum peer count                       ETH=50 LES=0 total=50
INFO [11-28|10:17:22.659] Smartcard socket not found, disabling    err="stat /run/pcscd/pcscd.comm: no such file or directory"
INFO [11-28|10:17:22.665] Set global gas cap                       cap=50,000,000
INFO [11-28|10:17:22.667] Initializing the KZG library             backend=gokzg
INFO [11-28|10:17:22.878] Allocated trie memory caches             clean=614.00MiB dirty=1024.00MiB
INFO [11-28|10:17:22.878] Using pebble as the backing database
INFO [11-28|10:17:22.878] Allocated cache and file handles         database=/home/eth-verkle/execution/data-seed/node/geth/chaindata cache=2.00GiB handles=524,288
INFO [11-28|10:17:22.942] Opened ancient database                  database=/home/eth-verkle/execution/data-seed/node/geth/chaindata/ancient/chain readonly=false
INFO [11-28|10:17:22.946] Initialising Ethereum protocol           network=1 dbversion=<nil>
INFO [11-28|10:17:22.952]
INFO [11-28|10:17:22.952] ---------------------------------------------------------------------------------------------------------------------------------------------------------
INFO [11-28|10:17:22.953] Chain ID:  69420 (unknown)
INFO [11-28|10:17:22.953] Consensus: unknown
INFO [11-28|10:17:22.953]
INFO [11-28|10:17:22.953] Pre-Merge hard forks (block based):
INFO [11-28|10:17:22.953]  - Homestead:                   #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/homestead.md)
INFO [11-28|10:17:22.953]  - Tangerine Whistle (EIP 150): #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/tangerine-whistle.md)
INFO [11-28|10:17:22.953]  - Spurious Dragon/1 (EIP 155): #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/spurious-dragon.md)
INFO [11-28|10:17:22.953]  - Spurious Dragon/2 (EIP 158): #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/spurious-dragon.md)
INFO [11-28|10:17:22.953]  - Byzantium:                   #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/byzantium.md)
INFO [11-28|10:17:22.953]  - Constantinople:              #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/constantinople.md)
INFO [11-28|10:17:22.953]  - Petersburg:                  #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/petersburg.md)
INFO [11-28|10:17:22.953]  - Istanbul:                    #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/istanbul.md)
INFO [11-28|10:17:22.953]  - Berlin:                      #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/berlin.md)
INFO [11-28|10:17:22.953]  - London:                      #0        (https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/london.md)
INFO [11-28|10:17:22.953]
INFO [11-28|10:17:22.953] Merge configured:
INFO [11-28|10:17:22.953]  - Hard-fork specification:    https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/paris.md
INFO [11-28|10:17:22.953]  - Network known to be merged: true
INFO [11-28|10:17:22.953]  - Total terminal difficulty:  0
INFO [11-28|10:17:22.953]  - Merge netsplit block:       #0
INFO [11-28|10:17:22.953]
INFO [11-28|10:17:22.953] Post-Merge hard forks (timestamp based):
INFO [11-28|10:17:22.953]  - Shanghai:                    @0          (https://learnblockchain.cn/article/15130)
INFO [11-28|10:17:22.953]  - Prague:                      @1700825700
INFO [11-28|10:17:22.953]
INFO [11-28|10:17:22.953] ---------------------------------------------------------------------------------------------------------------------------------------------------------
INFO [11-28|10:17:22.953]
INFO [11-28|10:17:22.954] Loaded most recent local block           number=0 hash=0884fa..de45d7 td=1 age=3d22h42m

📖 资源

查看 verkle.info 以获取最新更新。如果你需要有关 Verkle 树的教育资料,可以参考这个 awesome-verkle 存储库。

  • 原文链接: hackmd.io/gZP7Yti0Tna3lg...
  • 登链社区 AI 助手,为大家转译优秀英文文章,如有翻译不通的地方,还请包涵~
点赞 0
收藏 0
分享
本文参与登链社区写作激励计划 ,好文好收益,欢迎正在阅读的你也加入。

0 条评论

请先 登录 后评论
gZP7Yti0Tna3lgZEgammhQ
gZP7Yti0Tna3lgZEgammhQ
江湖只有他的大名,没有他的介绍。