May 29, 2022

Chain Node Kyve

For the operation of the Kyve project network, it is a completely sovereign Proof of Stake blockchain build with Starport. This blockchain is managed by independent nodes, called Chain-Nodes, as they operate at the chain level. The native currency of the KYVE blockchain is $KYVE, it secures the chain and allows Chain nodes to stake and other users to delegate their tokens to them.

First, we need a server on Ubuntu 20.04

Minimum requirements 2vCPU/16RAM/1000gb

Updating all packages

sudo apt update && sudo apt upgrade -y

Setting variables

NODENAME="name your node"

Next, we save the variables to the bash:

echo "export NODENAME=$NODENAME" >> $HOME/.bash_profile 
echo "export WALLET=wallet" >> $HOME/.bash_profile 
echo "export CHAIN_ID=korellia" >> $HOME/.bash_profile 
source $HOME/.bash_profile

Download the binary file from the project's official github

wget https://github.com/KYVENetwork/chain/releases/download/v0.0.1/chain_linux_amd64.tar.gz
tar -xvzf chain_linux_amd64.tar.gz
chmod +x chaind && mv ./chaind /usr/local/bin/chaind

Start init

chaind init $NODENAME --chain-id $CHAIN_ID

Download and move the genesis file

wget -qO $HOME/.kyve/config/genesis.json https://github.com/KYVENetwork/chain/releases/download/v0.0.1/genesis.json

Download and move the addrbook file

wget -qO $HOME/.kyve/config/addrbook.json https://api.testnet.run/addrbook-korellia.json

Next, let's run the node

chaind start [email protected]:26656

To avoid having to update the binary manually, we will install Cosmovisor

wget https://github.com/KYVENetwork/chain/releases/download/v0.0.1/cosmovisor_linux_amd64
mv cosmovisor_linux_amd64 cosmovisor

Next, make the file executable and move it to /usr/bin

chmod +x cosmovisor && mv ./cosmovisor /usr/local/bin/cosmovisor

Creating a directory

mkdir -p $HOME/.kyve/cosmovisor/genesis/bin/
echo "{}" > $HOME/.kyve/cosmovisor/genesis/upgrade-info.json

Next, copy the binary to the Cosmovisor directory

cp /usr/local/bin/chaind $HOME/.kyve/cosmovisor/genesis/bin/chaind

Setting up the Pruning

pruning="custom"
pruning_keep_recent="100"
pruning_keep_every="0"
pruning_interval="10"

Write down

sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.kyve/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.kyve/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.kyve/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.kyve/config/app.toml

Disable indexing

nano $HOME/.kyve/config/config.toml

Set "null" in the indexer section

Save ctr+O exit ctr+X

Saving variables

export DAEMON_HOME="$HOME/.kyve" 
export DAEMON_NAME="chaind"
export DAEMON_ALLOW_DOWNLOAD_BINARIES="true"

Next, create a service file

tee <<EOF > /dev/null /etc/systemd/system/kyved.service
[Unit]
Description=KYVE Chain-Node daemon
After=network-online.target

[Service]
User=$USER
ExecStart=$(which cosmovisor) start
Restart=on-failure
RestartSec=3
LimitNOFILE=infinity

Environment="DAEMON_HOME=$HOME/.kyve"
Environment="DAEMON_NAME=chaind"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=true"

[Install]
WantedBy=multi-user.target
EOF

Enable and run the service file

sudo systemctl enable kyved && sudo systemctl start kyved

See the logs

journalctl -u kyved -f -o cat

After the synchronization is complete, create or restore a wallet

chaind keys add wallet

If you already have a wallet, you can restore it using the mnemonic phrase

chaind keys add wallet --recover

Then become a validator, add the number of tokens, and the name of your node

chaind tx staking create-validator --yes \
 --amount "amount"tkyve \
 --moniker $NODENAME \
 --commission-rate "0.10" \
 --commission-max-rate "0.20" \
 --commission-max-change-rate "0.01" \
 --min-self-delegation "1" \
 --pubkey "$(chaind tendermint show-validator)" \
 --from $WALLET \
 --chain-id $CHAIN_ID

USEFUL COMMANDS

Finding out our Valoper address

VALOPER=$(chaind keys show wallet --bech val -a)
echo 'export VALOPER='${VALOPER} >> $HOME/.bash_profile 
source $HOME/.bash_profile

To add stake to your node

chaind tx staking delegate $VALOPER "amount"tkyve --from $WALLET --chain-id $CHAIN_ID

To get out of jail

chaind tx slashing unjail --chain-id $CHAIN_ID --from $WALLET

Take the rewards for the delegation

chaind tx distribution withdraw-rewards $VALOPER --from $WALLET --fees 5555tkyve --commission -y

Check your balance

chaind query bank balances "adress"

Congratulations, you have become a chain node validator!

My chat room for discussion: https://t.me/russianbears1

Author's Channel: https://t.me/cryptorussianbears