January 13, 2023

Mars Protocol

Discord Website Faucet

  1. Server Preparation
  2. Working with a binary file and setting up
  3. Creating a validator and generating a wallet
  4. Useful commands
  5. Possible Errors

Есть возможность подать gentx:

  1. После инициализации и создания кошелька:
marsd genesis add-account <name_wallet> 1000000umars
marsd genesis gentx <name_wallet> 1000000000umars --output-document=gentx.json \
  --chain-id ares-1 \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --pubkey $(neutrond tendermint show-validator) \
  --moniker="<moniker-name>" \
  --website=<your-node-website> \
  --details=<your-node-details> \
  --min-self-delegation="1"

Просмотр gentx

cat ~/.mars/config/gentx/gentx-*

Форкаем https://github.com/mars-protocol/networks

Добавляем свой gentx и делаем pull request

1.Подготовка сервера - Server Preparation

Обновление и установка зависимостей - Upgrade and install dependencies

apt update && apt upgrade -y \

apt install curl iptables build-essential git wget jq make gcc nano tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y

Go

ver="1.19.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

2.Работа с бинарным файлом и настройка - Working with a binary file and setting up

Cloning a repository

git clone https://github.com/mars-protocol/hub.git
cd hub
git checkout 1.0.0-rc7
make install

Initializing

marsd init <name_moniler> --chain-id ares-1 && \
marsd config chain-id ares-1

Download genesis and address book

wget -O $HOME/.mars/config/genesis.json "https://raw.githubusercontent.com/mars-protocol/networks/main/ares-1/genesis.json"

Correct the configuration file

external_address=$(wget -qO- eth0.me)
sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:26656\"/" $HOME/.mars/config/config.toml

sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.025umars\"/;" ~/.mars/config/app.toml

PEERS="[email protected]:36656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26656,[email protected]:26653,5c2a752c9b1952dbed075c56c600c3a79b58c395@mars.testnet.peer.autostake.net:27056,[email protected]:26656,[email protected]:26656"
sed -i 's|^persistent_peers *=.*|persistent_peers = "'$peers'"|' $HOME/.mars/config/config.toml

seeds=""
sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.mars/config/config.toml

Create a service file

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

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

[Install]
WantedBy=multi-user.target
EOF

Launch

systemctl daemon-reload
systemctl enable marsd
systemctl restart marsd && journalctl -u marsd -f -o cat

3.Создание валидатора и генерация кошелька - Creating a validator and generating a wallet

Wallet

# создать кошелек
marsd keys add <name_wallet> --keyring-backend os

# восстановить кошелек (после команды вставить seed)
marsd keys add <name_wallet> --recover --keyring-backend os

Creating a validator

marsd tx staking create-validator \
--chain-id ares-1 \
--commission-rate 0.05 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.1 \
--min-self-delegation "1000000" \
--amount 1000000umars \
--pubkey $(nibid tendermint show-validator) \
--moniker "<name_moniker>" \
--from <name_wallet> \
--fees 5000umars

4. Удаление - Delete

Deleting

systemctl stop marsd && \
systemctl disable marsd && \
rm /etc/systemd/system/mars.service && \
systemctl daemon-reload && \
cd $HOME && \
rm -rf .mars marsd && \
rm -rf $(which marsd)

Useful Commands

# check the blocks
marsd status 2>&1 | jq ."SyncInfo"."latest_block_height"

# check the logs
journalctl -u marsd -f -o cat

# check status
curl localhost:26657/status

# check the balance
marsd q bank balances <address>

Useful commands for validator and delegator

# collect rewards from all validators that you have delegated to (without commission)
marsd tx distribution withdraw-all-rewards --from <name_wallet> --fees 5000umars -y

# collect revards from a separate validator or collect revards + commission from your validator
marsd tx distribution withdraw-rewards <valoper_address> --from <name_wallet> --fees 5000umars --commission -y

# to allocate more to the steak (this is how 1 coin is sent)
marsd tx staking delegate <valoper_address> 1000000umars --from <name_wallet> --fees 5000umars -y

# redeleting to another validator
marsd tx staking redelegate <src-validator-addr> <dst-validator-addr> 1000000umars --from <name_wallet> --fees 5000umars -y

# unbond 
marsd tx staking unbond <addr_valoper> 1000000umars --from <name_wallet> --fees 5000umars -y

# send coins to another address
marsd tx bank send <name_wallet> <address> 1000000umars --fees 5000umars -y

# get out of jail
marsd tx slashing unjail --from <name_wallet> --fees 5000umars -y

Proposal

# list of proposals
marsd q gov proposals

# to see the result of the vote
marsd q gov proposals --voter <ADDRESS>

# vote for proposal 
marsd tx gov vote 1 yes --from <name_wallet> --fees 555umars

# make a deposit to the proposal
marsd tx gov deposit 1 1000000umars --from <name_wallet> --fees 555umars

Edit validator

marsd tx staking edit-validator \
--chain-id "CHAIN_NAME" \
--moniker "MONIKER" \
--identity "IDENTITY" \
--details "DETAILS" \
--from "WALLET_NAME"