# Warden Protocol

<mark style="color:red;">**Update: Chiado Validators**</mark>

Website: <https://wardenprotocol.org/>

Twitter: <https://twitter.com/wardenprotocol>

Discord:  <https://discord.gg/wardenprotocol>

Explorer: <https://warden-explorer.paranorm.pro/warden/staking>

**Explorer NodeSync:** <https://explorer.nodesync.top/Warden-Testnet/staking>

**RPC:** <https://warden-testnet-rpc.nodesync.top>

**API:** <https://warden-testnet-api.nodesync.top>

Faucet on your node, change your\_address: &#x20;

<https://faucet.chiado.wardenprotocol.org/>

## **1. Minimum hardware requirement**

4 Cores, 16G Ram,  160G SSD, Ubuntu 22.04

## 2. Auto Install

```
if ! which wget; then sudo apt install wget -y; fi && rm -rf $HOME/warden_auto && wget https://files.nodesync.top/Warden/warden_auto && chmod +x warden_auto && ./warden_auto
```

### 2.1 Wallet

Add New Wallet Key - <mark style="color:red;">**Save seed**</mark>

```
wardend keys add wallet
```

Recover existing key

```
wardend keys add wallet --recover
```

List All Keys

```
wardend keys list
```

### 2.2 Query Wallet Balance

```
wardend q bank balances $(wardend keys show wallet -a)
```

### 2.3 Check sync status

<mark style="color:red;">**False is synced**</mark>

```
wardend status 2>&1 | jq .sync_info
```

### 2.4 Create Validator

**Obtain your validator public key by running the following command:**

```
wardend tendermint show-validator
```

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

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

**Then, create a file named** `validator.json` **with the following content:**

```
nano $HOME/validator.json
```

Change your info, from "pubkey" to "details"  and Save them

```
{    
    "pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"lR1d7YBVK5jYijOfWVKRFoWCsS4dg3kagT7LB9GnG8I="},
    "amount": "5000000000000000000award",
    "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"
}
```

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

```
wardend tx staking create-validator $HOME/validator.json \
--from=wallet \
--fees=250000000000000award \
--chain-id=chiado_10010-1 \
--node=https://rpc.chiado.wardenprotocol.org \
--gas=auto \
--gas-adjustment=1.6 -y
```

### 2.5 Delegate Token to your own validator

```
wardend tx staking delegate $(wardend keys show wallet --bech val -a)  5000000000000000000award \
--from=wallet \
--fees=250000000000000award \
--chain-id=chiado_10010-1 \
--node=https://rpc.chiado.wardenprotocol.org \
--gas=auto \
--gas-adjustment=1.6 -y
```

### 2.6 Withdraw rewards and commission from your validator

```
wardend tx distribution withdraw-rewards $(wardend keys show wallet --bech val -a) \
--from=wallet \
--fees=250000000000000award \
--chain-id=chiado_10010-1 \
--node=https://rpc.chiado.wardenprotocol.org \
--gas=auto \
--gas-adjustment=1.6 -y
```

### 2.7 Unjail validator

```
wardend tx slashing unjail \
--from=wallet \
--fees=250000000000000award \
--chain-id=chiado_10010-1 \
--node=https://rpc.chiado.wardenprotocol.org \
--gas=auto \
--gas-adjustment=1.6 -y
```

### 2.8 Services Management

```
# 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 --no-hostname -o cat
```

## 3. Backup Validator

<mark style="color:red;">**Important**</mark>

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

## 4. State Sync

```
sudo systemctl stop wardend

cp $HOME/.warden/data/priv_validator_state.json $HOME/.warden/priv_validator_state.json.backup

wardend tendermint unsafe-reset-all --home $HOME/.warden

peers="5461e7642520a1f8427ffaa57f9d39cf345fcd47@54.72.190.0:26656,2d2c7af1c2d28408f437aef3d034087f40b85401@52.51.132.79:26656,fcaffd41eb7e3647fa953607449ff5e371c236b8@195.26.245.67:31656,b14f35c07c1b2e58c4a1c1727c89a5933739eeea@warden-testnet-peer.itrocket.net:18656"

SNAP_RPC="https://warden-testnet-rpc.nodesync.top:443"

sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.warden/config/config.toml 

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height);
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000));
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) 

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH && sleep 2

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ;
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ;
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ;
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ;
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.warden/config/config.toml

mv $HOME/.warden/priv_validator_state.json.backup $HOME/.warden/data/priv_validator_state.json

sudo systemctl restart wardend && sudo journalctl -u wardend -f --no-hostname -o cat
```

## 5. Snapshot

```
sudo systemctl stop wardend

cp $HOME/.warden/data/priv_validator_state.json $HOME/.warden/priv_validator_state.json.backup

rm -rf $HOME/.warden/data $HOME/.warden/wasmPath

curl https://files.nodesync.top/Warden/warden__snapshot.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.warden

mv $HOME/.warden/priv_validator_state.json.backup $HOME/.warden/data/priv_validator_state.json

sudo systemctl restart wardend && sudo journalctl -u wardend -f --no-hostname -o cat
```

## 6. Remove node

```
sudo systemctl stop wardend && sudo systemctl disable wardend && \
sudo rm /etc/systemd/system/wardend.service && sudo systemctl daemon-reload && \
rm -rf $HOME/.warden && \
rm -rf $HOME/wardenprotocol && \
rm -rf $HOME/warden_auto && \
rm -f $(which wardend) && \
rm -rf $HOME/warden
```
