部署optimism主网全节点和legacy节点

全节点和存档节点快照页:

https://docs.optimism.io/builders/node-operators/management/snapshots#op-mainnet

下载全节点快照:

https://publicnode.com/snapshots

cd  /mnt/optimism/op_geth/data

aria2c -s8 -x8 -k1024M https://datadirs.optimism.io/mainnet-bedrock.tar.zst -o ./mainnet-bedrock.tar.zst
tar -I zstd -xvf mainnet-bedrock.tar.zst

编译op-node

https://docs.optimism.io/builders/node-operators/tutorials/node-from-source

/mnt/optimism/src# git clone https://github.com/ethereum-optimism/optimism.git
git checkout v1.7.7

编译op-geth

git clone https://github.com/ethereum-optimism/op-geth.git
cd op-geth

git checkout v1.101315.2

make geth
 cd /mnt/optimism/op_geth/
/mnt/optimism/op_geth# openssl rand -hex 32 > jwt.txt

启动op-geth

cat /lib/systemd/system/op-geth.service
[Unit]
  Description=op

[Service]
  ExecStart=/mnt/optimism/bin/geth --verbosity 3 \
            --syncmode=full --gcmode full \
            --port 30346 \
            --http --http.addr 0.0.0.0 --http.api eth,net,web3,debug,personal --http.port 36545 --http.corsdomain * --http.vhosts * --graphql \
            --ws --ws.addr 0.0.0.0 --ws.api eth,net,web3,debug,personal --ws.port 36546 --ws.origins * \
            --rollup.sequencerhttp=https://mainnet-sequencer.optimism.io/ \
             --rollup.disabletxpoolgossip=true  \
            --authrpc.addr=127.0.0.1 --authrpc.port=8700 --authrpc.vhosts=* --authrpc.jwtsecret=/mnt/optimism/op_geth/jwt.txt \
            --datadir=/mnt/optimism/op_geth/data --op-network=op-mainnet
  Type=simple

[Install]
WantedBy=multi-user.target
systemctl start op-geth
启动op-node

cat /lib/systemd/system/op-node.service 
[Unit]
  Description=op-node
  StartLimitIntervalSec=500
  StartLimitBurst=5

[Service]
  WorkingDirectory= /mnt/optimism/op_node
  ExecStart=/mnt/optimism/bin/op-node  \
            --l1='http://xxxxx:8545' --l1.beacon='http://xxxxx:3500' --l1.rpckind=any --l1.trustrpc=true  \
            --l2=ws://127.0.0.1:8700 --l2.jwt-secret=/mnt/optimism/op_geth/jwt.txt --rpc.addr=127.0.0.1 --rpc.port=8900 \
            --network=op-mainnet  --metrics.enabled    --syncmode=execution-layer 

  Type=simple

[Install]
  WantedBy=multi-user.target

需要连接到eth存档节点,如果是用erigon跑的,且用了Caplin内部共识,则需要启用beacon端口

/usr/local/bin/erigon     --datadir=/data/erigon/erigon-data     --private.api.addr=localhost:7090     --authrpc.jwtsecret=/data/erigon/jwtsecret     --authrpc.port 8551     --http     --http.port 9545     --http.addr=0.0.0.0     --http.vhosts=*     --http.corsdomain=*     --ws     --ws.port 9546     --http.api=engine,eth,web3,net,debug,trace,txpool     --port 22303     --downloader.disable.ipv6=true     --torrent.upload.rate=50mb     --torrent.download.rate=1024mb     --torrent.port=22068     --rpc.batch.limit=10000       --db.read.concurrency 2000 --rpc.batch.concurrency 10000     --nat="extip:x.x.x.x"     --internalcl    \
--beacon.api=beacon,builder,config,debug,node,validator,lighthouse  --beacon.api.port=3500   --beacon.api.addr=0.0.0.0  --authrpc.addr=0.0.0.0

如果需要升级前的历史数据,还需要运行legacy node,下载历史数据快照:

aria2c -s8 -x8 -k1024M https://datadirs.optimism.io/mainnet-legacy-archival.tar.zst
服务器技术交流群请加微信 YJZyjz