Skip to content

Commit

Permalink
(add): z2 node joining documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mauromedda committed Jul 1, 2024
1 parent 2ad9a4a commit 31c8d65
Showing 1 changed file with 66 additions and 3 deletions.
69 changes: 66 additions & 3 deletions zq2/docs/nodes.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,73 @@ title: Nodes and Validators

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.sh).
2. Pick a directory. You'll need quite a lot of space. Let's call it `/my/dir`.
3. Clone `git@github.com:zilliqa/zq2` into that directory to get `/my/dir/zq2`.
4. Source the setenv file `source /my/dir/zq2/scripts/setenv`. This will give you access to the `z2` tool (in `zq2/z2`).
5. Generate the startup script and the configuration file for your node by running
```bash
z2 join --chain prototestnet
```
6. 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)
```
7. Start the validator
```bash
chmod +x start_validator.sh && \
./start_validator.sh $PRIVATE_KEY
```

For additional details on `z2` and the `join` capability refer to:
- https://github.com/Zilliqa/zq2/blob/main/z2/docs/README.md
- https://github.com/Zilliqa/zq2/blob/main/z2/docs/join.md

### 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.
Expand All @@ -22,6 +83,8 @@ While becoming a validator on the Zilliqa 2.0 mainnet will be permissionless, on
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
Expand Down

0 comments on commit 31c8d65

Please sign in to comment.