From 7f45ca0b95c699a69202a287d3bfa7a8fe5cf381 Mon Sep 17 00:00:00 2001 From: Mauro Medda Date: Tue, 30 Jul 2024 13:25:35 +0200 Subject: [PATCH] (add): z2 node joining documentation (#25) * (add): z2 node joining documentation * (add): z2 ubuntu dependencies * (fix): trunk fmt nodes.md * (fix): makes trunk happy * (add): full deps installation list * update doc * Fix liniting * update doc * update doc * update doc --------- Co-authored-by: Chetan Phirke --- zq2/docs/nodes.md | 124 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 114 insertions(+), 10 deletions(-) diff --git a/zq2/docs/nodes.md b/zq2/docs/nodes.md index aca2c03..4a49a6b 100644 --- a/zq2/docs/nodes.md +++ b/zq2/docs/nodes.md @@ -5,25 +5,129 @@ title: Nodes and Validators # Nodes and Validators -The current proto-testnet version of Zilliqa 2.0 allows users to setup a node and join the network. +The current proto-testnet version of Zilliqa 2.0 allows users to setup a node +and join the network. + +Both API nodes and validator nodes use the same software, though API nodes do +not participate in the consensus process. This guide provides instructions for +setting up both types of nodes. Further details on securing validator nodes +will be added as we approach the mainnet launch. + +## Zilliqa 2.0 (proto-testnet) Prerequisites + +### Hardware requirements + +- CPU: + - 1 Core / 2 threads or more +- RAM: + - 8 GB or more +- Disk: + - 100 GB or more + +### Virtual machines on Cloud Platforms + +We are running our Zilliqa 2.0 validators on Google Cloud Platform, GCP, +GCE VM `e2-standard-2` instance with 256 GB SSD (`pd-ssd`). + +If you running on other cloud provider, please do select an instance with +similar specs. + +### Software requirements + +1. Operating System: We build and run on Ubuntu 20.04LTS +2. Docker: 27.0.3+ + +### Port-forwarding + +The following TCP ports need to be open to the internet for both inbound and +outbound. + +_NOTE: We don't recommend to run validators behind a NAT, if you're doing so +and you are facing any traversal issue you might have to debug on your own._ + +#### Required + +3333/TCP - P2P protocol port: has to be opened on inbound and outbound to +public internet. + +#### Optional + +4201/TCP - JSONRPC over HTTP: API port, only necessary if you want your API to +be accessible via the internet. ### Running a Node -``` py -[INSERT GUIDE HERE] -``` +To run a Zilliqa 2.0 node and join the proto-testnet, we provide the `z2` +utility as part of the [zq2](https://github.com/Zilliqa/zq2/blob/main/) code +base. +The `z2 join` command creates the validator node startup script and configuration +file that you can copy and paste on your Ubuntu VM, configured as per above specs, +and run. + +### Step by step guide + +1. Cargo and Rust: You need to have Cargo and Rust installed on your system. + You can install them using [rustup](https://rustup.rs/). Once rustup is installed, + you can update Rust to the latest stable version. +2. Install the following requirements: + + ```bash + sudo add-apt-repository ppa:ethereum/ethereum && sudo apt update && \ + sudo apt install -y solc build-essential pkg-config libssl-dev cmake \ + protobuf-compiler + ``` + +3. Pick a directory. You'll need quite a lot of space. Let's call it `/my/dir`. +4. Clone `git@github.com:zilliqa/zq2` into that directory to get `/my/dir/zq2`. +5. Build the code using `cargo build`. +6. Source the setenv file: + + ```bash + source /my/dir/zq2/scripts/setenv + ``` + + This will give you access to the `z2` tool (in `zq2/z2`). + +7. Generate the startup script and the configuration file for your node by running: + + ```bash + z2 join --chain zq2-prototestnet + ``` + +8. Generate the node private key (save it because you need to use it in case you need to restart your node): + + ```bash + export PRIVATE_KEY=$(openssl rand -hex 32) + ``` + +9. Start the validator node: + + ```bash + chmod +x start_validator.sh && \ + ./start_validator.sh $PRIVATE_KEY + ``` + +For additional details on `z2` and the `join` capability refer to: + +- +- ### Becoming a Validator -Under the consensus mechanism introduced in Zilliqa 2.0, validators stake ZIL to secure the network, in return for which they receive a share of block rewards. -While becoming a validator on the Zilliqa 2.0 mainnet will be permissionless, on the current proto-testnet you need to request the minimum required stake of 10 million ZIL in order for you to register as a validator. +Under the consensus mechanism introduced in Zilliqa 2.0, validators stake ZIL +to secure the network, in return for which they receive a share of block +rewards. + +While becoming a validator on the Zilliqa 2.0 mainnet will be permissionless, +on the current proto-testnet you need to request the minimum required stake of +10 million ZIL in order for you to register as a validator. -To register as a validator on the Jasper proto-testnet, please complete and submit this form. +To register as a validator on the Jasper proto-testnet, please complete and +submit this form. +Once you have sufficient $ZILs you can register your node as validator. Below is a guide on how to register a validator node for Zilliqa 2.0: -``` py -[INSERT GUIDE HERE] -``` +