Harmony Node Installation Guide

Harmony ValidatorDAO
11 min readDec 18, 2021

--

First thing is to update

Let it update

Next is to create a super user called harmony.

It will ask you to enter a password. The way Linux works is you won’t see *** or something when typing a password. You just see blanks.

🚨🚨WRITE DOWN THE PASSWORD ON PAPER🚨🚨

It will then ask a bunch of information questions. You can just leave them blank. The information questions are not important. Hit y at the end of it.

The above just created a normal user. You need to give permissions to the harmony user to be a super user.

The command above adds the harmony user to the super group, sudo.

If you do the command correctly, you will get a blank line return.

Next log into the harmony user.

As you can see, the name changed from root@ to harmony@. This is how you know you’re logged into the harmony user. To go back to roottype: sudo su

The above commands was for going back and forth between the harmony user and root. The Harmony Documentation is written as being installed under the harmony user. So make sure you’re logged into the harmony user when following the subsequent steps. Otherwise if you install under root you will have problems.

Advanced users: You can install under a different username but the installation will need to be changed in view of such.

While logged in to the harmony user, type:

This command download the hmycli program via the curl command. The mv command renames the hmycli to hmy. The chmod +x makes the hmy program executable.

The above screen shot shows what the output looks like after running the command.

Next type:

./hmy --node="https://api.s0.t.hmny.io" cookbook

If the hmy program was installed correctly, the above command will return a big long menu of commands that the hmy program can do. It is a good idea at some point to familiarize yourself with the command set. If you’d like to see it outside of the PuTTY window, you can review the fully command set here.

Next is BLS key creation. This is the key that is used to sign. Two file types are needed for a BLS key: *.key file and *.pass file. It is important to know that a *.pass file can be recreated but a *.key file cannot be. It is important to safe the *.key file in another place besides your server. But first things, you need to create the key with the following command.

./hmy keys generate-bls-keys --count 1 --shard 1 --passphrase

The above command will generate 1 key. This is due to the --count parameter. Change 1 to another number if you want to create more. You don’t need to create more than one key at this time. You can create more keys with this command at any time. Further the parameter --shard 1 determines what shard your key is for. There are shards 0–3. It is advisable for new validators not to start on shard 0. If you want to be on shard 2, for example, change shard 1 to shard 2 to create a BLS key on shard 2. The passphrase parameter is a passphrase that is used to decrypt the BLS key.

🚨🚨WRITE DOWN THE PASSPHRASE ON PAPER🚨🚨

In the above screenshot, you can see the BLS key starts with 4afa…

Next to verify the key, type:

./hmy --node="https://api.s0.t.hmny.io" utility shard-for-bls [BLS PUBLIC KEY]

Replace [BLS PUBLIC KEY] with the numbers of your key. If you’re using PuTTY terminal window, just start to type the first few numbers of your key, then hit TAB key on your keyboard. It will auto complete the whole number. However, it will include the file extension .key. In order for the above command to be successful delete the .key at the end.

You can see in the screenshot above, that the return for your key is shard 1 , which is correct as the commands run in this guide made a BLS key for shard 1.

mkdir -p .hmy/blskeys

The above command makes a directory for the blskeys. It is important for if you make more or other BLS keys that those keys go into this directory. The hmy program will look for the BLS keys in this directory. If the key is not in this directory the hmy program will not use the key to sign.

cp *.key .hmy/blskeys

The above command will copy all the *.key files into the .hmy/blskeys directory. Do not delete the copy of the *.key file that remains in the home directory. You will need it there in order get a copy of it off your server.

Next is the *.pass file creation. The pass file is very simple. It hold the passphrase to decrypt the BLS key. If you don’t have the pass file, the hmy program cannot use your key.

echo '[passphrase]' > .hmy/blskeys/[BLS_PUBLIC_KEY].pass

The above command will need the passphrase you entered earlier when creating the BLS key. Replace passphrase with the BLS passphrase and realize it will be in plain text and you can see it while typing it. Replace [BLS PUBLIC KEY] with the numbers of your key. You can use the auto complete trick again here from earlier. Remember to remove the .key file extension at the end of it. The file will need to end in .pass instead.

Next verify that you have the files in the correct directory by typing:

ls .hmy/blskeys/

The output should have two files with the same name but one ending in .key and the other ending in .pass.

Next is to download the harmony databases.

sudo curl https://rclone.org/install.sh | sudo bash

The above command will download the rclone program.

If you have issues with this step, try removing sudo and run the command again.

The following command will setup the rclone.conf. It will return a statement saying the file doesn’t exist. This is normal but it can be confusing.

rclone config file

Copy/paste the following and hit ENTER.

Regardless of what shard you plan to be on, you need the shard 0 database.

Digital Ocean users please go to Symlinking a mounted drive before proceeding.

Next is to rclone shard 0. This can take hours to download and it depends on your connection and hardware.

NOTE: If you plan on running an RPC, do not use the command below to rclone shard 0. If you don’t know what an RPC is don’t worry, just use the command below.

rclone -P -L --checksum sync release:pub.harmony.one/mainnet.snap/harmony_db_0 harmony_db_0 --multi-thread-streams 4 --transfers=32

Next is to rclone the database of the shard you will be on. This will be much faster.

rclone -P -L sync release:pub.harmony.one/mainnet.min/harmony_db_1 harmony_db_1 --multi-thread-streams 8 --transfers=16

Replace the bolded 1 with the desired shard number. If you want another shard besides 1. For example, shard 2 would be harmon_db_2 .

Next is to create your validator on the blockchain. First step is to create a validator wallet.

./hmy keys add mylocalaccountname --passphrase

Replace mylocalaccountname with the desired name of the wallet and write down the your passphrase.

Don’t use this wallet or interact with it in anyway. It is junk and comprised.

🚨🚨WRITE DOWN THE PASSWORD AND SEED ON PAPER🚨🚨

You can check the wallet was added to your Droplet with the following command:

./hmy keys list

After making the validator wallet, send 10,001 $ONE to it. Make sure you have the $ONE sent to your wallet on shard 0. Not the shard of your BLS key.

Check the balance to make sure the funds are there. Use the following command to check your balance :

./hmy --node="https://api.s0.t.hmny.io" balances [ONE ADDRESS]

Next is to use the validator wallet to make the validator on the blockchain with the following command. See the description below this command on what all the parameters mean.

Name, identity, details, security-contact and website need to be put in double quotes if there are more than one word separated by space (example — name “John the validator”).

--validator-addr is your validator ONE address (string)

--amount is the initial amount of ONE you want to stake (float). The initial amount has to be greater than 10,000 $ONE.

--bls-pubkeys is your BLS key number you made earlier (string). If you want to add multiple keys separate the keys with a comma. Do not include file extensions like .key or .pass. Just the BLS key number.

--name is the name displayed on the Staking Explorer (string)

--identity is a unique identifier for the validator (string). This can be changed later and you will want to change it later because you will need to follow the keybase steps in order to have a logo show. For now just due random letters.

--details is the description of your validator displayed on the Staking Explorer (string)

--security-contact is your email contact for the validator (string)

--website is the website displayed on the Staking Explorer (string)

--max-change-rate is the maximum rate change the validator can do every epoch (float). For example, 0.01 would be a 1% change per epoch. NOTE: CANNOT BE CHANGED

--max-rate is the maximum commission rate that the validator can set (float). For example, 0.1 would be a max commission of 10%. The commission cannot be set higher than 10%. NOTE: CANNOT BE CHANGED

--rate is the commission rate of the validator (float). For example, 0.1 would be a max commission of 10%. The commission cannot be set higher than 10%.

--max-total-delegation is the maximum amount of ONE that can be delegated to this validator (float)

--min-self-delegation is the minimum amount of ONE the validator must stake to itself (float). This has to be at least 10,000 ONE.

Note: --rate, --max-rate, and --max-change-rate accepts numbers between 0 and 1 representing percentages

Copy the entire command. Extra white spaces in the command could cause errors.

The CLI will prompt you to enter two passphrases. First is your BLS key file passphrase and second is the wallet passphrase.

Next is to install the binary by the following command.

The above command downloads the binary via the curl command, rename the binary to harmony with mv and finally make the harmony program executable with chmod +x .

Next is to verify the download

./harmony -V

Next is to create the dump file

./harmony config dump harmony.conf

Next is to start the harmony program with options provided by the config file:

./harmony -c harmony.conf

Press CRTL+C to escape the harmony program. Next you have to create a daemon that will keep the harmony program running even when the SSH window closes.

Type:

sudo nano /etc/systemd/system/harmony.service

Enter your password for the harmony user. This will open an editor.

To put into the editor, copy the following:

Paste by right clicking into the editor window

Press CTRL + X to exit and press y to save.

Type the following lines.

sudo chmod 755 /etc/systemd/system/harmony.service
sudo systemctl enable harmony.service
sudo service harmony start

The daemon will keep the harmony program running.

Type:

sudo service harmony status

If everything works alright, you will see green writing. If the writing is red, something went wrong. It will give you a general statement as to the problem. You can use that to figure out where the error is.

Next is to check to if the databases are syncing.

Here you will use Patrick’s code from Easy Node.

⚠️Not all server provider come with python 3 installed.

If you don’t have python3, type:

sudo apt-get update
sudo apt-get install python3.8 python3-pip

Other wise, type:

wget https://raw.githubusercontent.com/easy-node-one/harmony-validator-scripts/main/stats/stats.py

Next open the file after the download completes.

sudo nano stats.py

After opening the file editor, find the lines and edit them to the shard you are validating on. Also change the harmonyFolder to '/home/harmony

Once the shard database (shown on top in the screenshot below) matches the harmony network (shown on the bottom in the screenshot below). The Droplet will start signing. In the example below for shard 2, the Shard 2 database viewID doesn’t match the harmony viewID. This Droplet is not signing yet. Note that shard 0 doesn’t need to fully sync in order to sign unless of course you’re on shard 0.

Once you’re synced as the screenshot below shows a fully synced validator. You can check for BINGOs. Note: Checking for BINGOs only works on an elected validator. Unelected won’t return BINGOS.

Type:

tail -f latest/zerolog-harmony.log | grep BINGO

If you get nothing, your Droplet is not signing.

If you get the output result below, you’re all set.

Any comments or questions, leave them below.

Credits to the following that we relied on heavily for information:

--

--