🖤Warden Protocol

Alfama Testnet

This tutorial provides the necessary instructions to join the alfama testnet. versión v0.2.0.

Hardware recommendations

We recommend running public testnet nodes on machines with at least 8 cores, 32GB of RAM and 300GB of disk space. But with in the current phase, the nodes can run on significantly fewer resources.

Build Tools

Install Go following the instructions:

ver="1.20.3"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile

Installation & Configuration

Binaries

You will need to install and configure the warden binary using the script below:

cd $HOME
git clone --depth 1 --branch v0.2.0 https://github.com/warden-protocol/wardenprotocol/
cd wardenprotocol
make install-wardend

Initalize the chain home folder

sudo mv wardend /usr/local/bin/
wardend version --long | grep -e version -e commit
# version: 0.2.0
# commit: 4d37e5aa6eb2a0ee288baf3afbfec0c8b8e2551d 
wardend init <custom_moniker>

Config the app:

wardend config node tcp://localhost:26657
wardend config keyring-backend file
wardend config chain-id alfama

You can do the same editing $HOME/.warden/config/client.toml file:

# This is a TOML config file.
# For more information, see https://github.com/toml-lang/toml
###############################################################################
###                           Client Configuration                            ###
###############################################################################
# The network chain ID
chain-id = "alfama"
# The keyring's backend, where the keys are stored (os|file|kwallet|pass|test|memory)
keyring-backend = "file"
# CLI output format (text|json)
output = "text"
# <host>:<port> to CometBFT RPC interface for this chain
node = "tcp://localhost:26657"
# Transaction broadcasting mode (sync|async)
broadcast-mode = "sync"

The chain-id should be ‘alfama’, keyring-backend indicates where we will store the keys; we change its value to ‘file’ to store them in a file. The default port for the RPC interface is 26657, although we can customize it if we want.

We open the port if it’s not already open:

sudo ufw allow 26657

In some providers like IONOS, you also need to open the firewall on the VPS page.

Init the app:

wardend init <custom_moniker>

Replace <custom_moniker> with the customized name you will assign to your node.

Download the genesis:

wget -O $HOME/.warden/config/genesis.json https://testnet-files.itrocket.net/warden/genesis.json

Set minimum gas:

sed -i 's/minimum-gas-prices = ""/minimum-gas-prices = "0.0025uward"/' app.toml 

Set peers

PEERS="f995c84635c099329bfaaa255389d63e052cb0ac@warden-testnet-peer.itrocket.net:18656,55c5b6ab09002dfba354ff924775ea9ba319f226@81.31.197.120:26656,4135cbcd218a816e8f9af35b3c5cb3759c01c0ec@38.242.237.130:11156,fe93bda2c04efb3a172d80d46fa88915709be9d0@213.199.44.116:26656,225054d5ddf2386762450e21075c0e8677c3d0fc@144.76.29.90:26656,f236e203b40e1a771a4dd77a090c365d08596a6e@84.46.255.1:26686,f362d57aa6f78e035c8924e7144b7225392b921d@213.239.217.52:38656,ad6db1f33c559707509a777c26a5db86b5dddd0c@37.27.97.16:26656,27994efdba4df95118dc2748f0ebbccf72d8bd0a@65.108.232.156:29656,2992ea96175253603828620b3bab8688ef5d7517@65.109.92.148:61556,1aad03b1d5908ff5e0789f90d0ef41705a1b44ae@65.21.202.124:18656" 

sed -i 's|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.warden/config/config.tom

Config Prunning (This step is optional)

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

Disble indexin (this step is optional)

indexer="null"
sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.warden/config/config.toml

Enable snapshots to synth faster (This step is optional)

cd $HOME
apt install lz4
curl -o - -L https://warden-t.snapshot.stavr.tech/warden-snap.tar.lz4 | lz4 -c -d - | tar -x -C $HOME/.warden --strip-components 2

Download address book:

wget -O $HOME/.warden/config/addrbook.json "https://raw.githubusercontent.com/obajay/nodes-Guides/main/Projects/Warden/addrbook.json"

Check that all variables have been set correctly:

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

# output should be similar to:
# 70694 68694 6AF4938885598EA10C0BD493D267EF363B067101B6F81D1210B27EBE0B32FA2A

Start the node

Now we can launch the node so that the process remains running even after we disconnect from the server, you can use screen or you can use SystemD,:

Using screen

screen

# After running the node, we can exit the screen by pressing "CTRL+d + a"
# To re-enter: "screen -r"

You can now start the node using the following command:

wardend start

Using SystemD:

sudo tee /etc/systemd/system/wardend.service > /dev/null <<EOF
[Unit]
Description=wardend node
After=network-online.target
#Create service 
[Service]
User=$USER
WorkingDirectory=$HOME/wardenprotocol
ExecStart=$(which wardend) start
Restart=on-failure
RestartSec=3
LimitNOFILE=65535[Install]
WantedBy=multi-user.target
EOF
#Make sure the file has the appropriate root permissions:
chmod 777 wardend.service
    # Reload Service
    sudo systemctl daemon-reload
    # Enable Service
    sudo systemctl enable wardend
    # Disable Service
    sudo systemctl disable wardend
    # Start Service
    sudo systemctl start wardend
    # Stop Service
    sudo systemctl stop wardend
    # Restart Service
    sudo systemctl restart wardend
    # Check Service Status
    sudo systemctl status wardend
    # Check Service Logs
    sudo journalctl -u wardend -f -o cat

Once launched it will connect to persistent peers provided and start downloading blocks. You can check the logs to see the progress.

We have to wait for the node to synth, which we can verify by checking the node’s status:

wardend status 2>&1 | jq

We will get something like this:

{
  "node_info": {
    "protocol_version": {
      "p2p": "8",
      "block": "11",
      "app": "0"
    },
    "id": "5dad.....",
    "listen_addr": "tcp://0.0.0.0:26656",
    "network": "alfama",
    "version": "0.38.2",
    "channels": "40202122233038606100",
    "moniker": "<custom_moniker>",
    "other": {
      "tx_index": "on",
      "rpc_address": "tcp://127.0.0.1:26657"
    }
  },
  "sync_info": {
    "latest_block_hash": "250D4236B4B4BD659AF318A845B2F1ABD63EADA54DDF25FAF5B06D9B575871E2",
    "latest_app_hash": "3B92B30E7317E59582C511C97D834314D395FB7F1E4FD5B79A3CC171D6BAB356",
    "latest_block_height": "283516",
    "latest_block_time": "2024-03-20T10:11:10.227715757Z",
    "earliest_block_hash": "9B3C5336E0AFE51973B342FC6FF89957C596E80587D06E209991FFF646325A85",
    "earliest_app_hash": "E90F060D6E90E138FC3E3EC92D7B1916ACCECE7FEB55EBBF81C400E48612E674",
    "earliest_block_height": "145001",
    "earliest_block_time": "2024-03-11T09:58:34.666381915Z",
    "catching_up": false
  },
  "validator_info": {
    "address": "87....",
    "pub_key": {
      "type": "tendermint/PubKeyEd25519",
      "value": "Km...."
    },
    "voting_power": "740"
  }
}

We can verify that ‘latest_block_height’: ‘283516’ is the latest block by checking the explorer https://warden-explorer.paranorm.pro/warden/block

Create or restore a local wallet key pair

First, either create a new key pair, or restore an existing wallet for your validator. Replace <wallet-name> with a wallet name of your choice:

# Create a new keypair
wardend keys add <wallet-name>

# Alternatively, restore an existing wallet with a mnemonic seed phrase.
# wardend keys add <wallet-name> --recover

A wallet file will be created at $HOME/.warden/<wallet-name>.info containing the keys.

Once the wallet is created or imported, we can check our public address using the command:

wardend keys show <wallet-name> -a

After creating a new key, you will see it’s information and its seed phrase. It’s essential to write down this seed phrase and keep it in a safe place. The seed phrase is the only way to restore your keys. Losing it can result in the irrecoverable loss of WARD tokens.

Get testnet WARD

In the next steps, you register your new validator by submitting a create-validator transaction.

Because submitting a transaction consumes gas, you need to fund your newly created address from the first step beforehand.

You can obtain testnet tokens to fund your address from our WARD faucet:

curl --data' {"address": "<wallet-address>"}' https://faucet.alfama.wardenprotocol.org

Where <wallet-address> is our wallet public address.

We can also claim faucet tokens from Spaceward (read the Spaceward overview first)

You can verify your balance with this command:

wardend query bank balances <wallet-name>

The result is displayed in uward [1 WARD = 1.000.000 uward]

Create a new validator

Once the node is synced and you have the required WARD, you can become a validator.

To create a validator and initialize it with a self-delegation, you need to create a validator.json file and submit a create-validator transaction.

Obtain your validator public key by running the following command:

wardend comet show-validator

The output will be similar to this (with a different key):

{"@type":"/cosmos.crypto.ed25519.PubKey","key":"lR1d7YBVK5jYijOfWVKRFoWCsS4dg3kagT7LB9GnG8I="}

We can also obtain it using the node’s state information (“value” parameter inside “validator info”), as we already saw:

wardend status 2>&1 | jq

#.
#.
#.
#"validator_info": {
#    "address": "87....",
#    "pub_key": {
#      "type": "tendermint/PubKeyEd25519",
#      "value": "Km...."
#.
#.

Then, create a file named $HOME/.warden/config/validator.json with the following content:

{    
    "pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"lR1d7YBVK5jYijOfWVKRFoWCsS4dg3kagT7LB9GnG8I="},
    "amount": "1000000uward",
    "moniker": "your-node-moniker",
    "identity": "eqlab testnet validator",
    "website": "optional website for your validator",
    "security": "optional security contact for your validator",
    "details": "optional details for your validator",
    "commission-rate": "0.1",
    "commission-max-rate": "0.2",
    "commission-max-change-rate": "0.01",
    "min-self-delegation": "1"
}
  • “moniker” is the <custom_moniker> we set for our node

  • for “identity” use your Keybase code to obtain an avatar

Here you have the chance to set your validator’s commission rate, maximum rate, and maximum change rate. But also the initial self delegation (amount). Remember to replace the pubkey field with your own key obtained in the previous step.

Finally, we’re ready to submit the transaction to create the validator:

wardend tx staking create-validator validator.json
 - from=<wallet-name>
 - chain-id=alfama
 - fees=500uward

It’s important to have funds to pay the fees.

When you specify commission parameters, the commission-max-change-rate is measured as a percentage point change of the commission-rate. For example a change from 1% to 2% is a 100% rate increase, but the commission-max-change-rate is measured as 1%.

The above transaction is just an example. If you want to see an explanation of the parameters values or see all the available flags that can be set to customize your validators you can enter this command:

wardend tx staking create-validator - help

For example, if later on we want to change any of the parameters, we can do so:

wardend tx staking edit-validator \
--from=<wallet-name>
--identity "NEW_IDENTITY" \
--details "NEW_DETAILS" \
--website "NEW_WEBSITE" \
--security "NEW_SECURITY" \
--chain-id alfama \
--fees=500uward

Backup critical files

There are certain files you need to backup to be able to restore your validator if, for some reason, it’s damaged or lost. Please make a secure, encrypted backup of the following files:

  • priv_validator_key.json

  • node_key.json

#Backup
cp $HOME/.warden/data/priv_validator_key.json $HOME/.warden/priv_validator_key.json.backup
cp $HOME/.warden/data/node_key.json $HOME/.warden/node_key.json.backup
...
#Restore 
mv $HOME/.warden/priv_validator_key.json.backup $HOME/.warden/data/priv_validator_key.json
mv $HOME/.warden/node_key.json.backup $HOME/.warden/data/node_key.json

Confirm your validator is in the active set

Check if your validator is in the active set by running this command:

wardend query comet-validator-set | grep "$(wardend comet show-address)"

If the output is empty, your validator is not in the active set, otherwise you will recieve your validator address:

- address: wardenvalcons1sh37shd63ajsiejr98sfeg2fjulww06sxj86rr

We can also use the explorer to visually see the validators

Here, we can also view our node information, see the rewards we are generating, send tokens, or delegate them (to ourselves or to another validator).

Jailed State

If something goes wrong with our node, if it crashes, loses many blocks, etc., it can enter into a Jailed state

To return the node to the active set, we can use the following command:

wardend tx slashing unjail --from <wallet-name> --chain-id alfama --fees 500uward -y

Also we can autodelegate some tokens

wardend tx staking delegate $(wardend keys show <wallet-name> --bech val -a) 2000000uward --from <wallet-name> --chain-id=alfama --fees=500uward -y

Other commands

Withdraw rewards and commission from your validator

    wardend tx distribution withdraw-rewards $(wardend keys show wallet --bech val -a) \
    --from wallet \
    --commission \
    --chain-id=alfama \
    --fees=500uward

Backup Validator

     cat $HOME/.warden/config/priv_validator_key.json

Remove node

sudo systemctl stop wardend 
sudo systemctl disable wardend 
sudo rm -rf /etc/systemd/system/wardend.service 
sudo rm -rf $HOME/.warden 
sudo rm -fg $HOME/wardenprotocol

Updating node

#Be sure you have backuped "priv_validator_key.json" and wallet mnemonic before updating

#go to Home directory
cd $HOME
#download zip file
wget https://github.com/warden-protocol/wardenprotocol/releases/download/v0.2.0/wardend_Linux_x86_64.zip
#unzip repository
unzip wardend_Linux_x86_64.zip
#delete the zip file
rm -rf wardend_Linux_x86_64.zip

#give exec permision
chmod +x wardend
#move wardend to main directory
mv wardend $(which wardend)
#check the version is correct
wardend version --long | grep -e commit -e version
#commit: 4d37e5aa6eb2a0ee288baf3afbfec0c8b8e2551d
#version: 0.2.0

#restart and see the logs
sudo systemctl restart wardend && sudo journalctl -u wardend -f -o cat

#consensus
curl -s http://localhost:26657/consensus_state  | jq '.result.round_state.height_vote_set[0].prevotes_bit_array'

Others

#find wardend version:
wardend version

#find where your wardend binary is:
which wardend

Last updated