Manual Installation
Let's explore the manual installation process as we set up a node with Cosmovisor!
Install Dependencies
Update system package and install build tools
sudo apt -q update
sudo apt -qy install curl git jq lz4 build-essential fail2ban ufw unzip
sudo apt -qy upgrade
Secure Setup
π’
This step is optional, and you can choose to skip ahead to configure moniker.
Setup ssh for mantra user replace YOUR_PUBLIC_SSH_KEY with your own!
sudo adduser mantra --disabled-password -q
sudo usermod -aG sudo mantra
sudo -u mantra bash -c 'mkdir -p ~/.ssh && echo "YOUR_PUBLIC_SSH_KEY" >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys'
Configure Moniker
Replace <your-moniker-name> with your own validator name
MONIKER="<your-moniker-name>"
Install Go
install go version 1.20.10
sudo rm -rf /usr/local/go
curl -Ls https://go.dev/dl/go1.20.10.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
eval $(echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee /etc/profile.d/golang.sh)
eval $(echo 'export PATH=$PATH:$HOME/go/bin' | tee -a $HOME/.profile)
Build Binaries
Note: mantrachain binaries needs libwasmvm.x86_64.so
installed on your systemd to run the binaries
Download libwasmvm.x86_64.so file
sudo wget -O /usr/lib/libwasmvm.x86_64.so https://github.com/CosmWasm/wasmvm/releases/download/v1.3.0/libwasmvm.x86_64.so
Download mantrachain binaries
cd $HOME
wget https://github.com/MANTRA-Finance/public/releases/download/v3.0.0/mantrachaind-3.0.0-linux-amd64.tar.gz
tar -xvf mantrachaind-3.0.0-linux-amd64.tar.gz && rm -rf mantrachaind-3.0.0-linux-amd64.tar.gz
chmod +x mantrachaind
Latest commit : 3620d20
Prepare binaries for cosmovisor
mkdir -p $HOME/.mantrachain/cosmovisor/genesis/bin
mv mantrachaind $HOME/.mantrachain/cosmovisor/genesis/bin/
Create symlinks
sudo ln -s $HOME/.mantrachain/cosmovisor/genesis $HOME/.mantrachain/cosmovisor/current -f
sudo ln -s $HOME/.mantrachain/cosmovisor/current/bin/mantrachaind /usr/local/bin/mantrachaind -f
Cosmovisor Setup
Install cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0
Create Service
Create a systemd service
sudo tee /etc/systemd/system/mantra.service > /dev/null << EOF
[Unit]
Description=mantra node service
After=network-online.target
[Service]
User=$USER
ExecStart=$(which cosmovisor) run start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.mantrachain"
Environment="DAEMON_NAME=mantrachaind"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.mantrachain/cosmovisor/current/bin"
[Install]
WantedBy=multi-user.target
EOF
Enable Service
Enable mantra systemd service
sudo systemctl daemon-reload
sudo systemctl enable mantra
Initialize Node
Setting node configuration
mantrachaind config set client chain-id mantra-hongbai-1
mantrachaind config set client keyring-backend test
mantrachaind config set client node tcp://localhost:22257
Initialize node
mantrachaind init $MONIKER --chain-id mantra-hongbai-1
Download Genesis & Addrbook
Download genesis & addrbook file
curl -Ls https://snap.nodex.one/mantra-testnet/genesis.json > $HOME/.mantrachain/config/genesis.json
curl -Ls https://snap.nodex.one/mantra-testnet/addrbook.json > $HOME/.mantrachain/config/addrbook.json
sha256sum genesis.json
: e9ea8a48d43f9a666032b1df21f160b42c069a9b1b5bd71435ab307bd3304b0a
Configure Seeds
Setting up a seed peers
sed -i -e "s|^seeds *=.*|seeds = \"d1d43cc7c7aef715957289fd96a114ecaa7ba756@testnet-seeds.nodex.one:22210\"|" $HOME/.mantrachain/config/config.toml
Configure Gas Prices
Setting up a gas prices
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0.025uom\"|" $HOME/.mantrachain/config/app.toml
Pruning Setting
Configure pruning setting
sed -i \
-e 's|^pruning *=.*|pruning = "custom"|' \
-e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
-e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
-e 's|^pruning-interval *=.*|pruning-interval = "19"|' \
$HOME/.mantrachain/config/app.toml
Custom Port
Please note that updating the port is optional!
Configure a custom port
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:22258\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:22257\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:22260\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:22256\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":22266\"%" $HOME/.mantrachain/config/config.toml
sed -i -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:22217\"%; s%^address = \":8080\"%address = \":22280\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:22290\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:22291\"%; s%:8545%:22245%; s%:8546%:22246%; s%:6065%:22265%" $HOME/.mantrachain/config/app.toml
Download Snapshots
Download latest chain snapshot
curl -L https://snap.nodex.one/mantra-testnet/mantra-latest.tar.lz4 | tar -Ilz4 -xf - -C $HOME/.mantrachain
[[ -f $HOME/.mantrachain/data/upgrade-info.json ]] && cp $HOME/.mantrachain/data/upgrade-info.json $HOME/.mantrachain/cosmovisor/genesis/upgrade-info.json
Start Service
Letss f*cking goooo!
sudo systemctl start mantra