Setting up a Klever Testnet Node

peloclick
6 min readFeb 24, 2022

In this article we will go through the process of setting up a Klever testnet node. Of course, the official guide has been used here:

But, before we move on, what is Klever?

Klever Finance is a trusted permissioned blockchain network for the emerging decentralized economy, providing a safer, faster and smarter cryptocurrency experience for all users globally to enter and thrive.

A blockchain network does not have an intrinsic value in and of itself, but in fact is only as valuable as what the platform offers its users in terms of usable products and opportunities to participate in the network.

With this in mind, KleverChain allows users on a global scale to access indispensable services and products. These include market-leading crypto wallet, crypto swap, web browser, exchange, staking, payment channels, loans, liquidity pools, decentralized finance, game assets, supply chains, logistic records, notary, stored value, gift cards, rewards, loyalty programs, collectibles, banking, ownership and more.

So, it is not just the blockchain but its real world uses that give value to it.

Hardware settings:

The hardware settings needed to run a Klever Testnet node are pretty small in comparison with other resource-eating blockchains out there. Better not to mention any names… :)

  • A Cpu with at least 4 cores
  • 8Gb of RAM or more
  • SSD or NVMe drive with 200Gb free space
  • 100MBps connection speed
  • Linux or MacOS

I made the install on top of an Ubuntu 20.04 Linux.

First of all, we ensure that our Linux box is up to date with:

sudo apt-get update

Then, we install some typical dependencies to ensure that we can move around the system and have what we need for monitoring:

sudo apt-get install jq mc htop docker.io vnstat

jq will enable us to transform and parse json text. MC is a file browser. Htop let us inspect CPU and Memory load. VNstat lets us monitor bandwidth consumption and then, of course, docker.io lets us use and launch docker containers.

Now, we create a local folder to store the wallet:

mkdir wallet

and then run the command that enables us to create it:

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”

During the creation, we will see the public wallet serial:

INFO [2022–02–24 13:16:38.299] generating files in folder = /opt/klever-blockchain

INFO [2022–02–24 13:16:38.302] wallet created address = klv1uvzgjfy6qn828vm26zcpq8fkkf8t4dd2fkzhggsh5hf6xl0hxnhskv8kmz

Of course, the wallet needs funding that you gotta request according to the proper procedure. At the time of writing this medium, a formular is needed to get the funds. Until the wallet gets any funds, when you search for it on https://testnet.kleverscan.org it will give a “Not found” result. So, the wallet needs funds to be included in the blockchain.

Now that we have a wallet we have to save it offline. For that, copy the pem file insde of your home folder / wallet folder. You want to have a copy of it in case you need to move the node to another machine.

The time to setup the validator itself has arrived. First, we create the needed folders for Klever to store its data:

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

That will leave the Klever node data inside of a folder named node inside of your home folder.

Now, we have to download the genesis file that tells our node how the blockchain ‘started’, with which accounts and which funds:

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

Now, a BLS Key or Validator Key will be created:

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

This will create a file named validatorKey.pem inside of yourhomefolder/node/config. You want to save an offline copy of it!

Now, instead of syncing from scratch, that is, from the genesis block up to the latest, we will download a snapshot saving some time syncing up our node:

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

We could leave without it but the syncing time would be much bigger.

Now it is time to launch the chain in our node:

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’

First we will see our node starting:

And then, a screen like this one will open:

The most important part, before creating our validator is to check if we are synced or not. If not, we have to wait until we are completely in sync with the chain:

Notice the “synchronized” status in green color. Now it is technically possible to create our validator but we gotta be sure that our wallet has been funded.

If it is funded then, running this command, we will find out the pubkey of our wallet which, indeed is a different thing from the wallet pubkey:

cat node/config/validatorKey.pem

Which will give us the following pubkey in the beginning:

— — -BEGIN PRIVATE KEY for 9dab6f905cd9ba94ba4c2a5d487dd92ed9111c005ae2a5d564a3753792e5759ca6ee8bd92c28e8892a96ff65126fef000cdbe7d881b9c0ef30e0f7748c20eaff8e9e406ec00bce4ddcf00f409112699c9bc6198e2495b818bee469f7a0c40616 — —

Now, according to this step of the guide: https://docs.klever.finance/klever-blockchain/become-a-validator/how-to-register-a-validator-using-cli

we can move on and create our validator:

docker run -it — rm — user “$(id -u):$(id -g)” -v $(pwd)/wallet:/opt/klever-blockchain — entrypoint=/usr/local/bin/operator — network=host kleverapp/klever-go-testnet:latest — key-file=./walletKey.pem create-validator 9dab6f905cd9ba94ba4c2a5d487dd92ed9111c005ae2a5d564a3753792e5759ca6ee8bd92c28e8892a96ff65126fef000cdbe7d881b9c0ef30e0f7748c20eaff8e9e406ec00bce4ddcf00f409112699c9bc6198e2495b818bee469f7a0c40616 10 1400000000000 null klv1c7htf263pyswfgf0zlws6vnd4wt9ysm94p7mjmzcs79w3s8qdups7tpaad klv1c7htf263pyswfgf0zlws6vnd4wt9ysm94p7mjmzcs79w3s8qdups7tpaad

Notice there the pubkey of the validator in bold, and the owning wallet at the end, twice, as the owner + the wallet receiving rewards.

The null text corresponds to the image of the validator (here none…) and those 1400000000000 are the maximum amount of tokens the validator can delegate.

The 10 right after the validator pubkey is the commission (10% in this case).

Now it is time to freeze some tokens 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

We need to save the hash of that tx. In our case, it was

bfb38a3155fbd6a31112ff21c98a6626ddc036eb7164b80945abbcd64c95608a

since we will need it to check the bucket number with this command:

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 \
bfb38a3155fbd6a31112ff21c98a6626ddc036eb7164b80945abbcd64c95608a

Mind how the hash of the previous freezing transaction has been used here to find out the bucked-ID that in our case will give us:

c32901c77781a142f9bd3ea9651e8f30e3c2b7ab101a31cb9ec266ed16efd479

Now that we have both our wallet ID as well as the Bucket ID bound to the frozen KLV for staking we can indeed delegate those tokens with this command where both our wallet pubkey + our Bucket ID will be used:

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 \
klv1c7htf263pyswfgf0zlws6vnd4wt9ysm94p7mjmzcs79w3s8qdups7tpaad \
c32901c77781a142f9bd3ea9651e8f30e3c2b7ab101a31cb9ec266ed16efd479

Then, we gotta check our validator as waiting on the Network Explorer:

Then, staking of the validator has to happen to get active. This is made by the Klever Team.

Happy testing! :)

--

--