👽ZK-Node

Authors: [man4ela | catapulta.eth]

System Requirements

CPU

OS

RAM

DISK

4+ cores CPU

Debian 12/Ubuntu 22.04

=> 16 GB RAM

1TB+ (SSD or NVMe)

The X Layer archive node has a size of 560GB on November 18th, 2024

Setup XLayer Node

X Layer is an EVM-compatible Layer 2 network built with Polygon CDK, using Zero-Knowledge (ZK) technology to enhance Ethereum’s scalability, security, and efficiency

Indexer Test for X Layer POI
  • Sync the following subgraph: QmWHYMV9mPZ6zoomwWSZbN24sdGSEQhy1efritMiETpxqS

  • Query to grab the normalized POI

    • Note: Do not modify the query below - the indexer address in the query should be the 0x0 address.

{
  "query": "{ proofOfIndexing(subgraph: \\"QmWHYMV9mPZ6zoomwWSZbN24sdGSEQhy1efritMiETpxqS\\", blockNumber: 3041190, blockHash: \\"0xa819924ad94bcf3295826d5ad916c9ef06fac8cb46a6273d3bcc7aec822e22e7\\", indexer: \\"0x0000000000000000000000000000000000000000\\") }"
}

If there is a match for the Consensus POI provided below, it may indicate that the setup allows for syncing other subgraphs and being in majority consensus. If there is a match for the Divergent POI, this can be an indication of a data determinism issue.

Consensus 0xa1223b5cbabf16d9896c2bd19099d08e5ce45c7ff308674b3ea7ada5367334bf

Divergent 0x411bf0293e96a1459167ef1828aa7d70cd6c2e1f8c4210e0edf0fa8827eeed69

  • Shell into the index node and run this curl command curl -s -X POST -H "Content-Type: application/json" --data '{"query": "{ proofOfIndexing(subgraph: "QmWHYMV9mPZ6zoomwWSZbN24sdGSEQhy1efritMiETpxqS", blockNumber: 3041190, blockHash: "0xa819924ad94bcf3295826d5ad916c9ef06fac8cb46a6273d3bcc7aec822e22e7", indexer: "0x0000000000000000000000000000000000000000") }"}' "http://localhost:8030/graphql"

Pre-Requisties

Important dependency note: You must install libpqxx version 6.4.5. If your distribution installs a newer version, please compile libpqxx 6.4.5 and install it manually instead

Use dpkg to check the Installed version of libpqxx:

Setting up Firewall

Set explicit default UFW rules

Allow SSH

Allow remote RPC connections with Blast Node

Enable Firewall

To check the status of UFW and see the current rules

Install GO

Go version 1.21+ is required to build ZKnode

Build ZKnode

Move the xlayer-node binary from the build directory to the designated directory for execution:

Download ZKnode configuration and genesis.json file:

Carefully change the following parameters inside configuration file:

[State.DB]

Host = "xlayer-mainnet-state-db"

#specify Host = "127.0.0.1"

[Pool.DB]

Host = "xlayer-mainnet-pool-db"

#specify Host = "127.0.0.1"

[Etherman]

URL = ""

#input your synced L1 Ethereum RPC endpoint

[Synchronizer]

SyncInterval = "1s"

SyncChunkSize = 100

#add a line L1SynchronizationMode = "sequential"

[MTClient]

URI = "xlayer-mainnet-prover:50061"

#specify URI = "127.0.0.1:50061"

[Executor]

URI = "xlayer-mainnet-prover:50071"

#specify URI = "127.0.0.1:50071"

[Metrics]

Host = "0.0.0.0"

#specify Host = "127.0.0.1"

[HashDB]

Host = "xlayer-mainnet-state-db"

#specify Host = "127.0.0.1"

Compile and build ZKProver

Download necessary files

Download an archive (~75GB). It's a good idea to have it running in the screensession:

The archive will take up an additional 115GB of space once extracted.

Consider to recompile the protobufs:

Run make to compile the main project:

Test Vectors

Download configuration files:

Modify prover.config.json:

Replace

with

Create systemd files for the ZKEVM Node components

Zknode:

Paste the configs and save by entering ctrl+X and Y+ENTER:

Synchronizer:

and ZKProver:

Configure Postgresql for ZKProver

Make sure to be inside /root/zknode/zkevm-prover/ directory:

Example of expected output

Depending on your Postgresql version (14 or 15) update postgresql.conf:

Set max_connections = 500

Save, Quit and reload postgresql to apply changes by running:

Launch X Layer node:

Monitor logs

During the synchonization, you are expected to get following log messages:

ZKNode:

ZKProver:

Synchronizer:

Run curl command in the terminal to check the status of your node

When it returns false then your node is fully synchronized with the network

References

Last updated

Was this helpful?