- Sequencer and prover functionalities are not covered in this document as they are still undergoing development and rigorous testing.
- Syncing the zkNode currently takes anywhere between 1-2 days depending on various factors. The team is working on snapshots to improve the syncing time.
Prerequisites
This tutorial requires adocker-compose installation.
Run the following to create a directory:
Minimum hardware requirements
- 16GB RAM
- 4-core CPU
- ~250/350GB storage (increasing over time)
Software requirements
- An Ethereum node; Geth or any service providing a JSON RPC interface for accessing the L1 network.
- zkEVM node (or zkNode) for the L2 network.
- Synchronizer which is responsible for synchronizing data between L1 and L2.
- A JSON RPC server which acts as an interface to the L2 network.
Ethereum node setup
We set up the Ethereum node first as it takes a long time to synchronize. We recommend using Geth but a Sepolia node is OK too. Follow the instructions provided in this guide to setup and install Geth. If you plan to have more than one zkNode in your infrastructure, we advise using a machine that is specifically dedicated to this implementation.zkNode setup
Once the L1 installation is complete, we can start the zkNode setup. This is the most straightforward way to run a zkEVM node and it’s fine for most use cases. However, if you want to provide service to a large number of users, you should modify the default configuration. Furthermore, this method is purely subjective and feel free to run this software in a different manner. For example, Docker is not required, you could simply use the Go binaries directly. Let’s start setting up our zkNode:-
Launch your command line/terminal and set the variables using below commands:
-
Download and extract the artifacts. Note that you may need to install unzip before running this command.
-
Copy the
example.envfile with the environment parameters: -
The
example.envfile must be modified according to your configurations. Edit the .env file with your favorite editor (we use nano): -
To run the zkNode instance, run the following command:
-
Run this command to check if everything went well and all the components are running properly:
You will see a list of the following containers:
- zkevm-rpc
- zkevm-sync
- zkevm-state-db
- zkevm-pool-db
- zkevm-prover
-
You should now be able to run queries to the JSON-RPC endpoint at
http://localhost:8545.
Testing
Run the following query to get the most recently synchronized L2 block; if you call it every few seconds, you should see the number grow:Stopping the zkNode
Use the below command to stop the zkNode instance:Updating the zkNode
To update the zkNode software, repeat the setup steps, being careful not to overwrite the configuration files that you have modified. In other words, instead of runningcp $ZKEVM_DIR/testnet/example.env $ZKEVM_CONFIG_DIR/.env, check if the variables of $ZKEVM_DIR/testnet/example.env have been renamed or there are new ones, and update $ZKEVM_CONFIG_DIR/.env accordingly.
Troubleshooting
-
It’s possible that the machine you’re using already uses some of the necessary ports. In this case you can change them directly in
$ZKEVM_DIR/testnet/docker-compose.yml. -
If one or more containers are crashing, please check the logs using the below command:
- Batches are closed every 10s, or whenever they are full.
- The frequency of closing batches is subject to change as it depends on the prevailing configurations.
- The batch rate always needs to be updated accordingly.