部署goerli链

部署prysm

下载prysm

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

生成JWT Secret

## Optional. This command is necessary only if you've previously configured USE_PRYSM_VERSION
USE_PRYSM_VERSION=v3.1.1

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

部署geth

下载geth

~# wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.10.25-69568c55.tar.gz
~# tar xf  geth-linux-amd64-1.10.25-69568c55.tar.gz
~# geth account new --keystore /data/goerli/keystore # 0x645c21cA37a28180315B56Edd7CCFC18505a1703

运行geth

~# /usr/local/geth/geth --goerli --http --http.addr "0.0.0.0" --http.api eth,net,engine,admin --gcmode archive  --authrpc.addr localhost --authrpc.port 8551 --authrpc.vhosts localhost --authrpc.jwtsecret /data/prysm/jwt.hex --allow-insecure-unlock --datadir /data/goerli

geth参数说明

--datadir:数据库和密钥库的数据目录(默认:"~/.ethereum")
--http.api:指定需要调用的HTTP-RPC API接口,默认只有eth,net,web3
--http:启动HTTP-RPC服务(基于HTTP的)
--http.addr:HTTP-RPC服务器监听地址(default: "localhost")
--cache:分配给内部缓存的内存的兆字节 (默认值为: 1024)
--maxpeers:最大的网络节点数量(如果设置为0,网络将被禁用)(默认值:25)
--allow-insecure-unlock:允许使用不安全的账户解锁
--authrpc.port:设置认证监听的api端口,默认为8551
-authrpc.addr:允许连接认证监听api端口的IP地址
--authrpc.vhosts:允许连接认证监听api端口的域名
--authrpc.jwtsecret:设置身份验证的RPC接口的JWT私钥的路径

geth.service

[Unit]
  Description=goerli chain
  StartLimitIntervalSec=500
  StartLimitBurst=5

[Service]
  Restart=on-failure
  RestartSec=5s
  ExecStart=/usr/local/geth/geth --goerli --http --http.addr "0.0.0.0"  --http.api eth,net,engine,admin --gcmode archive  --authrpc.addr localhost --authrpc.port 8551 --authrpc.vhosts localhost --authrpc.jwtsecret /data/prysm/jwt.hex --datadir /data/goerli
  Type=simple
  User=root
  KillSignal=SIGINT
  TimeoutStopSec=12000

[Install]
  WantedBy=multi-user.target

运行beacon 节点

下载genesis.ssz

~# wget https://github.com/eth-clients/eth2-networks/raw/master/shared/prater/genesis.ssz

执行prysm

./prysm.sh beacon-chain --execution-endpoint=http://localhost:8551 --prater --jwt-secret=/data/prysm/jwt.hex --genesis-state=/data/prysm/genesis.ssz   --datadir=/data/prysm/data --suggested-fee-recipient=0x645c21cA37a28180315B56Edd7CCFC18505a1703

prysm参数说明

--datadir:数据库和密钥库的数据目录(默认:"~/.ethereum")
--authrpc.jwtsecret:设置身份验证的RPC接口的JWT私钥的路径
--rpc-host:允许连接RPC服务的主机(默认值:“127.0.0.1”)
--grpc-gateway-host:允许连接网关的主机(默认值:“127.0.0.1”)
--monitoring-host:用于监听和响应prometheus监控的主机(默认值:“127.0.0.1”)
--execution-endpoint:连接执行客户端的http端点。格式为“http://localhost:8551”
--accept-terms-of-use:接受条款和条件(用于非交互环境)(默认值:false)
--prater;--goerli:测试链
--suggested-fee-recipient: 针对质押32eth

prysm.service

[Unit]
Description=prysm goerli
After=network-online.target
Wants=network-online.target

[Service]
User=root
WorkingDirectory=/data/prysm
ExecStart=/data/prysm/prysm.sh beacon-chain --execution-endpoint=http://localhost:8551 --prater --jwt-secret=/data/prysm/jwt.hex --genesis-state=/data/prysm/genesis.ssz   --datadir=/data/prysm/data --accept-terms-of-use=true 
Restart=always
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

查看区块同步

查看geth节点

使用以下命令检查节点的同步状态:

curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' http://localhost:8545

如果节点已完成同步,将看到响应:

{"jsonrpc":"2.0","id":1,"result":false}

查询最新区块高度

# curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:8545
{"jsonrpc":"2.0","id":1,"result":"0xedd589"}

查看prysm节点

使用以下命令检查节点的同步状态:

# curl http://localhost:3500/eth/v1alpha1/node/syncing

如果节点已完成同步,将看到响应:

{"syncing":false}

prysm升级

# ./prysm.sh beacon-chain --version
Downloading beacon chain@v4.0.2 to /data/prysm/dist/beacon-chain-v4.0.2-linux-amd64 (automatically selected latest available version)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  104M  100  104M    0     0   283M      0 --:--:-- --:--:-- --:--:--  284M
Verifying binary integrity.
beacon-chain-v4.0.2-linux-amd64: OK
gpg: Signature made Thu Apr 13 13:01:31 2023 JST
gpg:                using RSA key 0AE0051D647BA3C1A917AF4072E33E4DF1A5036E
gpg: Good signature from "Preston Van Loon <preston@prysmaticlabs.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 /data/prysm/dist/beacon-chain-v4.0.2-linux-amd64 has been signed by Prysmatic Labs.
Starting Prysm beacon-chain --version
beacon-chain version Prysm/v4.0.2/75338dd83d943ed5e13635cd0578c38a3b2d248b. Built at: 2023-04-13 03:22:20+00:00

参考文档

https://learnblockchain.cn/question/4129

https://docs.prylabs.network/docs/install/install-with-script

goerli 浏览器: https://goerli.etherscan.io/

posted @ 2022-10-12 20:47  小吉猫  阅读(872)  评论(0编辑  收藏  举报