January 29, 2023

Teritori Testnet

Official Links

Official Document

Teritori Official Website

Explorer

Explorer

Server requirements:

  • 4x CPUs; the faster clock speed the better
  • 8GB RAM
  • 200GB of storage (SSD or NVME)

Install Node Guide (Mainnet)

Preparing the server

sudo apt update && sudo apt upgrade -y && \
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils git make ncdu gcc git jq chrony liblz4-tool -y

GO 19 (one command)

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

Download and install Binaries

git clone https://github.com/TERITORI/teritori-chain
cd teritori-chain
git checkout v1.3.0
make install

Init

teritorid init <MONIKER> --chain-id teritori-testnet-v3
teritorid config chain-id teritori-testnet-v3

Replace <MONIKER> To your moniker

Create/recover wallet

teritorid keys add <walletname>
teritorid keys add <walletname> --recover

when creating, do not forget to write down the seed phrase

Genesis

cd $HOME
wget https://github.com/TERITORI/teritori-chain/raw/mainnet/testnet/teritori-testnet-v3/genesis.json
mv genesis.json .teritorid/config/

Memory optimization (optional)

# Memory optimization. Removes unused data from the database. | ONE COMMAND

CONFIG=.teritorid

indexer="null" && \
snapshot_interval="100" && \
pruning="custom" && \
pruning_keep_recent="100" && \
pruning_keep_every="0" && \
pruning_interval="10" && \
min_retain_blocks="1" && \
inter_block_cache="false" && \
sed -i.bak -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/$CONFIG/config/config.toml && \
sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$snapshot_interval\"/" $HOME/$CONFIG/config/app.toml && \
sed -i.bak -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/$CONFIG/config/app.toml && \
sed -i.bak -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/$CONFIG/config/app.toml && \
sed -i.bak -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/$CONFIG/config/app.toml && \
sed -i.bak -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/$CONFIG/config/app.toml && \
sed -i.bak -e "s/^min-retain-blocks *=.*/min-retain-blocks = \"$min_retain_blocks\"/" $HOME/$CONFIG/config/app.toml && \
sed -i.bak -e "s/^inter-block-cache *=.*/inter-block-cache = \"$inter_block_cache\"/" $HOME/$CONFIG/config/app.toml

All Live Peers for Teritori

ccc59b8a55f9c6e7a24bd693e2796f781ea3a670@65.108.227.133:27656,5ae1012f9b0f4672d8152de903d115dd2f1a3ee3@65.21.170.3:27656,22101a61b235e607d5d0ad51b698d7511ebf87e2@65.108.43.227:26796,15dd94f68c450da2c3b7c60b6364e3dce6f0cbf2@185.193.66.68:26641

Here is a script for you to update persistent_peers setting with these peers in config.toml.

PEERS="ccc59b8a55f9c6e7a24bd693e2796f781ea3a670@65.108.227.133:27656,5ae1012f9b0f4672d8152de903d115dd2f1a3ee3@65.21.170.3:27656,22101a61b235e607d5d0ad51b698d7511ebf87e2@65.108.43.227:26796,15dd94f68c450da2c3b7c60b6364e3dce6f0cbf2@185.193.66.68:26641"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.teritorid/config/config.toml

Create a service file

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

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

[Install]
WantedBy=multi-user.target
EOF

Start your node

sudo systemctl daemon-reload
sudo systemctl enable teritorid
sudo systemctl restart teritorid
sudo journalctl -u teritorid -f -o cat

Create validator

After your node is synced , Create your mainnet validator

teritorid tx staking create-validator \
--amount=1000000utori \
--pubkey=$(teritorid tendermint show-validator) \
--moniker="<Moniker>" \
--identity="" \
--details="" \
--website="" \
--chain-id="teritori-testnet-v3" \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.1" \
--min-self-delegation="1" \
--fees 500utori \
--from=<wallet> -y

Replace <Moniker> With your moniker and replace <wallet> with your wallet name

Upgrade to v1.3.0

Manual Upgrade

sudo systemctl stop teritorid

cd || return
rm -rf teritori-chain
git clone https://github.com/TERITORI/teritori-chain
cd teritori-chain || return
git checkout v1.3.0
make install
teritorid version # v1.3.0

sudo systemctl start teritorid
sudo journalctl -u teritorid -f --no-hostname -o cat

StateSync

peers="https://rpc-t.teritori.nodestake.top:443"
sed -i.bak -e  "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.teritorid/config/config.toml
SNAP_RPC=https://rpc-t.teritori.nodestake.top:443
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 500)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

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\"\"|" ~/.teritorid/config/config.toml
teritorid tendermint unsafe-reset-all --home $HOME/.teritorid
sudo systemctl restart teritorid && journalctl -u teritorid -f -o cat

Usefull comlambs

Service management

Check logs

journalctl -fu teritorid -o cat

Start service

sudo systemctl start teritorid

Stop service

sudo systemctl stop teritorid

Restart service

sudo systemctl restart teritorid

Node info

Synchronization info

teritorid status 2>&1 | jq .SyncInfo

Validator info

teritorid status 2>&1 | jq .ValidatorInfo

Node info

teritorid status 2>&1 | jq .NodeInfo

Show node id

teritorid tendermint show-node-id

Wallet operations

List of wallets

teritorid keys list

Recover wallet

teritorid keys add <wallet> --recover

Delete wallet

teritorid keys delete <wallet>

Get wallet balance

teritorid query bank balances <address>

Transfer funds

teritorid tx bank send <FROM ADDRESS> <TO_TERITORI_WALLET_ADDRESS> 10000000utori

Voting

teritorid tx gov vote 1 yes --from <wallet> --chain-id=teritori-testnet-v3

Staking, Delegation and Rewards

Delegate stake

teritorid tx staking delegate <teritori valoper> 10000000utori --from=<wallet> --chain-id=teritori-testnet-v3 --gas=auto

Redelegate stake from validator to another validator

teritorid tx staking redelegate <srcValidatorAddress> <destValidatorAddress> 10000000utori --from=<wallet> --chain-id=teritori-testnet-v3 --gas=auto

Withdraw all rewards

teritorid tx distribution withdraw-all-rewards --from=<wallet> --chain-id=teritori-testnet-v3 --gas=auto

Withdraw rewards with commision

teritorid tx distribution withdraw-rewards <teritori valoper> --from=<wallet> --commission --chain-id=teritori-testnet-v3

Validator management

Edit validator

teritorid tx staking edit-validator \
  --moniker=<moniker> \
  --identity=<your_keybase_id> \
  --website="<your_website>" \
  --details="<your_validator_description>" \
  --chain-id=teritori-testnet-v3 \
  --from=<wallet>

Unjail validator

teritorid tx slashing unjail \
  --broadcast-mode=block \
  --from=<wallet> \
  --chain-id=teritori-testnet-v3 \
  --gas=auto

Delete node

This comlambs will completely remove node from server. Use at your own risk!

sudo systemctl stop teritorid
sudo systemctl disable teritorid
sudo rm /etc/systemd/system/teritorid* -rf
sudo rm $(which teritorid) -rf
sudo rm $HOME/.teritorid* -rf
sudo rm $HOME/teritori-chain -rf
sed -i '/TERITORI_/d' ~/.bash_profile