Skip to content

Base节点部署

Base节点基于Eth,需要先运行Eth节点。 https://docs.base.org/chain/run-a-base-node 服务器配置 8C/32G/20T硬盘

安装docker

curl -fsSL https://get.docker.com -o get-docker.sh
bash ./get-docker.sh

下载快照

#全节点快照,占用磁盘7.5T,可以临时挂个盘保存下载文件
cd /opt
git clone https://github.com/base/node.git
mkdir -p /opt/node/geth-data/
cd /mnt
#官方
screen wget -c https://mainnet-full-snapshots.base.org/$(curl https://mainnet-full-snapshots.base.org/latest)
#加速 https://basechaindata.vercel.app/
screen axel https://basechaindata.vercel.app/api/download?url=https%3A%2F%2Fmainnet-full-snapshots.base.org%2F
#解压
screen tar --zstd -xvf base-mainnet-full-1746709987.tar.zst -C /opt/node/geth-data/
cd /opt/node/geth-data/
mv snapshots/mainnet/download/geth/* .

安装Base

cd /opt/node
vi .env.mainnet
# .env.mainnet or .env.sepolia
OP_NODE_L1_ETH_RPC=https://eth-rpc.gaojinbo.com:8545
OP_NODE_L1_BEACON=https://eth-rpc.gaojinbo.com:5052
OP_NODE_L1_BEACON_ARCHIVER=https://eth-rpc.gaojinbo.com:5052
docker compose up --build -d

升级

cd /opt
git clone https://github.com/base/node.git node20250513
ln -s /opt/node/geth-data /opt/node20250513/geth-data
cd node20250513
vi .env.mainnet
OP_NODE_L1_ETH_RPC=https://eth-rpc.gaojinbo.com:8545
OP_NODE_L1_BEACON=https://eth-rpc.gaojinbo.com:5052
OP_NODE_L1_BEACON_ARCHIVER=https://eth-rpc.gaojinbo.com:5052
#SNAP快速同步,占用空间2T左右,可以不下载全节点快照
OP_NODE_L1_TRUST_RPC=true
# SNAP SYNC
# NOTE: This feature is experimental and may lead to syncing issues, delays or difficulties as a result of inability to find peers. We recommend running a full or archive node for production purposes.
# To enable snap sync, uncomment and set the env vars below:
OP_NODE_SYNCMODE=execution-layer
OP_GETH_BOOTNODES=enode://87a32fd13bd596b2ffca97020e31aef4ddcc1bbd4b95bb633d16c1329f654f34049ed240a36b449fda5e5225d70fe40bc667f53c304b71f8e68fc9d448690b51@3.231.138.188:30301,enode://ca21ea8f176adb2e229ce2d700830c844af0ea941a1d8152a9513b966fe525e809c3a6c73a2c18a12b74ed6ec4380edf91662778fe0b79f6a591236e49e176f9@184.72.129.189:30301,enode://acf4507a211ba7c1e52cdf4eef62cdc3c32e7c9c47998954f7ba024026f9a6b2150cd3f0b734d9c78e507ab70d59ba61dfe5c45e1078c7ad0775fb251d7735a2@3.220.145.177:30301,enode://8a5a5006159bf079d06a04e5eceab2a1ce6e0f721875b2a9c96905336219dbe14203d38f70f3754686a6324f786c2f9852d8c0dd3adac2d080f4db35efc678c5@3.231.11.52:30301,enode://cdadbe835308ad3557f9a1de8db411da1a260a98f8421d62da90e71da66e55e98aaa8e90aa7ce01b408a54e4bd2253d701218081ded3dbe5efbbc7b41d7cef79@54.198.153.150:30301
OP_GETH_SYNCMODE=snap
sudo docker compose up --build -d

监控

sudo docker exec -it node-execution-1 bash
./geth attach http://localhost:8545
eth.syncing
eth.blockNumber
curl -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false]}' \
-H "Content-Type: application/json" http://localhost:8545|jq
#10秒打印1次当前块高度
while true; do echo $(($(curl -s -d '{"id":0,"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest",false]}' -H "Content-Type: application/json" http://localhost:8545/|jq .result.number|awk -F'"' '{print $2}')));sleep 10; done

nginx代理

server {
listen 443 ssl;
server_name base-rpc.gaojinbo.com;
keepalive_timeout 70;
ssl_certificate ssl/new/base-rpc.gaojinbo.com.pem;
ssl_certificate_key ssl/new/base-rpc.gaojinbo.com.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
access_log /var/log/nginx-base.log;
location ^~/7b75evcQjPjrWBUuccfdfRnng9vSDXFf/ {
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
#以下代码使支持WebSocket
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://localhost:8545/;
}
location / {
return 404;
}
location /123 {
return 200;
}
}

TOP