Run a Node
Introduction
zkLink Nova self-hosted RPC node is based on zkSync external node. You can find detailed information about zkSync external node here. This section focus on how to build a zkLink Nova self-hosted RPC node.
Quick Start
Preferred hardware configuration
This configuration is approximate, expect updates to these specs.
Architecture: AMD64
CPU: 32 core
RAM: 64 GB
Storage:
Testnet - ~1 TB (at the time of writing) and will grow over time, so should be constantly monitored
Mainnet - ~2 TB (at the time of writing) and will grow over time, so should be constantly monitored
NVMe recommended
Network: 100 Mbps network connection.
Software Prerequisites
You can follow Docker's official manuals to install docker compose
and Docker
.
Running zkLink Nova self-hosted RPC Node locally
We offer a docker-compose file to facilitate running a zkLink Nova self-hosted rpc node locally.
Create data folder
start pg sevice
Import backup data from Snapshot
Start zkLink Nova Self-hosted RPC Node
To start a mainnet instance, run:
To reset its state, run:
You can see the status of the node (after recovery) in the local Grafana dashboard. Those commands start external node locally inside docker. The HTTP JSON-RPC API can be accessed on port 3060 and WebSocket API can be accessed on port 3061.
Tips
After importing the data, the blocks will be scanned to restore the Merkle tree with 2000 batches per hour speed. Block synchronization will continue only after the recovery is complete. The speed of importing snapshot data into Postgres is 100G/h, the speed of rebuilding the Merkle tree is 2000 batches/h, with the specific time depending on the database snapshot.
Get local latest block
curl http://localhost:3060 -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
When first start service, it will take 5 hours to struct Merkle tree.
Building External Node from Source Code
This document outlines how to build the External Node from the zkLink Nova source code, supporting three ways:
Building the binary file for the External Node directly from the source code.
Building the Docker image for the External Node directly from the source code.
Customizing the Docker image for the External Node built from the source code.
Install Dependencies
Run the following commands to install the necessary dependencies.
Note: If you only wish to build the Docker image for the zkLink Nova External Node from the source code, you only need to install the Docker-related dependencies.
Rust and Tools
NVM and Node/Yarn
System Software
Docker
Pulling Source Code
Use the command below to pull the zkLink Nova source code and fetch the submodules. If you wish to build code related to the zkLink Nova Sepolia testnet, please use the zklink_testnet branch.
Run the command below to set up the working directory:
Build the External Node
If you only wish to build the binary file for the External Node
Execute the command below; the results will be located in the target/release directory.
If you want to build the Docker image for the External Node from source
Run the command below:
If you want to customize the Docker image for the External Node
Refer to all the BUILD and COPY commands in the docker/external-node/Dockerfile file to customize the Docker image for the zkLink Nova External Node.
Last updated