L2 Archive Node Setup guide
Setting up the L2 Archive node for the Watchtower Node
Step 1: Install Software Dependencies
Ensure that the following software dependencies are installed and meet the specified version requirements. Use the provided version check commands to confirm:
Step 2: Set-up L2 node via set-up script
If you want to use a script that will automatically download the snapshot and set-up and start L2 node follow this step and skip steps 3-8. If you want to manually download the snapshot and set-up L2 node, then skip this step and go to step 3.
Download the scripts to set-up L2:
git clone https://github.com/kaleidoscope-blockchain/l2-set-up.gitThe folder l2-set-up, will have script run that starts the set-up process. The run script takes two arguments,
chain-name - "base" or "optimism". Currently only base and optimism L2 are supported
L1_RPC_URL - Give the Sepolia RPC URL that you use to connect to L1
For example,
cd l2-set-up
./run optimism https://eth-sepolia.g.alchemy.com/v2/hhTXZSBtLsbNN-wXWpErThgYi9sNNKTPThe script will start a tmux shell with name "set-up-l2" that will download the snapshot. You can connect to tmux shell via the command,
tmux a -t set-up-l2Once the download of snapshot is done, tmux shell is terminated. After download of snapshot, geth and node clients are started in tmux shells with names, "optimism-geth" and "optimism-node" if optimism is selected, else if base is selected the tmux shell names will be "base-geth" and "base-node". To connect to a tmux shell, run the command
If you follow step 2, then skip steps 3-8 and go to step 9
Step 3: Download the Snapshot
To initiate the Watchtower environment, begin by downloading the latest available snapshot hosted by WitnessChain as a part of Light configuration for L2 node setup. Use the following commands:
For op-sepolia:
For base-sepolia:
Medium configuration for L2 node setup
Alternatively operators can consider publicly posted snapshots to start their node syncs. These snapshots are not hosted by WitnessChain, hence their availability and recency is subject to L2 chains publishing it themselves.
Note that WitnessChain highly encourages operators to utilize the snapshot hosted by us for a faster node setup and save days worth of time and compute on the same. That said, we're committed to keeping the watchtowers as trustless and neutral entities, hence the operators can feel free to choose the source of trust for their snapshot.
Step 4: Building the Optimism monorepo (Rollup Node/op-node)
Clone the optimism monorepo and cd into it
Checkout to the release branch (op-node/v1.7.0 as of Mar 17, 2024)
op-node/v1.7.0 as of Mar 17, 2024)Install nodejs dependencies and build nodejs packages
Build op-node
Step 5: Build Execution Client (op-geth)
Clone the op-geth repo, switch to the release branch (e.g., v1.101308.0 as of Feb 24, 2024 ), and build op-geth:
Step 6: Create a JWT Secret
Generate a 32-byte hex string as a shared secret for communication between op-node and op-geth:
Step 7: Configure and Start op-geth
Navigate to the op-geth directory, copy the JWT secret, and start op-geth:
Unzip snapshot from step 1 in /datadir/ in the same directory where you built op-geth. The final path for snapshot would look something like this
/path/to/op-geth/datadir/geth
if your path after snapshot unzipping and moving does not look as above, please either rename any directory required for the same or update the value of --datadir flag to point to path of the snapshot in the script below.
Create the following scripts in the same directory where you built op-geth,based on the L2 chain you would like to setup
run-geth-optimism.shforop-sepoliaorrun-geth-base.shforbase-sepolia
The following commands will start op-geth with our recommended configuration. The JSON-RPC API will become available on port 8545. Refer to the op-geth configuration documentation for more detailed information about available options.
for op-sepolia:
for base-sepolia:
Step 8: Configure and Start op-node
Navigate to the op-node directory, copy the JWT secret, and start op-node:
Create the relevant script in the same directory where you built op-node. Based on your network run-node-optimism.sh for op-sepolia or run-node-base.sh for base-sepolia
In the script, replace <L1_RPC_URL> with your sepolia (L1) RPC url and <L1_BEACON_NODE_URL> with url of corresponding beacon node.
Use the following command to start op-node with the recommended configuration. Refer to the op-node configuration documentation for more detailed information about available options.
for op-sepolia:
for base-sepolia:
9. Post Setup
Synchronization
Once you've started op-geth and op-node you should see the two begin to communicate with each other and synchronize the L2 chain. Initial synchronization can take several hours to complete.
During this time, you will initially observe op-node deriving blocks from Sepolia without sending these blocks to op-geth. This means that op-node is requesting blocks from Sepolia one-by-one and determining the corresponding L2 blocks that were published to Sepolia. You should see logs like the following from op-node:
Once the op-node has derived enough blocks from Sepolia, it will begin sending these blocks to op-geth. You should see logs like the following from op-node:
You should then also begin to see logs like the following from op-geth:
Tracking the sync progress
You can run the following script, which will, over a minute, estimate the current sync speed and based on it the expected time for the sync to complete. The result is printed on the terminal, though remember that it is only an estimate.
Create a file run-estimate.sh and paste the following code in it:
Then run ./run-estimate.sh and wait for about 1 minute to see the sync speed and ETA.
Official Reference Documentation
Optimism’s guide to building a node: Building a Node from Source | Optimism Docs
Base’s guide to running a node : Running a Base Node | Base
Migrating the L2
Stop your current L2 node (both
op-nodeandop-geth)Delete the old state of the goerli network
navigate to datadir
cd /home/.../op-geth/datadir/
remove the old state
sudo rm -rf ./geth
Download the state snapshot for a sepolia L2 following Setp 3
Refer Step 9 for post setup help
Upgrading the L2
upgrading your existing L2 to support Ecotone upgrade
Stop your current L2 node (both
op-nodeandop-geth)Upgrade op-geth
./run-geth-optimism.shor./run-geth-base.sh
Upgrade op-node
cd op-nodeadd the following flag to your op-node run script
--l1.beacon=<L1_BEACON_NODE_URL>refer Step 8: Configure and Start op-node for how the final script file should look like
./run-node-optimism.shor./run-node-base.sh
Last updated