CUDOS Validator Setup Guide

blockscapeLab
8 min readOct 18, 2021

The Cudos Network is a special-purpose blockchain designed to provide high-performance, trust-less, permission-less cloud computing for all.

You want to start validating for CUDOS? Then you’ve come to the right place! The following is a detailed step-by-step guide on how to set up your very own validator in CUDOS.

At this point, we’re going to deviate from the official documentation and go with CentOS.

0) Environment Setup

The environment setup is meant to be done on all host machines. Hardware requirements can be found here. Once you’ve spun up a host machine, please follow the steps below.

If you’ve just started with this tutorial, start with spinning up a validator machine.

First, we need to install a couple of tools.

# Install Docker, Git and jQuery via the yum package manager.
$ sudo yum install docker git jq -y
# Start the Docker daemon.
$ sudo service docker start
# Install docker-compose by downloading the binary from the GitHub download archive.
$ curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# Make docker-compose executable for the current user.
$ chmod +x /usr/local/bin/docker-compose

Now, let’s create a workspace in the $HOME directory and cd into it.

$ mkdir ~/cudos
$ cd ~/cudos

Next, we need to clone CudosNode, CudosBuilders and CudosGravityBridge.

$ git clone --depth 1 --branch v0.2 https://github.com/CudoVentures/cudos-node.git CudosNode
$ git clone --depth 1 --branch v0.3 https://github.com/CudoVentures/cudos-builders.git CudosBuilders
$ git clone --depth 1 --branch v0.2 https://github.com/CudoVentures/cosmos-gravity-bridge.git CudosGravityBridge

Build the docker image for CudosBuilders.

$ cd ~/cudos/docker/binary-builder
$ sudo docker-compose --env-file binary-builder.arg -f binary-builder.yml -p cudos-binary-builder up --build --detach

1) Validator Setup

Alright, it’s time to get down to the nitty-gritty. The validator setup entails setting up three components:

  • The CUDOS validator, which participates in on-chain consensus by voting on and proposing blocks, and which is used by the orchestrator to make its call against the CUDOS chain
  • The Gravity Bridge Orchestrator, which manages the token flow between CUDOS and Ethereum
  • An Ethereum full node, which is used by the orchestrator to make its calls against Ethereum

1.1) Ethereum Full Node Setup

First, spin up a new host machine (see “Ethereum node” hardware requirements).

Alternatively, you can also use your own Ethereum full node, in which case you can skip to 1.2). Just make sure not to use Infura.

Reminder: Complete the “0) Environment Setup” before you continue with the steps below.

Running an Ethereum node is pretty straightforward.

$ cd ~/cudos/CudosBuilders/docker/ethereum
$ sudo docker-compose -f ethereum-full.yml -p ethereum up --build --detach

Note, that syncing the Rinkeby blockchain might take hours/days. You can view the logs by running the following command.

$ sudo docker logs -f ethereum

1.2) CUDOS Validator Node Setup

First, spin up a new host machine (see “Validator node” hardware requirements). We’re going to initialize a CUDOS full node on it, which we’ll later configure to become a validator.

Reminder: Complete the “0) Environment Setup” before you continue with the steps below.

# Navigate to the full-node directory of CudosBuilders.
$ cd ~/cudos/CudosBuilders/docker/full-node
# Make a copy of the example full-node env file and open it with a text editor of your choice.
$ cp full-node.env.example full-node.client.testnet.public01.env
$ nano full-node.client.testnet.public01.env
# Add the following contents to the file. Once you're done, save the changes and close the file.
MONIKER=<Insert your validator moniker here>
SHOULD_USER_GLOBAL_PEERS=false
# Initialize the full node.
$ sudo docker-compose --env-file full-node.client.testnet.public01.arg -f init-full-node.yml -p cudos-init-full-node-client-testnet-public-01 up --build

If everything went well, there should be a ~/cudos/CudosData directory.

$ ls ~/cudos
CudosBuilders CudosData CudosGravityBridge CudosNode
/\
||
This directory should be there.

Let’s also make sure all files were generated properly.

$ ls ~/cudos/CudosData/cudos-data-full-node-client-testnet-public-01
config data tendermint.nodeid

Copy and paste the node ID into a text file on your local computer. You’ll be needing it shortly.

$ cat ~/cudos/CudosData/cudos-data-full-node-client-testnet-public-01/tendermint.nodeid

Looking good so far. Now, in order to get peers, it is best practice to spin up a sentry node on another host machine.

  • Repeat the “0) Environment Setup” step on the sentry node.
  • Follow the official Sentry Setup Guide.
    For step 6, you’ll need the validator’s node ID from the text file mentioned above, and the validator’s public IP address. Make sure port 26656 is open for in- and outbound connections. For now, you don’t have to enter any other peer addresses other than you validator’s.
  • Get the sentry’s node ID, copy and paste it into a text file on your local computer. You’ll be needing it shortly.
$ cat ~/cudos/CudosData/cudos-data-sentry-node-client-testnet-public-01/tendermint.nodeid
  • Ideally, you’ll want to set up at least two sentry nodes for effective DDoS protection. Just repeat the three steps above on another host machine.

Optional: Set up a seed node. We’ll skip this step in this guide, though.

Now that we have set up our sentries, we need to add them as peers to our validator node.

$ cd ~/cudos/CudosBuilders/docker/full-node
$ nano full-node.client.testnet.public01.env
# Add the following contents to the file. Once you're done, save the changes and close the file.
PERSISTENT_PEERS=<sentry1-node-id>@<sentry1-public.ip>:26656,<sentry2-node-id>@<sentry2-public.ip>:26656

Alright, it’s time to start the full node.

# Set the configuration.
$ sudo docker-compose --env-file full-node.client.testnet.public01.arg -f config-full-node.yml -p cudos-config-full-node-client-testnet-public-01 up --build
# Start the full node.
sudo docker-compose --env-file full-node.client.testnet.public01.arg -f start-full-node.yml -p cudos-start-full-node-client-testnet-public-01 up --build --detach
# Logs can be viewed by running the following command.
$ sudo docker logs -f cudos-start-full-node-client-testnet-public-01

At this point, since we’ve only started the full node a few moments ago, it’s still going to be syncing the blockchain. Depending on your hardware and the size of the blockchain, this might take hours/days. You can check the sync status using the following commands.

# Wait for the output of this command to be 'false'.
$ sudo docker exec -ti cudos-start-full-node-client-testnet-public-01 cudos-noded status | jq '.SyncInfo.catching_up'
# Check the progress by comparing the block height from the output of this command with the latest block height from the official block explorer.
$ sudo docker exec -ti cudos-start-full-node-client-testnet-public-01 cudos-noded status | jq '.SyncInfo.latest_block_height'

In the meantime, we can create an account, which is needed to interact with the blockchain. We’re going to create one using the web extension Keplr. Please follow this guide.

Don’t forget to back up the mnemonic phrase and store it in a safe place!

Once the node has caught up, we can import our validator account that we’ve just created in Keplr. For that, we’ll need to access the validator’s container shell.

$ sudo docker exec -it cudos-start-full-node-client-testnet-public-01 bash

Then, please execute the following command, which will ask you the enter the mnemonic phrase.

$ cudos-noded keys add validator --recover --keyring-backend file

To check if the key was successfully added, use the following command, which should list a “validator” key.

$ cudos-noded keys list --keyring-backend file

Before we can create our validator on-chain, it needs some tokens that it can self-stake, so it can actually become a validator and partake in consensus.

Once you have some tokens, we can now create the validator on-chain using the following command.

$ cudos-noded tx staking create-validator \
--amount <STAKE> \
--from validator \
--pubkey $(cudos-noded tendermint show-validator) \
--moniker <YOUR_MONIKER> \
--chain-id <CHAIN_ID> \
--commission-rate <COM_RATE> \
--commission-max-rate <COM_MAX_RATE> \
--commission-max-change-rate <COM_MAX_CHANGE_RATE> \
--min-self-delegation 1 \
--gas auto \
--gas-prices 0.025acudos \
--gas-adjustment 1.80 \
--keyring-backend file \
-y
  • <STAKE> must be at least 1000000000000000000acudos (=1 CUDOS)
  • <YOUR_MONIKER> must be the same moniker you provided in ~/cudos/CudosBuilders/docker/full-node/full-node.client.testnet.public01.env
  • <CHAIN_ID> should be cudos-testnet-public for testnet (TBD for mainnet)
  • <COM_RATE> is the percentage of commission you want to take from all rewards, i.e. 0.10 means that you’ll take 10% of all rewards generated
  • <COM_MAX_RATE> is the maximum commission rate you’re committing to, i.e. 0.40 means that you’ll never take more than 40% of all rewards generated
  • <COM_MAX_CHANGE_RATE> is the maximum rate in percent, that you can change your commission rate per day, i.e. 0.20 means that per day, you can either increase or decrease your commission by 20% tops

Execute the command and wait for it to be processed. If you see a transaction hash without getting an error, then you’ve successfully created a validator account! You can copy the transaction hash and take a look at it in the block explorer.

Also, you should be able to find your validator in the list printed out by the following command (search for your moniker).

$ cudos-noded q staking validators

Please, do not exit the container shell session, as we’ll continue working on the validator in the next step.

1.3) Orchestrator Setup

For the orchestrator, we need another account on the validator machine. Create one in Keplr, back up the mnemonic phrase and store it in a safe place. Then, use the following command to import the orchestrator account, which will ask you to enter the mnemonic phrase of the orchestrator account.

$ cudos-noded keys add orchestrator --recover --keyring-backend file

To check if the key was successfully added, use the following command, which should list a “validator” key and the newly added “orchestrator” key.

$ cudos-noded keys list --keyring-backend file

For the next steps, you’ll be needing an Ethereum account. Please follow this guide on how to install and set up Metamask, and create an account. Once you have an Ethereum address, we can register the orchestrator.

$ cudos-noded tx gravity set-orchestrator-address <VALIDATOR_ADDRESS> <ORCH_ADDRESS> <ETH_ADDRESS>
  • <VALIDATOR_ADDRESS> is the validator’s operator address (cudosvaloper…). It can be retrieved with the following command.
$ cudos-noded keys show validator --bech val --keyring-backend file
  • <ORCH_ADDRESS> is the orchestrators address (cudos…). It can be retrieved with the following command.
$ cudos-noded keys show orchestrator --keyring-backend file
  • <ETH_ADDRESS> is the Ethereum address you created in Metamask (0x…).

Once you’ve registered the orchestrator, we need to configure it.

$ cd ~/cudos/CudosBuilders/docker/orchestrator
$ cp orchestrator.env.example orchestrator.client.testnet.public01.env
$ nano orchestrator.client.testnet.public01.env
# Add the following contents to the file. Once you're done, save the changes and close the file.
ADDRESS_PREFIX="cudos"
FEES="<FEES>"
GRPC="http://<CUDOS_NODE_IP>:9090"
ETHRPC="http://<ETH_NODE_IP>:8545"
CONTRACT_ADDR="0xb22F2A4c231e69703FC524Eb2E3eb7B83C316F42"
COSMOS_ORCH_MNEMONIC="<ORCH_MNEMONIC>"
ETH_PRIV_KEY_HEX="<HEX_PRIV_KEY>"
  • <FEES> are the fees that you will have to pay for each bridge transaction, e.g 100acudos.
  • <CUDOS_NODE_IP> is the public IP address of the CUDOS validator node.
  • <ETH_NODE_IP> is the public IP address of the Ethereum full node.
  • <ORCH_MNEMONIC> is the mnemonic phrase of your orchestrator account.
  • <ETH_PRIV_KEY_HEX> is the hexadecimal representation if the Ethereum account’s private key, without the leading “0x”. Please follow this guide in order to export the private key from Metamask.

Finally, run the orchestrator.

$ sudo docker-compose --env-file orchestrator.client.testnet.public01.arg -f orchestrator.release.yml -p cudos-orchestrator-client-testnet-public-01-release up --build --detach

You can view the logs with the following command.

$ sudo docker logs -f cudos-orchestrator-client-testnet-public-01-release

And that pretty much wraps it up! You’re now running a validator node on the CUDOS blockchain and an orchestrator for bridging token transfers between Cosmos and Ethereum!

We hope you found this guide helpful and leave us with a clap!

Until next time!

--

--