The process of building a node/validator for Humans.ai

stake2earn
5 min readApr 24, 2023

--

Many think that being a validator needs impossible technical skills, others think that it’s just very easy if you are a programmer for example, and many other have no clue what this means.

As we just started the Testnet for Humans.ai, a project that has as main goal Artificial intelligence used to improve and make easier our life, work, to gain new skills and time, we want to also make clearer what a validator is and how to create one for Humans.io.

The below article is going to be full of technical stuff, but it’s main aim is to translate what needs to be done and make it easier to understand even to a newbie.

I) What does a Validator mean?

A validator is a special kind of node that participates in the consensus, and becomes responsible for verifying, voting and maintaining a record of transactions.
Validators store a copy of the blockchain of the network and must perform certain functions in order to keep the system secure. Depending on the network, there might be a limited number of Validator nodes or unlimited. For example, for Humans.ai there there were only 50 validators chosen for Testnet, and other 25 are in pending list.

The most essential part of POS system (Proof of Stake) is represented by validators. They are acting like moderators of the staking system and they have the important job of adding new blocks on the chain.
In order to have the most decentralized system as possible, it is important to elect a good number of validators. This helps the community by offering a greater variety of staking options as well as protecting the system by preventing having the blockchain controlled by one very wealthy validator.

II) What do you need to run a Validator?

  1. Prerequisites or System requirements

For the technical projects these needs are called prerequisites. Similar with any other service, prerequisites are very important!

a) Strong internet connection

b) You will need to make sure that you get a server with at least 32GB of memory (RAM)

c) Solid-state drive with at least 500GB of SSD disk storage

d) At least 1000mbps network bandwidth

e) Open several ports to connect to the Humans peer-to-peer network

  • In order to export tendermint metrics, Prometheus listen address: 26660
  • Prometheus exporter: 9464
  • To connect to the Humans peer-to-peer network: 26656
  • Export Cosmos SDK metrics: 1317

Note that as the usage of the blockchain grows, the server requirements may increase as well, so you should have a plan for updating your server as well.

III) How to build your Humans node/validator

All projects share tutorials and very useful information on their Github. So, make sure you make Github your bestfriend :)

From this point on, we recommend you to follow the official tutorial that you can find here: https://github.com/humansdotai/testnets

In addition to the above steps, you will need to perform as well, our service setup as follows:

  1. Make sure your machine runs on Ubuntu 20.04
  2. Start by updating the packages list:
sudo apt update

3. Install the build-essential package by typing:

sudo apt upgrade -y

4. This command installs a bunch of new packages including gcc, g++ and make.

sudo apt-get install manpages-dev

5. Install the necessary packages to run Go

sudo apt install build-essential -y

6. Check the gcc version

gcc --version

7. First remove any existing old Go installation

sudo rm -rf /usr/local/go
sudo rm -rf /root/go

8. Install the compatible and correct Go version

curl https://dl.google.com/go/go1.20.1.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -

9. Update environment variables to include Go

cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source $HOME/.profile

10. Check the GO version

go version

In response, we should get something like this:

go1.20.1 linux / amd64

11. Install git utility ( in case is not installed already)

apt install git

12. Install humansd the latest version and make sure to checkout the correct tag

git clone https://github.com/humansdotai/humans
cd humans && git checkout tags/v0.1.0
make install

13. Verify the installed version with

humansd version --long

14. Set your validator name

humansd init stake2earn --chain-id=humans_3000-1

15. Create a local key or recover an existent one

humansd keys add wallet_test
humansd keys add --recover wallet_test

Don't forget to save your mnemonic seed!

16. Check all the keys your have with

humansd keys list

IV) How to start and manage your Humans node/validator

Systemd
In order to track your logs and errors, you can create the following files and service file. This is mandatory only if you want to sync the node automatically and restart the Humans Cosmos daemon whenever is needed in cause of failure:

1. Create the files to track errors:

sudo mkdir -p /var/log/humans && sudo touch /var/log/humans/humans.log && sudo touch /var/log/humans/humans_error.log

2. And copy the below script in your system service

sudo tee /etc/systemd/system/humans.service > /dev/null <<'EOF'
[Unit]
Description=humans sync node service
After=network-online.target
[Service]
User=root
TimeoutStartSec=0
CPUWeight=90
IOWeight=90
Environment=OTEL_EXPORTER_PROMETHEUS_PORT=9464
ExecStart=/root/go/bin/humansd start - log_level=warn
StandardOutput=file:/var/log/humans/humans.log
StandardError=file:/var/log/humans/humans_error.log
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF

3. Check your system service

cat /etc/systemd/system/humans.service

4. Control & track your logs via next commands:

systemctl daemon-reload
sudo systemctl enable humans
sudo systemctl start humans
sudo systemctl stop humans
sudo systemctl restart humans
systemctl -l status humans
sudo journalctl -u humans-f
tail -f /var/log/humans/humans.log
tail -f /var/log/humans/humans_error.log

5. Check the status of your node/validator

humansd status 2>&1 | jq .SyncInfo

Pay attention to “catching_up”
If “true” means NOT synced yet.
If “false” means synchronized.

6. Create Validator

After the catching_up is false, you need to create your validator:

humansd tx staking create-validator \
--amount=9850000uheart \
--pubkey=$(humansd tendermint show-validator) \
--moniker=stake2earn 🌜 \
--website="https://stake2earn.com" \
--details="Blockhain validator in POS networks - Decentralized and noncustodial crypto staking services 🌜" \
--identity=D153AB5E9F506C47 \
--chain-id=humans_3000-1 \
--commission-rate="0.05" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.1" \
--min-self-delegation="1" \
--gas-prices 0.025uheart \
--from=wallet_test

If you have any questions do not hesitate to contact the stake2earn team via e-mail: contact@stake2earn.com

We are also very social, and you can find us on:
Twitter: https://twitter.com/stake2earn
Telegram: https://t.me/stake2earn
Facebook: https://www.facebook.com/stake2earn
Instagram: https://www.instagram.com/stake2earn
LinkedIn: https://www.linkedin.com/company/stake2earn
Website: https://stake2earn.com

--

--