Mantra
Endpoints
API | RPC |
---|---|
https://mantra-testnet-api.kgnodes.xyz | https://mantra-testnet-rpc.kgnodes.xyz |
Explorer: https://https://explorer.kgnodes.xyz/mantra
Installation
You should update the MONIKER
, WALLET
, and PORT
variables in the Setting up environment variables section. Make sure the port you specify is not already in use.
Check for ports already in use by visually inspecting the output of the lsof -i -P -n | grep LISTEN
command. Almost all Cosmos chain nodes use ports xx317
, xx656
, xx657
, and xx090
. Therefore, avoid using ports starting with xx
if they are already occupied.
Update OS
sudo apt update && sudo apt upgrade -y
Installation of required packages
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
Installation of go (if you need)
cd ~
VER="1.21.5" # Make sure that this version does not broke any other apps you run!
wget "https://golang.org/dl/go$VER.linux-amd64.tar.gz"
rm -rf /usr/local/go
tar -C /usr/local -xzf "go$VER.linux-amd64.tar.gz"
rm "go$VER.linux-amd64.tar.gz"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin
Setting up environment variables
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="your-moniker"" >> $HOME/.bash_profile
echo "export MANTRA_CHAIN_ID="mantra-hongbai-1"" >> $HOME/.bash_profile
echo "export MANTRA_PORT="22"" >> $HOME/.bash_profile
source $HOME/.bash_profile
Downloading and installing node
cd $HOME
sudo wget -O /usr/lib/libwasmvm.x86_64.so https://github.com/CosmWasm/wasmvm/releases/download/v1.3.1/libwasmvm.x86_64.so
wget https://github.com/MANTRA-Finance/public/raw/main/mantrachain-hongbai/mantrachaind-linux-amd64.zip
unzip mantrachaind-linux-amd64.zip
rm mantrachaind-linux-amd64.zip
mv mantrachaind $HOME/go/bin
Initializing the node
mantrachaind config node tcp://localhost:${MANTRA_PORT}657
mantrachaind config keyring-backend os
mantrachaind config chain-id mantra-hongbai-1
mantrachaind init "moniker" --chain-id mantra-hongbai-1
Downloading genesis and addressbook
cd $HOME
wget -O $HOME/.mantrachain/config/genesis.json https://snapshot.kgnodes.xyz/snapshot/mantrachain/genesis.json
wget -O $HOME/.mantrachain/config/addrbook.json https://snapshot.kgnodes.xyz/snapshot/mantrachain/addrbook.json
Setting seeds and peers
SEEDS="a9a71700397ce950a9396421877196ac19e7cde0@mantra-testnet-seed.itrocket.net:22656"
PEERS="1a46b1db53d1ff3dbec56ec93269f6a0d15faeb4@mantra-testnet-peer.itrocket.net:22656,e1b058e5cfa2b836ddaa496b10911da62dcf182e@134.65.192.193:36656,3e1f8c5055aba409d2134139c0b3334269a6f617@65.21.252.181:26656,c6a28b964edbd6fe662bd07156cdb04b89886549@116.202.233.2:50056,33cf22311a510b01552fb1e323add74c641f01c5@65.109.62.39:18656,1addfb09e15c970c7f47bc881a000386fcb73086@165.232.115.148:26656,4cf0b553d5b66aab70ea5544cdea0c32224697aa@136.243.172.181:26656,364760d2d535d7b945c72ab65160a137ae7dce46@138.201.82.147:26656,3fa907f968ce8666cbf2accfbdc9f7d833156ef3@116.202.245.94:26656,19cbfb1c73a0c0f3534a8a0d65150b9e2caad07a@161.97.141.38:16656,e6921a8a228e12ebab0ab70d9bcdb5364c5dece5@65.108.200.40:47656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.mantrachain/config/config.toml
Setting custom ports
Updating ports in app.toml
sed -i.bak -e "s%:1317%:${MANTRA_PORT}317%g;
s%:8080%:${MANTRA_PORT}080%g;
s%:9090%:${MANTRA_PORT}090%g;
s%:9091%:${MANTRA_PORT}091%g;
s%:8545%:${MANTRA_PORT}545%g;
s%:8546%:${MANTRA_PORT}546%g;
s%:6065%:${MANTRA_PORT}065%g" $HOME/.mantrachain/config/app.toml
Updating ports in config.toml
sed -i.bak -e "s%:26658%:${MANTRA_PORT}658%g;
s%:26657%:${MANTRA_PORT}657%g;
s%:6060%:${MANTRA_PORT}060%g;
s%:26656%:${MANTRA_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${MANTRA_PORT}656\"%;
s%:26660%:${MANTRA_PORT}660%g" $HOME/.mantrachain/config/config.toml
Configuring pruning settings
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.mantrachain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.mantrachain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.mantrachain/config/app.toml
Setting gas and other configurations
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.0002uom"|g' $HOME/.mantrachain/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.mantrachain/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.mantrachain/config/config.toml
Creating service file
sudo tee /etc/systemd/system/mantrachaind.service > /dev/null <<EOF
[Unit]
Description=Mantra node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.mantrachain
ExecStart=$(which mantrachaind) start --home $HOME/.mantrachain
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
Enabling and starting the service
sudo systemctl daemon-reload
sudo systemctl enable mantrachaind
sudo systemctl restart mantrachaind && sudo journalctl -u mantrachaind -f
Snapshot
Latest Snapshot:
Size | Heigt | Time |
---|---|---|
1.2G | 1189001 | 2024-07-10 14:42 CEST |
Make sure to back up your priv_validator_key.json
file if you've already created a validator! Resetting your node without a backup will cause you to lose access and require creating a new validator from scratch. Be careful!
The following snippets create a copy of your priv_validator_state.json
and priv_validator_key.json
files. Then, it copies the old private files back after copying the snapshot files. However, you should execute these commands with caution to prevent any kind of failure!
sudo systemctl stop mantrachaind
cp $HOME/.mantrachain/data/priv_validator_state.json $HOME/.mantrachain/priv_validator_state.json.backup
cp $HOME/.mantrachain/config/priv_validator_key.json $HOME/.mantrachain/config/priv_validator_key.key.backup
mantrachaind tendermint unsafe-reset-all --home $HOME/.mantrachain --keep-addr-book
curl https://snapshot.kgnodes.xyz/snapshot/mantrachain/snap_mantrachain.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.mantrachain
cp $HOME/.mantrachain/priv_validator_state.json.backup $HOME/.mantrachain/data/priv_validator_state.json
cp $HOME/.mantrachain/config/priv_validator_key.json.backup $HOME/.mantrachain/config/priv_validator_key.key
sudo systemctl start mantrachaind && journalctl -u mantrachaind -f --no-hostname -o cat
Creating a wallet
You need to create or import a wallet to request test tokens. If you dont have any tokens, you will not be able to create a validator.
# Following command creates a new wallet.
# Copy mnemonics to a safe place
# If you lost your mnemonics you will not be able to recover this wallet.
mantrachaind keys add $WALLET
# If you want to import a wallet using mnemonics, execute following command and enter your mnemonics
mantrachaind keys add $WALLET --recover
# Get your keys and their addresses to request faucet
mantrachaind keys list
Creating a validator
Before you begin:
It's crucial to ensure your node is synchronized with the network before attempting to create a validator. This ensures your validator operates with the latest blockchain data.
Checking Synchronization Status:
Use the following snippet to check your node's synchronization status. If the snippet returns false
, your node is in sync and ready to proceed. However, if it returns true
, your node is still catching up. In that case, please wait until the synchronization completes before creating a validator.
mantrachaind status | jq -r .sync_info.catching_up
Creating a Validator:
mantrachaind tx staking create-validator \
--amount 1000000uom \
--from $WALLET \
--commission-rate 0.1 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.01 \
--min-self-delegation 1 \
--pubkey $(mantrachaind tendermint show-validator) \
--moniker "your-moniker" \
--identity "" \
--website "" \
--details "" \
--chain-id mantra-hongbai-1 \
--gas auto --gas-adjustment 1.5 --fees 50uom \
-y
Edit Validator:
mantrachaind tx staking edit-validator \
--commission-rate 0.1 \
--new-moniker "$MONIKER" \
--identity "" \
--details "" \
--from $WALLET \
--chain-id mantra-hongbai-1 \
--gas auto --gas-adjustment 1.5 --fees 50uom \
-y
Delegate to yourself
You might need to update number of tokens before executing the following command.
mantrachaind tx staking delegate $(mantrachaind keys show $WALLET --bech val -a) 1000000uom --from $WALLET --chain-id mantra-hongbai-1 --gas auto --gas-adjustment 1.5 --fees 50uom -y
Unjail Validator
mantrachaind tx slashing unjail --from $WALLET --chain-id mantra-hongbai-1 --gas auto --gas-adjustment 1.5 --fees 50uom -y
Deleting the node completely (if you need)
Make sure that you backed up any required files to setup later! Do not lost your validator or wallet!
sudo systemctl stop mantrachaind
sudo systemctl disable mantrachaind
sudo rm -rf /etc/systemd/system/mantrachaind.service
sudo rm $(which mantrachaind)
sudo rm -rf $HOME/.mantrachain
sed -i "/MANTRA_/d" $HOME/.bash_profile