ETH 2.0主网节点搭建不质押教程(geth+prysum)

Posted by 夜空 on July 25, 2023

ETH 2.0主网节点搭建不质押教程(geth+prysum)

系统配置:

cpu: 8核

内存: 16G及以上

系统盘: 60G

数据盘: 1T及以上

系统: centos 7 (64位)

带宽: 独享 100M



1.下载geth

wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.11.6-ea9e62ca.tar.gz

tar zxf geth-linux-amd64-1.11.6-ea9e62ca.tar.gz

cd geth-linux-amd64-1.11.6-ea9e62ca

cp geth /usr/bin/

geth version

Geth Version: 1.11.6-stable Git Commit: ea9e62ca3db5c33aa7438ebf39c189afd53c6bf8 Git Commit Date: 20230420 Architecture: amd64 Go Version: go1.20.3 Operating System: linux GOPATH= GOROOT=

  • 我用1.12.0有各种奇怪的报错,用这个1.11.6这个版本没有问题,可以正常同步.

2.安装Prysum

mkdir -p /data/prysm && cd /data/prysm

curl https://raw.githubusercontent.com/prysmaticlabs/prysm/master/prysm.sh --output prysm.sh && chmod +x prysm.sh

3.生成JWT令牌

./prysm.sh beacon-chain generate-auth-secret

4.启动geth

mkdir /data/eth_data
vim /lib/systemd/system/geth.service
[Unit]
Description=goerli chain
StartLimitIntervalSec=500
StartLimitBurst=5

[Service]
Restart=on-failure
RestartSec=5s
ExecStart=/usr/bin/geth --mainnet --cache 4096  --http --http.addr "0.0.0.0"  --http.api eth,net,engine,admin --syncmode snap  --gcmode archive  --authrpc.addr localhost --authrpc.port 8551 --authrpc.vhosts localhost --authrpc.jwtsecret /data/prysm/jwt.hex --datadir /data/eth_data --allow-insecure-unlock --db.engine pebble --txlookuplimit 48958
Type=simple
User=root
KillSignal=SIGINT
TimeoutStopSec=12000

[Install]
WantedBy=multi-user.target
保存后,执行:
systemctl daemon-reload
systemctl start geth.service
systemctl enable geth.service

5.启动prysm

vim /lib/systemd/system/prysm.service
[Unit]
Description=prysm mainnet
After=network-online.target
Wants=network-online.target

[Service]
User=root
WorkingDirectory=/data/prysm
ExecStart=/data/prysm/prysm.sh beacon-chain --mainnet --checkpoint-sync-url=https://sync.invis.tools --genesis-beacon-api-url=https://sync.invis.tools --execution-endpoint=http://localhost:8551 --jwt-secret=/data/prysm/jwt.hex --datadir=/data/prysm/data --p2p-max-peers 100 --build-block-parallel=true --accept-terms-of-use=true
Restart=always
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
保存后执行:
systemctl daemon-reload
systemctl start prysm.service
systemctl enable prysm.service

6.查看日志

journalctl -u prysm.service -ef -n 50

journalctl -u geth.service -ef -n 50

7.防火墙设置

  • 阻止8545/tcp, 3500/tcp, 8551/tcp, 4000/tcp
  • 允许13000/tcp, 12000/udp, 30303/tcp+udp