L2 Archive Node Setup guide
Setting up the L2 Archive node for the Watchtower Node
If you're an existing operator looking to migrate your your node from goerli to sepolia, skip to migrating the L2
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
As of ecotone upgrade, this script is outdated, we're working to update it to support the latest version. Meanwhile please continue with rest of the guide below, skipping Step 2.
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:
The 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,
The 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,
Once 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:
Consider using a download acceleration tool like aria2c for faster downloads.
An example for downloading base snapshot:
aria2c -s16 -x16
$(curl https://witnesschain-l2-snapshots.s3.amazonaws.com/op-latest)
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
It's generally easier to start op-geth
before starting op-node
. You can still start op-geth
without yet running op-node
, but the op-geth
instance will simply not receive any blocks until op-node
is started.
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.sh
forop-sepolia
orrun-geth-base.sh
forbase-sepolia
chmod +x for all the below mentioned scripts, if you run into permission issues
It is recommended you use tmux to run this in a detached background process
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
chmod +x for all the below mentioned scripts, if you run into permission issues
In the script, replace <L1_RPC_URL>
with your sepolia (L1) RPC url and <L1_BEACON_NODE_URL>
with url of corresponding beacon node.
If you don't currently have access to a beacon node, you can setup any of the available software for it, including Lighthouse, Prysm etc. using their docs. One such guide can be found here to setup a Prysm node: https://docs.prylabs.network/docs/install/install-with-script
Some L1 nodes, like Erigon, do not support the eth_getProof
RPC method that the op-node
uses to load L1 data for certain processing steps. If you are using an L1 node that does not support eth_getProof
, you will need to include the --l1.trustrpc
flag when starting op-node
. You’ll have to modify the script with the same. Note that this flag will cause op-node
to trust the L1 node to provide correct data as it will no longer be able to independently verify the data it receives.
It is recommended you use tmux to run this in a detached background process
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:
chmod +x for all the below mentioned scripts, if you run into permission issues
Then run ./run-estimate.sh
and wait for about 1 minute to see the sync speed and ETA.
Official Reference Documentation
Migrating the L2
Stop your current L2 node (both
op-node
andop-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-node
andop-geth
)Upgrade op-geth
./run-geth-optimism.sh
or./run-geth-base.sh
Upgrade op-node
cd op-node
add 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.sh
or./run-node-base.sh
If you don't currently have access to a beacon node, you can setup any of the available software for it, including Lighthouse, Prysm etc. using their docs. One such guide can be found here to setup a Prysm node: https://docs.prylabs.network/docs/install/install-with-script
Last updated