高进波的博客 其他 debian/ubuntu运行以太坊Base节点L2

debian/ubuntu运行以太坊Base节点L2

base节点需要eth l1节点正常运行后,才能启动。

cd /opt/
git clone https://github.com/base-org/node
apt install docker-compose-v2
vi docker-compose.yml
#.env.mainnet
vi .env.mainnet
"# [required] replace with your preferred L1 (Ethereum, not Base) node RPC URL:
OP_NODE_L1_ETH_RPC=https://1rpc.io/2r7ZNJXBgtEge3wYu/eth
#OP_NODE_L1_ETH_RPC=http://54.169.57.91:8545
# [required] replace with your preferred L1 CL beacon endpoint:
OP_NODE_L1_BEACON=https://beaconstate.info
#OP_NODE_L1_BEACON=http://54.169.57.91:5052"

docker compose up --build -d

查看区块同步情况

vi ~/sync_status.sh
"#!/bin/bash

while true
do
    echo ""每10秒打印1次""
echo Latest synced block behind by: $((($(date +%s)-$( \
  curl -s -d '{""id"":0,""jsonrpc"":""2.0"",""method"":""optimism_syncStatus""}' \
  -H ""Content-Type: application/json"" http://localhost:7545 | \
  jq -r .result.unsafe_l2.timestamp))/60)) minutes
    sleep 10
done"
chmod +x ~/sync_status.sh
~/sync_status.sh

Related Post