# Setup

[Validators ](https://docs.realio.network/validators/broken-reference)are responsible for committing new blocks to the blockchain through voting. A validator's stake is slashed if they become unavailable or sign blocks at the same height. Please read about [Sentry Node Architecture](https://docs.realio.network/validator-faqs#how-can-validators-protect-themselves-from-denial-of-service-attacks) to protect your node from DDOS attacks and to ensure high-availability.

{% hint style="danger" %}
**WARNING**\
If you want to become a validator for the `mainnet`, you should [research security](https://docs.realio.network/validators/broken-reference).
{% endhint %}

### 1. Run a full node[​](https://docs.realio.network/validators/setup#1-run-a-full-node) <a href="#id-1-run-a-full-node" id="id-1-run-a-full-node"></a>

To become a validator, you must first have `realio-networkd` installed and be able to run a full node. You can first [setup your full node](https://docs.realio.network/running-a-full-node/requirements) if you haven't yet.

The rest of the documentation will assume you have followed our instructions and have successfully set up a full node.

{% hint style="success" %}
**TIP**\
Running a validator node should be done on a separate machine, not your local computer. This is due to the fact that validators need to be constantly running to avoid getting slashed (and thus loosing funds). We highly recommend setting up a local machine that can run 24/7, even a Raspberry can do the job.
{% endhint %}

### 2. Create your validator[​](https://docs.realio.network/validators/setup#2-create-your-validator) <a href="#id-2-create-your-validator" id="id-2-create-your-validator"></a>

In order to create a validator, you need to create a local wallet first. This will be used in order to hold the tokens that you will later delegate to your validator node, allowing him to properly work. In order to create this wallet, please run:

```bash
realio-networkd keys add <key_name>
```

**or** use the `--recover` flag if you already have a secret recovery phrase (mnemonic phase) you'd want to use:

```bash
realio-networkd keys add <key_name> --recover
```

{% hint style="warning" %}
**KEY NAME**\
Please select a key name that you will easily remember and be able to type fast. This name will be used all over the places inside other commands later.
{% endhint %}

Once that you have created your local wallet, it's time to get some tokens to be used as the initial validator stake so that it can run properly. If you are setting up a validator inside one of our testnets, you can request some testnet tokens inside our [Discord](https://discord.gg/Nv9EUbRnKb). Once you have joined, go inside the `#testnet-tokens` channel and ask us for tokens. Be sure to post your node information (RPC address and Operator account address).

To run a validator node you need to first get your current validator public key that was created when you ran `realio-networkd init`. Your `realiovalconspub` (Realio Network Validator Consensus Pubkey) can be used to create a new validator by staking tokens. You can find your validator pubkey by running:

```
realio-networkd tendermint show-validator
```

To create your validator, just use the following command:

{% hint style="danger" %}
**DON'T USE MORE STAKING TOKEN THAN YOU HAVE!**\
On the testnet, we are using `ario` as the staking token and it will be the example below.
{% endhint %}

**Testnet:**[**​**](https://docs.realio.network/validators/setup#testnet)

```bash
realio-networkd tx staking create-validator \
  --amount=1000000000000000000ario \
  --pubkey=$(realio-networkd tendermint show-validator) \
  --moniker="<Your moniker here>" \
  --chain-id=<chain_id> \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1" \
  --gas="auto" \
  --gas-adjustment=1.2 \
  --gas-prices="0.025ario" \
  --from=<key_name>
```

{% hint style="success" %}
**TIP**\
When specifying the value of the `moniker` flag, please keep in mind this is going to be the public name associated to your validator. For this reason, it should represent your company name or something else that can easily identify you among all the other validators.
{% endhint %}

{% hint style="success" %}
**TIP**\
When specifying commission parameters, the `commission-max-change-rate` is used to measure % *point* change over the `commission-rate`. E.g. 1% to 2% is a 100% rate increase, but only 1 percentage point.
{% endhint %}

{% hint style="success" %}
**TIP**\
[`Min-self-delegation`](#user-content-fn-1)[^1] is a strictly positive integer that represents the minimum amount of self-delegated staking token your validator must always have. A `min-self-delegation` of 1 means your validator will never have a self-delegation lower than `1ario`. A validator with a self delegation lower than this number will automatically be unbonded.
{% endhint %}

You can confirm that you are in the validator set by using a block explorer:

* Testnet: [Big Dipper](https://testnet-explorer.realio.network/)

### 3. Edit the validator description[​](https://docs.realio.network/validators/setup#3-edit-the-validator-description) <a href="#id-3-edit-the-validator-description" id="id-3-edit-the-validator-description"></a>

You can edit your validator's public description. This info is to identify your validator, and will be relied on by delegators to decide which validators to stake to. Make sure to provide input for every flag below. If a flag is not included in the command the field will default to empty (`--moniker` defaults to the machine name) if the field has never been set or remain the same if it has been set in the past.

The \<key\_name> specifies which validator you are editing. If you choose to not include certain flags, remember that the --from flag must be included to identify the validator to update.

The `--identity` can be used as to verify identity with systems like Keybase or UPort. When using with Keybase `--identity` should be populated with a 16-digit string that is generated with a [keybase.io](https://keybase.io/) account. It's a cryptographically secure method of verifying your identity across multiple online networks. The Keybase API allows some block explorers to retrieve your Keybase avatar. This is how you can add a logo to your validator profile.

```bash
realio-networkd tx staking edit-validator \
  --moniker="choose a moniker" \
  --website="https://realio.network" \
  --identity=6A0D65E29A4CBC8E \
  --details="To infinity and beyond!" \
  --commission-rate="0.10" \
  --chain-id=<chain_id> \
  --from=<key_name>
```

**Note**: The `commission-rate` value must adhere to the following invariants:

* Must be between 0 and the validator's `commission-max-rate`
* Must not exceed the validator's `commission-max-change-rate` which is maximum % point change rate **per day**. In other words, a validator can only change its commission once per day and within `commission-max-change-rate` bounds.

#### View the validator description[​](https://docs.realio.network/validators/setup#view-the-validator-description) <a href="#view-the-validator-description" id="view-the-validator-description"></a>

View the validator's information with this command:

```bash
realio-networkd query staking validator <account_realio>
```

### 4. Confirm your validator is running[​](https://docs.realio.network/validators/setup#4-confirm-your-validator-is-running) <a href="#id-4-confirm-your-validator-is-running" id="id-4-confirm-your-validator-is-running"></a>

Your validator is active if the following command returns anything:

```bash
realio-networkd query tendermint-validator-set | grep $(realio-networkd status 2>&1 | jq '.ValidatorInfo.PubKey.value')
```

When you query the node status with `realio-networkd status`, it includes the validator pubkey in base64 encoding. If your node is an active validator, the validator pubkey will be shown when you query the validator set.

You should now see your validator in one of the Realio Network explorers. You are looking for the `bech32` encoded `operator address` starts with `realiovaloper`. It is another representation of your `<key_name>` that you have used to create this validator.

To show the `operator address`, you can run:

```bash
realio-networkd keys show <key_name> -a --bech val
```

{% hint style="info" %}
**NOTE**\
To be in the validator set, you need to have more total voting power than the last validator.
{% endhint %}

[^1]:
