eth节点搭建

概述:

以太坊(Ethereum)是一种开源的区块链平台,旨在允许开发者构建和部署去中心化应用程序(DApps)。它不仅仅是一种数字货币,而是一个具有智能合约功能的分布式计算平台。

环境准备:

CPU:16核
内存:64 GB 内存
硬盘:至少1TB(以太坊的数据存储量在不断增长)

 

步骤1:安装Geth

Geth是以太坊的官方客户端,它是一个命令行工具,用于管理以太坊节点。首先,你需要安装Geth:

  1. 打开终端(Linux或Mac)或命令提示符(Windows)。

  2. 访问以太坊官方网站(https://geth.ethereum.org/downloads/),下载适合你操作系统的最新版本的Geth。

  3. 安装Geth并确保将其添加到系统的PATH变量中,以便能够在任何位置执行Geth命令。

步骤2:创建一个数据目录

 以太坊节点需要一个数据目录来存储区块链数据。你可以选择任何位置来创建这个目录,但确保你有足够的磁盘空间。
mkdir ~/ethereum-node-data

步骤3:初始化你的以太坊节点

geth --datadir ~/ethereum-node-data init genesis.json

步骤4:搭建prysm

Prysm节点是成为以太坊2.0网络的验证者的一部分。验证者有责任验证区块链上的交易和生成新的区块

cd /eth
git clone https://github.com/ethereum/go-ethereum.git
make geth 
cd go-ethereum/build/bin

启动prysm
./prysm.sh beacon-chain --execution endpoint=http://localhost:8551 --jwt-secret=/eth/consensus/prysm/jwt.hex

步骤5:启动eth节点

 ./geth --cache 10240 --http --http.api web3,eth,net,personal,txpool,engine,admin--http.addr 0.0.0.0 --http.port 8545  --datadir ./node --ws --ws.port 8546 --ws.addr 0.0.0.0 --ws.api web3,eth,net,personal,txpool,engine,admin--ws.origins '*' --authrpc.addr localhost --authrpc.port 8551 --authrpc.vhosts localhost --maxpeers=300 --authrpc.jwtsecret /eth/consensus/prysm/jwt.hex

步骤6:区块同步状态验证

geth attach http://localhost:8545     #
> eth.syncing                          #查看当前区块情况,结果为false表示已同步最新区块
currentBlock: 14290861, #当前节点高度
highestBlock: 14297354, #主网当前最新高度
knownStates:297473485,
pulledStates: 297473485,
startingBlock: 14270385

 

posted @ 2023-10-22 17:36  美好生活我心往之  阅读(359)  评论(0编辑  收藏  举报