以太坊全节点搭建
需要运行执行层和共识层两个程序。
执行层选择Geth,下载:https://geth.ethereum.org/downloads ,本文使用版本:1.14.12-stable-293a300d
共识层选择Prysm,下载:https://github.com/prysmaticlabs/prysm/releases ,本文使用版本:v5.2.0/ac1717f1
执行层Geth系统服务配置:
ini
# /etc/systemd/system/geth_full.service
[Unit]
Description=Ethereum geth client
After=syslog.target network.target
[Service]
User=root
Group=root
Type=simple
Environment="https_proxy=" "http_proxy=" "all_proxy="
ExecStart=/usr/local/bin/geth --datadir=/root/.ethereum
KillMode=process
KillSignal=SIGINT
TimeoutStopSec=90
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
共识层Prysm系统服务配置:
ini
# /etc/systemd/system/beacon_chain_full.service
[Unit]
Description=Ethereum beacon chain
After=syslog.target network.target
[Service]
User=root
Group=root
Type=simple
Environment="https_proxy=" "http_proxy=" "all_proxy="
ExecStart=/usr/local/bin/beacon-chain-v5.2.0-linux-amd64 \
--accept-terms-of-use \
--jwt-secret=/root/.ethereum/geth/jwtsecret \
--checkpoint-sync-url=https://mainnet.checkpoint.sigp.io \
--genesis-beacon-api-url=https://mainnet.checkpoint.sigp.io \
--suggested-fee-recipient=0x11dbF181dD5c075C2abD92Cb9579c4809406b5Be \
--datadir=/root/.eth2
KillMode=process
KillSignal=SIGINT
TimeoutStopSec=90
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
启动Geth:
bash
# 开机启动
systemctl enable geth_full
# 启动
systemctl start geth_full
# 查看状态
systemctl status geth_full
# 停止
systemctl stop geth_full
# 取消开机启动
systemctl disable geth_full
# 查看日志
journalctl -u geth_full -f
启动Prysm:
bash
# 开机启动
systemctl enable beacon_chain_full
# 启动
systemctl start beacon_chain_full
# 查看状态
systemctl status beacon_chain_full
# 停止
systemctl stop beacon_chain_full
# 取消开机启动
systemctl disable beacon_chain_full
# 查看日志
journalctl -u beacon_chain_full -f
执行层操作:
bash
# 进入 Geth 控制台
/usr/bin/geth attach --datadir=/root/.ethereum
# 查看执行层同步状态
/usr/bin/geth attach --datadir=/root/.ethereum --exec=eth.syncing
共识层操作:
bash
# 查看共识层同步状态
curl http://127.0.0.1:3500/eth/v1/node/syncing