# Validator Nodes

A validator runs a node that verifies transactions and finalizes blocks on the Venidium Blockchain. Each validator candidate must provide the minimum Venidium collateral (500,000 XVM) into their pool and setup a functional node to participate. They start as pending candidates, and have the chance to become validator candidates each week when a new validator candidates set is chosen.\
\
\&#xNAN;*The amount of maximum active validator nodes in the network is set to 19.*\
*If there are more than 19 validator candidates, at the beginning of each epoch 19 are randomly chosen by the contracts from the amount of valid validator candidates.*

**Minimum System Requirements**

CPU: 2 cores\
RAM: 4GB\
Disk: 100GB SSD\
Stable Internet Connection

**Recommended System Requirements**

CPU: 4 cores\
RAM: 6GB\
Disk: 250GB SSD\
Stable Internet Connection

## Getting the required files <a href="#id-142a" id="id-142a"></a>

Clone this repository or [download the repository as a zip file](https://github.com/Venidium-Network/venidium-evm-node/archive/refs/heads/main.zip) and extract it

In the extracted files, you should see a `nodes` directory.

## Linux <a href="#b7c4" id="b7c4"></a>

[Install Docker and Docker Compose](https://docs.docker.com/engine/install/)&#x20;

(choose your platform from the list i.e. Ubuntu)

In example, for Ubuntu, the setup steps would look like this:

*the commands shown bellow should be typed in your terminal window*

1. `sudo apt-get remove docker docker-engine docker.io containerd runc`
2. `sudo apt-get update`
3. `sudo apt-get install ca-certificates curl gnupg lsb-release`
4. `sudo mkdir -p /etc/apt/keyrings`
5. `curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg`
6. `echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null`
7. `sudo apt-get update`
8. `sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin`
9. `sudo systemctl enable docker.service`
10. `sudo systemctl enable containerd.service`

## Set up your node configuration <a href="#fc53" id="fc53"></a>

1. On your terminal window type `cd` and make sure to leave a space after the command (don’t press enter yet)
2. Drag-n-drop the `nodes` folder on the terminal window and press enter
3. Type `../generate-key.sh` to generate a new private key and copy it
4. Edit `compose.yml` in `nodes/validator1` directory and replace `0000000000000000000000000000000000000000000000000000000000000000` on line `21` with the newly generated key that you have copied

{% hint style="danger" %}
It is very important to NOT USE this private key as an accoun&#x74;*!*

DO NOT import this private key to any wallet.

DO NOT make any transactions using this private key.
{% endhint %}

## Operate the node <a href="#id-0c8e" id="id-0c8e"></a>

1. Open a terminal window, type `cd` and make sure that you leave a space after the command (don't press enter yet)
2. Drag-n-drop the `nodes` folder on the terminal window and press enter

To start the node type `./run_all.sh` in the terminal and press enter.

To monitor your node type `./nodes/validator1/monitor-node.sh` in the terminal and press enter. You can check for any errors and see if your node is syncing.

To stop the node type `./stop_all.sh` in the terminal and press enter.

## macOS <a href="#cf01" id="cf01"></a>

Install Docker Desktop for Mac: [Install Docker Desktop on Mac | Docker Documentation](https://docs.docker.com/desktop/mac/install/)

For the following instructions to work you will need to have Docker Desktop running.

## Set up your node configuration <a href="#id-89fd" id="id-89fd"></a>

1. Open the `generate-key.sh` file to generate a new private key and copy it
2. Edit `compose.yml` in `nodes/validator1` directory and replace `0000000000000000000000000000000000000000000000000000000000000000` on line `21` with the newly generated key that you have copied

{% hint style="danger" %}
It is very important to NOT USE this private key as an accoun&#x74;*!*

DO NOT import this private key to any wallet.

DO NOT make any transactions using this private key.
{% endhint %}

## Operate the node <a href="#id-2c1d" id="id-2c1d"></a>

To start the node open the `run_all.sh` file which is inside the `nodes` folder.

To monitor your node open the `monitor-node.sh` file in the `nodes/validator1` directory. You can check for any errors and see if your node is syncing.

To stop the node open the `stop_all.sh` file which is inside the `nodes` folder.

## Validator Rewards & Penalties

After the Testnet we decided to add an incentive function for Validators. The responsibility of a Validator Node is high, especially when huge amounts are delegated to the Validator. In case of malfunction/shutdown of an active Candidate Validator Node all staked Coins in that Validator Node get punished for disrupting the Network. **The punishment is a locking function for 90 days of all staked coins on that Candidate Validator Pool.**

**This occurs only if your validator node does not produce blocks within the last part of the epoch, indicated as a red area in** [**staking.venidium.io**](https://staking.venidium.io/) **or the last 4332 blocks before the end of the current epoch.**

![Epoch indicator. The last 4332 blocks are in the red area of the end of the epoch and also limits functionalities such as staking/unstaking or setting up a validator node, which do not work within that timeframe.](https://1626500663-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FYpNnPBuoyr7uJxH8CkaE%2Fuploads%2F5KA3SFYvpHvotlTxH6fC%2Fimage.png?alt=media\&token=b91d82d3-7916-4235-8e30-164abac7d334)

The rewards for validators and delegators are equally split depending on the staked amount. In case that a Validator has staked and a delegator stakes in that same pool but more than 80% of the total pool amount, the rewards become capped at 80% for the delegators while the Validator receives at minimum 20% of the rewards. POSDAO model had a few options and they show this model with a 30% minimum reward, but we believed 20% fit just better (we increased the minimum amount for delegators by 10%, we might adjust this in the future).

### Examples

**Example 1:**&#x20;

1 Validator = 500k Staked \
\&#xNAN;*= Validator receives total value of rewards himself.*

**Example 2:**&#x20;

1 Validator = 500k Staked\
1 Delegator = 500k Staked \
\&#xNAN;*= Validator and Delegator receive rewards equally.* \
*(The delegator staked amount is less than 80% of the total pool staked amount.)*

**Example 3:**&#x20;

1 Validator = 500k Staked \
1 Delegator = 3m Staked \
\&#xNAN;*= Since the amount staked by delegators is more than 80% of the pool, the validator receives the minimum of 20% of the total rewards, the delegator receives the rest.*

**Example 4:**&#x20;

1 Validator = 500k Staked \
1 Delegator A = 800k Staked \
1 Delegator B = 2m Staked \
1 Delegator C = 1m Staked \
\&#xNAN;*= Since the amount staked by delegators is more than 80% of the pool, the validator receives 20% of the rewards and the other 80% is split between the Delegators based on their staked amount.*

This increases the rewards for Validators and should theoretically incentivize enough to recoup the costs of the Node and reliabilities in the long term. Also this way Users are recommended to not use overcrowded Pools but to use those where their stake would not cross the 80% amount.
