Setting up a Klever validator on testnet

pathrock
4 min readFeb 27, 2022

The objective of this task is for interested community members to setup up their Klever Testnet node.

System requirements:

To run a node on KleverChain, you need the following minimum setup:

  • A CPU with 4 cores.
  • A RAM with 8GB.
  • An SSD with 200 GB
  • An internet connection speed of at least 100 Mbps.
  • Linux or MacOS.

I setup my Klever Validator on Ubuntu 20.04 focal fossa on a 6core 16GB VPS

Once you are ready to start make sure you have docker installed on your operating system

You can follow this guide here:

Installing and running a node

First we need to pull the latest klever release using the following command

docker pull kleverapp/klever-go-testnet:latest

Create a wallet

mkdir wallet

then

docker run -it --rm --user "$(id -u):$(id -g)" \
-v $(pwd)/wallet:/opt/klever-blockchain \
--entrypoint=/usr/local/bin/operator kleverapp/klever-go-testnet:latest "create-wallet"

check your wallet and address

docker run -it --rm --user "$(id -u):$(id -g)" \
-v $(pwd)/wallet:/opt/klever-blockchain \
--entrypoint=/usr/local/bin/operator kleverapp/klever-go-testnet:latest "getAddress"

Create statics directory

mkdir -p $(pwd)/node/config $(pwd)/node/db $(pwd)/node/logs

Download network genesis config

curl -k https://backup.testnet.klever.finance/config.testnet.100005.tar.gz \
| tar -xz -C ./node

Create your validator KeyPair

docker run -it --rm -v $(pwd)/node/config:/opt/klever-blockchain \
--user "$(id -u):$(id -g)" \
--entrypoint='' kleverapp/klever-go-testnet:latest keygenerator

Download and extract data backup for fast spin

curl -k https://backup.testnet.klever.finance/kleverchain.latest.tar.gz \
| tar -xz -C ./node

Start your validator node in tmux

sudo apt install tmuxtmux new -s klever

then

docker run -it --rm \
--user "$(id -u):$(id -g)" \
--name klever-node \
-v $(pwd)/node/config:/opt/klever-blockchain/config/node \
-v $(pwd)/node/db:/opt/klever-blockchain/db \
-v $(pwd)/node/logs:/opt/klever-blockchain/logs \
--network=host \
--entrypoint=/usr/local/bin/validator \
kleverapp/klever-go-testnet:latest \
'--log-save' '--rest-api-interface=0.0.0.0:8080'

If you want to run your validator node in the background use the following command

docker run -it -d \
--user "$(id -u):$(id -g)" \
--name klever-node \
-v $(pwd)/node/config:/opt/klever-blockchain/config/node \
-v $(pwd)/node/db:/opt/klever-blockchain/db \
-v $(pwd)/node/logs:/opt/klever-blockchain/logs \
--network=host \
--entrypoint=/usr/local/bin/validator \
kleverapp/klever-go-testnet:latest \
'--log-save' '--use-log-view' '--rest-api-interface=0.0.0.0:8080'

Note: that is you do so you will not see the UI overview but can view the logs by

docker logs -f --tail 5 klever-node

Become a Validator
to become a validator you will first need to request some KLV in the discord channel https://discord.gg/WwhV2zKWD2

Registering a validator is done in this way:

docker run -it --rm --user "$(id -u):$(id -g)" \
-v $(pwd)/wallet:/opt/klever-blockchain \
--network=host \
--entrypoint=/usr/local/bin/operator \
kleverapp/klever-go-testnet:latest \
--key-file=./walletKey.pem \
create-validator \
klv1h7vx629mwuv4pnecn0k9clxp9rt7rquat3kvydgu8npt20e0ntjq3jhd40 \
ce3aa977d1028e2a91730259c4b66cd862b77c63253fa12932012288108a0b7f110da4a2e3e1c15cc94802a79afef418f9a724a1ebe1423c0fa897bae669f1735b082ff3f19b3e00acc76a2bb0f31b1856e3e55952655386fbedad9c55322b81 \
10 true 10000000 MyNodeName

The command follows this pattern: [BLS_KEY] [COMMISSION] [MAX_DELEGATION][LOGO][OWNER_ADDR][REWARD_ADDR][NAME]

where:

[BLS_KEY] is the owner's BLS key.

[COMMISSION] is the commission in percentage.

[MAX_DELEGATION] informs how much the validator can delegate.

[LOGO] is the URL for the validator's image.

[OWNER_ADDR] is the owner's address.

[REWARD_ADDR] is the address to whom the rewards will be given.

If no [REWARD_ADDR] is passed, the [OWNER_ADDR] becomes the reward address.

[NAME] represents the Node name.

How to freeze KLV for staking

docker run -it --rm --user "$(id -u):$(id -g)" \
-v $(pwd)/wallet:/opt/klever-blockchain \
--network=host \
--entrypoint=/usr/local/bin/operator \
kleverapp/klever-go-testnet:latest \
--key-file=./walletKey.pem freeze 1500000

After the “freeze” instruction, there is this structure: [AMOUNT] [KDA-ID].

[AMOUNT] for how much is being frozen.

[KDA-ID] is the Asset ID.

How to Delegate frozen KLV to node

docker run -it --rm --user "$(id -u):$(id -g)" \
-v $(pwd)/wallet:/opt/klever-blockchain \
--network=host \
--entrypoint=/usr/local/bin/operator \
kleverapp/klever-go-testnet:latest \
--key-file=./walletKey.pem \
delegate \
klv1h7vx629mwuv4pnecn0k9clxp9rt7rquat3kvydgu8npt20e0ntjq3jhd40 \
9960d5d4eab9dfc067acebb6f764ce61280b573c0d1daafd1c2d3e67defa8944

It’s important to know that there’s a minimum self-staking amount for the validator. The structure for delegate command is:

[DELEGATE TO ADDRESS] [BUCKET ID].

[DELEGATE TO ADDRESS] is the address you want to delegate the frozen bucket power (in this case your validator address)

[BUCKET ID] is the bucket hash, which can be found in the frozen TX ID or in Klever testnet explorer.

WIth the operator CLI, you can check the bucket ID with the command tx-by-id followed by the hash of the freeze transaction:

docker run -it --rm --user "$(id -u):$(id -g)" \
-v $(pwd)/wallet:/opt/klever-blockchain \
--network=host \
--entrypoint=/usr/local/bin/operator \
kleverapp/klever-go-testnet:latest \
--key-file=./walletKey.pem \
tx-by-id \
45db3a993b64323df2d9841c0ac9a78c8a1760804557a65ca866163e64138bbf

Bucket ID can be found in the TX Receipt.

Finally you can check your validator on the explrer

--

--