Skip to content

Latest commit

 

History

History
 
 

tgrade

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

Tgrade mainnet validator's guide

Tgrade Guide by AnyValid


Project Discord | Tgrade Dapp | Tgrade Constisution on Russian | Tgrade Constisution on English


Update and install necessary packages:

sudo apt update && sudo apt upgrade --yes && \
sudo apt install git build-essential ufw curl jq snapd screen ncdu nano fuse ufw --yes && 

Install go:

sudo snap install go --classic && \
echo 'export GOPATH="$HOME/go"' >> ~/.profile && \
echo 'export GOBIN="$GOPATH/bin"' >> ~/.profile && \
echo 'export PATH="$GOBIN:$PATH"' >> ~/.profile && \
source ~/.profile && \
go version

Clone repository and compile last version of binary (you can find releases here: click):

git clone https://github.com/confio/tgrade
cd tgrade
git checkout v$(curl -s https://tgrade-rpc.anyvalid.com/abci_info | jq -r .result[].version)
make install

Init your keys and download genesis file:

tgrade init <moniker> --chain-id tgrade-mainnet-1
tgrade keys add <moniker>
wget https://raw.githubusercontent.com/confio/tgrade-networks/main/mainnet-1/config/genesis.json -O /root/.tgrade/config/genesis.json

Set up gas_price / persistent_peers / pruning:

sed -i "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.05utgd\"/;" $HOME/.tgrade/config/app.toml
sed -E -i 's/persistent_peers = \".*\"/persistent_peers = \"[email protected]:26656,[email protected]:26656,[email protected]:26656\"/' $HOME/.tgrade/config/config.toml
pruning="custom"
pruning_keep_recent="100"
pruning_keep_every="0"
pruning_interval="10"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.tgrade/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.tgrade/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.tgrade/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.tgrade/config/app.toml

Set up Tgrade service

sudo tee <<EOF >/dev/null /etc/systemd/system/tgrade.service
[Unit]
Description=Tgrade daemon
After=network-online.target

[Service]
User=$USER
ExecStart=$HOME/go/bin/tgrade start
Restart=on-failure
RestartSec=3
LimitNOFILE=100000

[Install]
WantedBy=multi-user.target
EOF

Enable Tgrade daemon:

sudo systemctl enable tgrade
sudo systemctl daemon-reload

If you want to synchronize your node from the 0 block:

Start Tgrade service and watch logs:

sudo systemctl restart tgrade
sudo journalctl -u tgrade -f -o cat

Or you can quickly synchronize your node through State Sync:

Stop existing service and reset database:

sudo systemctl stop tgrade
tgrade tendermint unsafe-reset-all

Fill variables with data for State Sync:

RPC="https://tgrade-rpc.anyvalid.com:443"
RECENT_HEIGHT=$(curl -s $RPC/block | jq -r .result.block.header.height)
TRUST_HEIGHT=$((RECENT_HEIGHT - 500))
TRUST_HASH=$(curl -s "$RPC/block?height=$TRUST_HEIGHT" | jq -r .result.block_id.hash)
PEER="[email protected]:26656"

Add variable values to config.toml:

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$RPC,$RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$TRUST_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.tgrade/config/config.toml
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEER\"/" $HOME/.tgrade/config/config.toml

Start service and open journal:

sudo systemctl restart tgrade
sudo journalctl -u tgrade -f -o cat

Wait for sync...


Create validator (Do not forget to specify amount (1tgd = 1000000utgd) / keyname / moniker):

tgrade tx poe create-validator \
  --amount 1000000utgd \
  --vesting-amount 0utgd \
  --from <keyname> \
  --pubkey $(sudo tgrade tendermint show-validator) \
  --chain-id tgrade-mainnet-1 \
  --moniker "<your-validator-name>" \
  --fees 200000utgd \
  --gas auto \
  --gas-adjustment 1.4

After creating your own validator you can delegate more liquid and/or vesting tokens to your valiator on Tgrade dapp or via command:

tgrade tx poe self-delegate <liquid tokens amount>utgd <vesting tokens amount>utgd \
  --from <keyname> \
  --gas auto \
  --gas-adjustment 1.4 \
  --chain-id tgrade-mainnet-1 \
  --fees 200000utgd