Warden Protocol
Installation
You should update the MONIKER
, WALLET
, and PORT
variables in the Setting up environment variables section. Make sure the port you specify is not already in use.
Check for ports already in use by visually inspecting the output of the lsof -i -P -n | grep LISTEN
command. Almost all Cosmos chain nodes use ports xx317
, xx656
, xx657
, and xx090
. Therefore, avoid using ports starting with xx
if they are already occupied.
Update OS
sudo apt update && sudo apt upgrade -y
Installation of required packages
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip jq -y
Installation of go (if you need)
cd ~
VER="1.21.3" # Make sure that this version does not broke any other apps you run!
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"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
Setting up environment variables
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="NGSolutionsWASHERE"" >> $HOME/.bash_profile
echo "export WARDEN_CHAIN_ID="buenavista-1"" >> $HOME/.bash_profile
echo "export WARDEN_PORT="12"" >> $HOME/.bash_profile
source $HOME/.bash_profile
Downloading and installing node
cd $HOME
## Following line deletes all the files under the ~/wardenprotocol directory.
## Please make sure that you have backed up everything you need
rm -rf wardenprotocol
git clone --depth 1 --branch v0.3.0 https://github.com/warden-protocol/wardenprotocol/
cd wardenprotocol
make install
Initializing the node
wardend init $MONIKER --chain-id $WARDEN_CHAIN_ID
sed -i -e "s|^node *=.*|node = \"tcp://localhost:${WARDEN_PORT}657\"|" $HOME/.warden/config/client.toml
Downloading genesis and addressbook
cd $HOME
curl https://warden.rpc.ngsolutions.xyz/genesis? | jq ".result.genesis" > .warden/config/genesis.json
wget -O $HOME/.warden/config/addrbook.json https://snapshots.ngsolutions.xyz/addrbook/warden/addrbook.json
Setting seeds and peers
PEERS="493f9eb0fe4b406330711b1bc76beee5befaf913@493f9eb0fe4b406330711b1bc76beee5befaf913:11256,fe976d454ad5ceac75a85e7466edc9025c6f2a51@fe976d454ad5ceac75a85e7466edc9025c6f2a51:26656,e12313f44fd35efa670392e10a21e3fd14a720f9@e12313f44fd35efa670392e10a21e3fd14a720f9:32656,79d4fcca3339abb19c915766b113c4f5b1aa21e2@79d4fcca3339abb19c915766b113c4f5b1aa21e2:26656,d3e0330d10424fc9dbba8992910490180c55459f@d3e0330d10424fc9dbba8992910490180c55459f:61056,f3128e8f6273d0ffe8bdea6c56704bfa1f68a5ec@f3128e8f6273d0ffe8bdea6c56704bfa1f68a5ec:47656,2316b64ebb6a28007f8894e3f31eb9e40276e5a2@2316b64ebb6a28007f8894e3f31eb9e40276e5a2:26656,2317a16cd927dce06655c4bf28f1d132f8f632c9@2317a16cd927dce06655c4bf28f1d132f8f632c9:36656,73a865805db875019306049cf9bc83a05180ff80@73a865805db875019306049cf9bc83a05180ff80:20106,d1f8f1f2715e1fd9ea94a09e2913c0e1c26cdf6b@d1f8f1f2715e1fd9ea94a09e2913c0e1c26cdf6b:26656"
sed -i -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.warden/config/config.toml
Setting custom ports
Updating ports in app.toml
sed -i.bak -e "s%:1317%:${WARDEN_PORT}317%g;
s%:8080%:${WARDEN_PORT}080%g;
s%:9090%:${WARDEN_PORT}090%g;
s%:9091%:${WARDEN_PORT}091%g;
s%:8545%:${WARDEN_PORT}545%g;
s%:8546%:${WARDEN_PORT}546%g;
s%:6065%:${WARDEN_PORT}065%g" $HOME/.warden/config/app.toml
Updating ports in config.toml
sed -i.bak -e "s%:26658%:${WARDEN_PORT}658%g;
s%:26657%:${WARDEN_PORT}657%g;
s%:6060%:${WARDEN_PORT}060%g;
s%:26656%:${WARDEN_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${WARDEN_PORT}656\"%;
s%:26660%:${WARDEN_PORT}660%g" $HOME/.warden/config/config.toml
Configuring pruning settings
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.warden/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.warden/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"10\"/" $HOME/.warden/config/app.toml
Setting gas and other configurations
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.0025uward"|g' $HOME/.warden/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.warden/config/config.toml
sed -i 's/max_num_inbound_peers =.*/max_num_inbound_peers = 50/g' $HOME/.warden/config/config.toml
sed -i 's/max_num_outbound_peers =.*/max_num_outbound_peers = 50/g' $HOME/.warden/config/config.to
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.warden/config/config.toml
Creating service file
sudo tee /etc/systemd/system/wardend.service > /dev/null <<EOF
[Unit]
Description=Warden Protocol Node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.warden
ExecStart=$(which wardend) start --home $HOME/.warden
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Snapshot
Important: Back Up Your Validator Key
Before resetting your node, ensure you have a backup of your priv_validator_key.json
file. This is especially important if you've already created a validator. Without a backup, resetting the node will result in lost access and require you to create a new validator from scratch.
This script creates a copy of your priv_validator_state.json
and priv_validator_key.json
files. It then copies the original private files back after downloading the snapshot. However, use this script with caution to avoid any potential failures.
-
Create Backups of Private Files.
cp $HOME/.warden/data/priv_validator_state.json $HOME/priv_validator_state.json.warden.backup
cp $HOME/.warden/config/priv_validator_key.json $HOME/priv_validator_key.json.warden.backup -
Reset Node and Download Snapshot
wardend tendermint unsafe-reset-all --home $HOME/.warden --keep-addr-book
curl https://snapshots.ngsolutions.xyz/snapshots/warden/snap_warden.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.warden -
Restore Backed Up Files
cp $HOME/priv_validator_state.json.warden.backup $HOME/.warden/data/priv_validator_state.json
cp $HOME/priv_validator_key.json.warden.backup $HOME/.warden/config/priv_validator_key.json
Enabling and starting the service.
# You need to inspect logs visually after the to make sure that it is working
sudo systemctl daemon-reload
sudo systemctl enable wardend
sudo systemctl restart wardend && sudo journalctl -u wardend -f
Creating a wallet
You need to create or import a wallet to request test tokens. If you dont have any tokens, you will not be able to create a validator.
# Following command creates a new wallet.
# Copy mnemonics to a safe place
# If you lost your mnemonics you will not be able to recover this wallet.
wardend keys add $WALLET
# If you want to import a wallet using mnemonics, execute following command and enter your mnemonics
wardend keys add $WALLET --recover
# Get your keys and their addresses to request faucet
wardend keys list
Creating a validator
Before you begin:
It's crucial to ensure your node is synchronized with the network before attempting to create a validator. This ensures your validator operates with the latest blockchain data.
Checking Synchronization Status:
Use the following snippet to check your node's synchronization status. If the snippet returns false
, your node is in sync and ready to proceed. However, if it returns true
, your node is still catching up. In that case, please wait until the synchronization completes before creating a validator.
wardend status | jq -r .sync_info.catching_up
Creating a Validator:
The following snippet will create a validator.json
file in your node's home directory. This file stores the details necessary to create your validator. While you can edit the validator.json
file later, keep in mind that doing so may incur token fees. Therefore, it's important to ensure the information within the file is accurate before proceeding.
cd $HOME
# Create validator.json file
echo "{
\"pubkey\":{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"$(wardend comet show-validator | grep -Po '\"key\":\s*\"\K[^"]*')\"},
\"amount\": \"1000000uward\",
\"moniker\": \"NGSolutionsWasHere\",
\"identity\": \"\",
\"website\": \"\",
\"security\": \"\",
\"details\": \"All heil NGSolutions\",
\"commission-rate\": \"0.1\",
\"commission-max-rate\": \"0.2\",
\"commission-max-change-rate\": \"0.01\",
\"min-self-delegation\": \"1\"
}" > .warden/validator.json
Next Steps:
Once you're satisfied with the contents of validator.json
, you can proceed with creating the validator using the information stored within the file.
# Create a validator using the JSON configuration
wardend tx staking create-validator validator.json \
--from $WALLET \
--chain-id $WARDEN_CHAIN_ID \
--fees 500uward
Delegate to yourself
You might need to update number of tokens before executing the following command.
wardend tx staking delegate $(wardend keys show $WALLET --bech val -a) 9000000uward --chain-id=$WARDEN_CHAIN_ID --from=$WALLET --fees=500uward
Deleting the node completely (if you need)
Make sure that you backed up any required files to setup later! Do not lost your validator or wallet!
sudo systemctl stop wardend
sudo systemctl disable wardend
sudo rm -rf /etc/systemd/system/wardend.service
sudo rm $(which wardend)
sudo rm -rf $HOME/.warden
sed -i "/WARDEN_/d" $HOME/.bash_profile