LINKS

**Github**
[<https://github.com/Canto-Network/Canto>](<https://github.com/Canto-Network/Canto>)
[](<https://github.com/Stride-Labs/testnet>)
**DOCS**
[<https://canto.gitbook.io/canto/technical-reference/validators/becoming-a-validator#start-the-node>](<https://canto.gitbook.io/canto/technical-reference/validators/becoming-a-validator#start-the-node>)

**Explorer**
[<https://explorer.nodestake.top/canto/staking>](<https://explorer.nodestake.top/canto/staking>)

Install dependencies

# Update if needed
sudo apt update && sudo apt upgrade -y

# Insall packages
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils git make ncdu -y

# Install GO
cd $HOME
ver="1.21.5"
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

****go version

build last binary

git clone [<https://github.com/Canto-Network/Canto.git>](<https://github.com/Canto-Network/Canto.git>)
cd Canto
git checkout main && git pull
git checkout v5.0.0

go mod edit -replace github.com/tendermint/tm-db=github.com/notional-labs/tm-db@136c7b6
go mod tidy
go install -ldflags '-w -s -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb' -tags pebbledb ./...

Init node

CANTO_HOME="$HOME/.cantod"
CANTO_CHAIN="canto_7700-1" 

# save vars
echo "
CANTO_HOME=${CANTO_HOME}
CANTO_CHAIN=${CANTO_CHAIN}
" >> $HOME/.bash_profile

source $HOME/.bash_profile

# do init
cantod init node --chain-id $CANTO_CHAIN --home $CANTO_HOME

# genesis
rm $HOME/.cantod/config/genesis.json
wget -O $CANTO_HOME/config/genesis.json "<https://raw.githubusercontent.com/maxzonder/canto/main/genesis.json>"

Config


SEEDS=""
PEERS="[email protected]:32656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26666"
sed -i "s/^seeds *=.*/seeds = \\"$SEEDS\\"/; s/^persistent_peers *=.*/persistent_peers = \\"$PEERS\\"/" $CANTO_HOME/config/config.toml

sed -i "s/^minimum-gas-prices *=.*/minimum-gas-prices = \\"1000000000000acanto\\"/" $CANTO_HOME/config/app.toml

cantod config chain-id $CANTO_CHAIN --home $CANTO_HOME

db_backend="pebbledb"
sed -i "s/^db_backend *=.*/db_backend = \\"$db_backend\\"/" $CANTO_HOME/config/config.toml

Config pruning and snapshots

**# Set your desired pruning**

# pruning and snapshots
pruning_keep_recent="10000"
pruning_interval=$(shuf -n1 -e 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97)
snapshot_interval="5000"

sed -i "s/^pruning *=.*/pruning = \\"custom\\"/;\\
s/^pruning-keep-recent *=.*/pruning-keep-recent = \\"$pruning_keep_recent\\"/;\\
s/^pruning-interval *=.*/pruning-interval = \\"$pruning_interval\\"/;\\
s/^snapshot-interval *=.*/snapshot-interval = $snapshot_interval/" $CANTO_HOME/config/app.toml

Reset before start

# reset
cantod tendermint unsafe-reset-all --home $HOME/.cantod

Create and run service

# create service
tee $HOME/cantod.service > /dev/null <<EOF
[Unit]
  Description=cantod
  After=network-online.target
[Service]
  User=$USER
  ExecStart=$(which cantod) start --home $CANTO_HOME
  Restart=on-failure
  RestartSec=10
  LimitNOFILE=65535
[Install]
  WantedBy=multi-user.target
EOF

sudo mv $HOME/cantod.service /etc/systemd/system/

sudo systemctl enable cantod
sudo systemctl daemon-reload

Start from STATE-SYNC

SNAP_RPC="<https://canto-rpc.polkachu.com:443>"
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height)
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000))
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

sudo systemctl stop cantod

cantod tendermint unsafe-reset-all --home $CANTO_HOME --keep-addr-book

sed -i -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\\"|" $CANTO_HOME/config/config.toml

wget -O $HOME/.cantod/config/addrbook.json "<https://raw.githubusercontent.com/maxzonder/canto/main/addrbook.json>"

sudo systemctl start cantod && journalctl -u cantod -f -o cat

Create new key (or recover old one)

# create new key
cantod keys add $CANTO_WALLET --home $CANTO_HOME

**# !!!! SAVE MNEMONIC FROM OUTPUT !!!!**

# save addr and valoper to vars
CANTO_ADDR=$(cantod keys show $CANTO_WALLET -a --home $CANTO_HOME)

echo $CANTO_ADDR
echo 'export CANTO_ADDR='${CANTO_ADDR} >> $HOME/.bash_profile

CANTO_VALOPER=$(cantod keys show $CANTO_WALLET --bech val -a --home $CANTO_HOME)

echo $CANTO_VALOPER
echo 'export CANTO_VALOPER='${CANTO_VALOPER} >> $HOME/.bash_profile
source $HOME/.bash_profile