klever testnet setup guide

a) introduction

in this article, which is based on klever teams docs site, i explain how to setup a validator in the klever blockchain testnet on an ubuntu server 20.04 lts. my setup consists of a hosted vps which meets the requirements provided by the klever team.

to participate in the testnet as a validator you have to fill out a google form for phase one on the klever blockchain validator program website to get your tklv (testnet klever cryptocurrency). we fill out the form after we got to point f), where we get the wallet address of our node.

b) preconditions

as a precondition validator admins should have basic knowledge of linux administration via the commandline and also know how to connect to a headless linux server via ssh. i recommend a vps installation with ubuntu server 20.04 lts. when we’re connected to our vps with ssh and have done our apt updates and reboot we can start with further preparation.

c) ssh security

as we have our server exposed to the internet i recommend a change of the ssh port to a random port e.g. one between 49152 and 65535. so we can avoid the noise from ssh bruteforce or dictionary attacks. we do this by removing the # symbol before the port setting and change port number in /etc/ssh/sshd/config

a restart of the sshd daemon activates the setting systemctl restart sshd.service

d) adding a user

we add a “non root” user e.g. called “crypto” with the root account and follow the assistant adduser crypto

this is mandatory because we need docker, which is not designed to get used with the root account. we also want to add root permissions for the new account by adding the sudo group to the user usermod -aG sudo crypto

then we jump to our new user with the switch user command su crypto

or login with the new user via ssh. don’t forget changed ssh port when connecting. from now on we use our new user (in my example called: crypto).

please be aware that we do all further steps with our new user “crypto” in its home directory “/home/crypto”. we make sure we are in our userhome /home/crypto

cd; pwd

e) install docker

sudo apt install docker.io

now we download the latest version of klever testnet

sudo docker pull kleverapp/klever-go-testnet:latest

f) create a wallet

first we create a folder for our wallet in our user home /home/crypto mkdir wallet

then we generate our wallet with a docker command. to stay accountable we put these docker commands in a script. we simply create a file e.g. createwallet.sh in our user home, drop the docker command with the editor of your choice and save.

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"

next we make the file executable for our userchmod u+x ./createwallet.sh

now we execute our script with sudosudo ./createwallet.sh

we do the same with the next docker command to get our wallet 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"we can call this script getaddress.sh

chmod u+x ./getaddress.sh

sudo ./getaddress.sh

you can compare your result with the docs website in the headline for step f)

g) get the node running

first we create our statics directory

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

now we get the genesis config for our node

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

and we create our validator bls key

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

to shorten the first node sync time we can get fast spin data and extract it to our folders

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

in preparation of the node start we install a terminal multiplexer called screen. this is needed when we want to exit the ssh session without terminating the running node (view mode) sudo apt install screen

we create a nodestart.sh script with the following content

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'

to make it executable we give our user permissions chmod u+x ./nodestart.sh

before starting the node, we open a session of the terminal multiplexer and give the session the name “mynode”

screen -S mynode

sudo ./nodestart.sh

now we should see a nice view mode of the klever node inside our screen multiplexer session “mynode”. our node syncs the blockchain.

when we want to keep the node running, which we usually want, we must leave the screen session with simultaneously pressing buttons “control” + “a”, release and press “d”. this is the shortcut to leave a screen session. to reconnect we type screen -r

now we know how to start the node in a screen terminal multiplexer session, leave and reconnect the screen session.

to stop the node from outside the screen session type sudo docker stop klever-nodeor inside the screen session we can do it by pressing simultaneously “control” + “c”. to end the screen session we type exit check if screen session still active can be done with screen -ls

there is also the possibility to run your node as a daemon in the background without needing a terminal multiplexer. description in the klever docs (bottom of the site).

h) become a validator

with our running node we can start with preparation to become a validator. if we have received our tklv by filling out the form under point a), we can get started.

this process is done in three steps. these steps are described on klevers docs site and will not be repeated at this point, follow the links:

register the validator | freeze tklv | delegate frozen tklv to node

when we were successful we get a terminal gui in our screen session looking like this:

what we want to see is at the end of line starting with “Node name: …”:

eligible or elected

when our validator is eligible we will rotate into one of the next epochs as signing validator. when we are elected we’re signing transactions!

congratulations, we are done. our validator is ready and can sign transactions.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
vpS1TT3R

vpS1TT3R

earn passive income with klever staking and join a community of klever people around the world https://klever.page.link/uwEp8oJXfPv6YLcL7