Validator Node

πŸ› οΈ Hardware Requirements

Additional requirements

⏱️ Installation time: ~10-30 minutes

The installation time depends on many factors, such as your skills, resources and characteristics of your server, the most important: disk speed, internet connection, server load CPU, RAM, so this value may differ from the one indicated by us.

⚑ Automatic installation

bash <(curl -s https://raw.githubusercontent.com/UnityNodes/scripts/refs/heads/main/nillion-network/install-nillion-testnet.sh)

With the help of a one-line script, all the necessary commands will be executed automatically, you only need to check the operation of your node at the end

πŸ“ Manual installation

πŸ“ŒStep 1: Installation packeges and dependencies

# Install dependencies for building from source
sudo apt update
sudo apt install -y lz4 jq make git gcc build-essential curl chrony unzip gzip snapd tmux bc

# Install Go
sudo rm -rf /usr/local/go
curl -L https://go.dev/dl/go1.21.6.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile
source .bash_profile

πŸ“ŒStep 2: Set moniker and install node

Give your validator a name by which you can find yourself in explorer, put it in ""

MONIKER=""

After that, insert the following node installation command

# Clone project repository
cd $HOME
rm -rf nilliond
git clone https://github.com/NillionNetwork/nilliond
cd nilliond
git checkout v0.2.1
make build
sudo cp build/nilchaind $HOME/go/bin/

# Set node CLI configuration
nilchaind config set client chain-id nillion-chain-testnet-1
nilchaind config set client keyring-backend test
nilchaind config set client node tcp://localhost:26657
source $HOME/.bash_profile

# Initialize the node
nilchaind init "$MONIKER" --chain-id nillion-chain-testnet-1

# Download genesis and addrbook files
curl -Ls https://snapshots-testnet.unitynodes.com/nillion-testnet/genesis.json > $HOME/.nillionapp/config/genesis.json
curl -Ls https://snapshots-testnet.unitynodes.com/nillion-testnet/addrbook.json > $HOME/.nillionapp/config/addrbook.json

# Set minimum gas price
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0unil\"|" $HOME/.nillionapp/config/app.toml

# Set pruning
sed -i \
  -e 's|^pruning *=.*|pruning = "custom"|' \
  -e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
  -e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
  -e 's|^pruning-interval *=.*|pruning-interval = "10"|' \
  $HOME/.nillionapp/config/app.toml

# Download latest chain data snapshot
curl https://snapshots-testnet.unitynodes.com/titan-testnet/titan-testnet-latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.titan

# Create a service
sudo tee /etc/systemd/system/nilchaind.service > /dev/null << EOF
[Unit]
Description=Nillion Node
After=network-online.target

[Service]
User=$USER
ExecStart=/usr/local/bin/nilchaind start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.nillionapp"
Environment="DAEMON_NAME=nilchaind"
Environment="PATH=/usr/local/bin:/usr/bin:/bin"

[Install]
WantedBy=multi-user.target
EOF

# Start the service and check the logs
sudo systemctl daemon-reload
sudo systemctl enable nilchaind
sudo systemctl start nilchaind.service
sudo journalctl -u nilchaind.service -f -o cat

πŸ“ŒStep 3: Node Health Check

Follow the commands to check if your node is working properly

  1. Check version

nilchaind version
  1. View sync status

while true; do 
  local_height=$(nilchaind status | jq -r .sync_info.latest_block_height)
  network_height=$(curl -s https://rpc.nillion-testnet.unitynodes.com/status | jq -r '.result.sync_info.latest_block_height')
  blocks_left=$((network_height - local_height))

  echo -e "\033[1;33m[Sync Status]\033[0m \033[1;32mNode Height:\033[0m \033[1;37m$local_height\033[0m | \033[1;32mNetwork Height:\033[0m \033[1;37m$network_height\033[0m | \033[1;32mBlocks Left:\033[0m \033[1;31m$blocks_left\033[0m"

  sleep 5
done

Blocks left - 0-1 everything is fine and your node catches up with the last block of the network.

  1. Check logs

sudo journalctl -u nilchaind.service -f -o cat

If your node is installed and fully synchronized with the network, proceed with the creation of the validator.

For any questions you may have during installation, please contact our chat team or other project validators.

  1. [OPTIONAL] Change port

If you get an error that the default ports are busy, you can change them with the following command Example this error: ERR failure when running app err="failed to listen on 127.0.0.1:26657: listen tcp 127.0.0.1:26657: bind: address already in use"

#PORT 29
sed -i.bak -e "s%:1317%:1617%g; 
s%:8080%:8380%g;
s%:9090%:9390%g;
s%:9091%:9391%g;
s%:8545%:8845%g;
s%:8546%:8846%g;
s%:6065%:6365%g" $HOME/.nillionapp/config/app.toml	
sed -i.bak -e "s%:26658%:29658%g;
s%:26657%:29657%g;
s%:6060%:6360%g;
s%tcp://0.0.0.0:26656%tcp://0.0.0.0:29656%g;
s%:26660%:29660%g" $HOME/.nillionapp/config/config.toml
sed -i.bak -e "s%:26657%:29657%g" $HOME/.nillionapp/config/client.toml
sudo systemctl restart nilchaind && sudo journalctl -u nilchaind -f -o cat 

πŸ“ Create Validator

πŸ“ŒStep 1: Create wallet

nilchaind keys add wallet

Save all information after entering the command, without this you will not be able to restore data to the wallet. SAVE SEED PHRASE (12 words). ▢️ Example:

address: nillion1xj36hh6ct6c5k93u5aj2lflltf383rvjey6qws name: wallet pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Awfbx56PmdCf7ogWAAFOXoO/KJl+QCNXpYONq7rdIebC"}' type: local

Important write this mnemonic phrase in a safe place. It is the only way to recover your account if you ever forget your password.

bone lava bamboo orange twist tell struggle twenty sort filter hand fan room arena version runway champion problem palm flash vibrant toast tooth valley

πŸ“ŒStep 2: Request test tokens to your wallet address

Go to the Nillion Faucet and request test tokens to the address you created earlier.

After that, you can check your wallet balance with the following command.

nilchaind q bank balances $(nilchaind keys show wallet -a)

If the node has synchronized and the tokens have arrived in the wallet, create a validator with the command below.

πŸ“ŒStep 3: Create validator

Create a validator.json file

touch $HOME/.nillionapp/config/validator.json

To find out your pubkey, use the command (Save your Pubkey)

nilchaind comet show-validator

Output Example:

The output will be similar to this (with a different key):

{"@type":"/cosmos.crypto.ed25519.PubKey","key":"+vMHVm134I+Rh4kNqLG/YwvQqDy+YqcZqWtgp7ABUop0="}

Open a validator.json file

nano $HOME/.nillionapp/config/validator.json

Paste this into the open validator.json file, pre-replacing all values ​​that start with $ (you can do it in any convenient editor, not directly in nano mode)

{
  "pubkey": {
    "@type": "/cosmos.crypto.ed25519.PubKey",
    "key": ""
  },
  "amount": "1000000unil",
  "moniker": "",
  "identity": "", 
  "website": "", 
  "security": "", 
  "details": "", 
  "commission-rate": "0.05",
  "commission-max-rate": "0.2",
  "commission-max-change-rate": "0.2",
  "min-self-delegation": "1"
}

After entering and changing all values, save the file with the key combination Ctrl + X and press Enter

β—½ Replace the following values with your own: WALLET - usually it's 'wallet', or your wallet's name. MONIKER - any convenient name for your validator, displayed in the explorer. IDENTITY - validator's avatar, displayed in the explorer. Create a KeyBase ID following the instructions or leave it empty, and it will default to a standard one. DETAILS - details about your validator, also displayed in the explorer.

WEBSITE - your website/github/twitter, etc., if you don't want to specify anything - leave it blank

Replace all necessary values indicated above with the $ sign to successfully create your validator. β—½ Example:

{
  "pubkey": {
    "@type": "/cosmos.crypto.ed25519.PubKey",
    "key": ""
  },
  "amount": "1000000unil",
  "moniker": "Oliver",
  "identity": "", 
  "website": "https://mywebsite.com", 
  "security": "myemail@gmail.com", 
  "details": "Trusted Blockchain validator.", 
  "commission-rate": "0.05",
  "commission-max-rate": "0.2",
  "commission-max-change-rate": "0.2",
  "min-self-delegation": "1"
}

After creating the validator.json and entering all the necessary information, as well as provided that there are tokens in the wallet, run the create command:

nilchaind tx staking create-validator $HOME/validator.json --from wallet --chain-id nillion-chain-testnet-1 --fees 0unil

After entering the command, you will receive hash transactions, check the status in the explorer if the status is successful - you have created a validator. You can find your validator here: explorer In the Active / Inactive lists.

πŸ“ŒStep 4: Backup

If you have successfully created a validator, be sure to save your validator.

Show priv_validator_key.json

cat $HOME/.nillionapp/config/priv_validator_key.json

SAVE YOUR PRIVATE KEY AFTER ENTERING THE COMMAND The priv_validator_key.json is the key with which you can always restore the operation of your validator, so keep it and in case of reinstallation/transfer of the validator to another server - transfer it too.

Also remember, if you are a validator with a sufficient number of delegated tokens and you are in an active set, signing blocks, always save priv_validator_state.json - this file contains information about the signed blocks of your validators, and in case of restoring the validator after reinstallation or on another server , this file won't give you the old blocks again, otherwise you'll end up in jail with no way out πŸ’‘ Hint:

  • View private key: cat $HOME/.nillionapp/config/priv_validator_key.json

  • View private state: cat $HOME/.nillionapp/config/priv_validator_key.json

  • Private key directory: $HOME/.nillionapp/config/priv_validator_key.json

  • Validator state directory: $HOME/.nillionapp/data/priv_validator_state.json

All the useful commands to manage your node in the section - Useful commands

Last updated