April 16, 2024
Avail node setup
Prepair
# update repo apt update && sudo apt upgrade -y # install utilites apt install curl build-essential git wget jq make gcc tmux htop nvme-cli pkg-config libssl-dev libleveldb-dev tar clang bsdmainutils ncdu unzip libleveldb-dev -y # check ssd curl -sL yabs.sh | bash -s — -ig # check internet connectoin curl -sL yabs.sh | bash -s — -fg
# install and copy the config apt install fail2ban -y && \ cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local && \ nano /etc/fail2ban/jail.local # add your IP: ignoreip = 127.0.0.1/8 ::1 <ip> systemctl restart fail2ban # check status systemctl status fail2ban # check jails fail2ban-client status # check sshd fail2ban-client status sshd # logs tail /var/log/fail2ban.log # stop and delete autorun #systemctl stop fail2ban && systemctl disable fail2ban
ver="1.21.3" && \ 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
NEW INSTALL NODE
IMPORTANT! — in the commands below, we change everything in <> to our own value and remove <> ourselves
mkdir -p $HOME/crossfi && cd $HOME/crossfi #mkdir -p ~/go/bin wget https://github.com/crossfichain/crossfi-node/releases/download/v0.3.0-prebuild3/crossfi-node_0.3.0-prebuild3_linux_amd64.tar.gz tar -xvf crossfi-node_0.3.0-prebuild3_linux_amd64.tar.gz chmod +x $HOME/crossfi/bin/crossfid mv $HOME/crossfi/bin/crossfid $HOME/go/bin rm -rf crossfi-node_0.3.0-prebuild3_linux_amd64.tar.gz
crossfid version --long | grep -e version -e commit -e build # version: 0.3.0-prebuild3 # commit: 2a79e36277b951e733f905ec0f955335aa2fb493
crossfid init UTSA_guide --chain-id crossfi-evm-testnet-1
wget -O $HOME/.mineplex-chain/config/genesis.json "https://raw.githubusercontent.com/crossfichain/testnet/master/config/genesis.json" # check genesis sha256sum ~/.mineplex-chain/config/genesis.json # 935a2790b752dbc60091f2f52346094aaf6f741317a11772745bb5dd80054987
Check that the state of the validator at the initial stage
cd && cat .mineplex-chain/data/priv_validator_state.json { "height": "0", "round": 0, "step": 0 } # if no crossfid unsafe-reset-all --home $HOME/.mineplex-chain
wget -O $HOME/.mineplex-chain/config/addrbook.json "https://anode.team/CrossFi/test/addrbook.json"
Setup node configuratoin
# edit the config so that we can no longer use the chain-id flag for each CLI command in client.toml crossfid config chain-id crossfi-evm-testnet-1 # if necessary, configure the keyring-backend in client.toml crossfid config keyring-backend os # set the minimum price for gas in app.toml sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"5000000000mpx\"/;" ~/.mineplex-chain/config/app.toml # add seeds/bpeers/peers in config.toml external_address=$(wget -qO- eth0.me) sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:26656\"/" $HOME/.mineplex-chain/config/config.toml peers="" sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.mineplex-chain/config/config.toml seeds="dd83e3c7c4e783f8a46dbb010ec8853135d29df0@crossfi-testnet-seed.itrocket.net:36656" sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.mineplex-chain/config/config.toml # increase the number of incoming and outgoing peers for connection, with the exception of permanent peers in config.toml sed -i 's/max_num_inbound_peers =.*/max_num_inbound_peers = 40/g' $HOME/.mineplex-chain/config/config.toml sed -i 's/max_num_outbound_peers =.*/max_num_outbound_peers = 10/g' $HOME/.mineplex-chain/config/config.toml # setting up filtering for “bad” peers sed -i -e "s/^filter_peers *=.*/filter_peers = \"true\"/" $HOME/.mineplex-chain/config/config.toml
Create service file
tee /etc/systemd/system/crossfid.service > /dev/null <<EOF [Unit] Description=crossfid After=network-online.target [Service] User=$USER ExecStart=$(which crossfid) start Restart=on-failure RestartSec=3 LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF
systemctl daemon-reload systemctl enable crossfid systemctl restart crossfid && journalctl -u crossfid -f -o cat
If after the start the node cannot connect to peers for a long time, then we look for new peers or ask for addrbook.json in the discord
# stop node and delete data systemctl stop crossfid crossfid tendermint unsafe-reset-all --home ~/.mineplex-chain/ --keep-addr-book # restart node systemctl restart crossfid && journalctl -u crossfid -f -o cat
# create wallet crossfid keys add <name_wallet> --keyring-backend os # recover crossfid keys add <name_wallet> --recover --keyring-backend os # add ledger crossfid keys add <name_wallet> --ledger
crossfid tx staking create-validator \ --chain-id crossfi-evm-testnet-1 \ --commission-rate 0.05 \ --commission-max-rate 0.2 \ --commission-max-change-rate 0.1 \ --min-self-delegation "1000000" \ --amount 1000000000000000000mpx \ --pubkey $(crossfid tendermint show-validator) \ --moniker "<name_moniker>" \ --from <name_wallet> \ --fees 150000000000000000mpx \ --gas 300000 \ --gas-adjustment 1.3
Commands
# check blocks crossfid status 2>&1 | jq ."SyncInfo"."latest_block_height" # check logs sudo journalctl -u crossfid -f -o cat # check status curl localhost:26657/status # check balance crossfid q bank balances <address> # check validators pubkey crossfid tendermint show-validator # check validator crossfid query staking validator <valoper_address> crossfid query staking validators --limit 1000000 -o json | jq '.validators[] | select(.description.moniker=="<name_moniker>")' | jq # проверка информации по TX_HASH crossfid query tx <TX_HASH> # params connection crossfid q staking params crossfid q slashing params # check lost blocks crossfid q slashing signing-info $(crossfid tendermint show-validator) # check slashing crossfid q slashing signing-info $(crossfid tendermint show-validator) # check transaction of create validator (change your valoper_address) crossfid query txs --events='create_validator.validator=<your_valoper_address>' -o=json | jq .txs[0].txhash -r # check active set crossfid q staking validators -o json --limit=1000 \ | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' \ | jq -r '.tokens + " - " + .description.moniker' \ | sort -gr | nl # check inactive crossfid q staking validators -o json --limit=1000 \ | jq '.validators[] | select(.status=="BOND_STATUS_UNBONDED")' \ | jq -r '.tokens + " - " + .description.moniker' \ | sort -gr | nl
# withdraw your awards crossfid tx distribution withdraw-rewards <valoper_address> --from <name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 --commission -y # delegate in your validator crossfid tx staking delegate <valoper_address> 1000000mpx --from <name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 -y # redelegate in another validator crossfid tx staking redelegate <src-validator-addr> <dst-validator-addr> 1000000mpx --from <name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 -y # unbond crossfid tx staking unbond <addr_valoper> 1000000mpx --from <name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 -y # send tokens crossfid tx bank send <name_wallet> <address> 1000000mpx --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 -y # get out of jail crossfid tx slashing unjail --from <name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 -y
# list wallets crossfid keys list # check account key crossfid keys show <name_wallet> --bech acc # check validator key crossfid keys show <name_wallet> --bech val # check consensus key crossfid keys show <name_wallet> --bech cons # account request crossfid q auth account $(crossfid keys show <name_wallet> -a) -o text # delete wallet crossfid keys delete <name_wallet>
systemctl stop crossfid && \ systemctl disable crossfid && \ rm /etc/systemd/system/crossfid.service && \ systemctl daemon-reload && \ cd $HOME && \ rm -rf .mineplex-chain crossfi && \ rm -rf $(which crossfid)
# list proposals crossfid q gov proposals # check vote results crossfid q gov proposals --voter <ADDRESS> # vote crossfid tx gov vote 1 yes --from <name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 # depo in offer crossfid tx gov deposit 1 1000000mpx --from <name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3 # create offer crossfid tx gov submit-proposal --title="Randomly reward" --description="Reward 10 testnet participants who completed more than 3 tasks" --type="Text" --deposit="11000000grain" --from=<name_wallet> --fees 150000000000000000mpx --gas 300000 --gas-adjustment 1.3
FOLDER=.mineplex-chain # check your peer PORTR=$(grep -A 3 "\[p2p\]" ~/$FOLDER/config/config.toml | egrep -o ":[0-9]+") && \ echo $(crossfid tendermint show-node-id)@$(wget -qO- eth0.me)$PORTR # check your RPC echo -e "\033[0;32m$(grep -A 3 "\[rpc\]" ~/$FOLDER/config/config.toml | egrep -o ":[0-9]+")\033[0m" # check peer connections PORT= curl -s http://localhost:$PORT/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr | split(":")[2])"' | wc -l # list of moniker curl -s http://localhost:$PORT/net_info | jq '.result.peers[].node_info.moniker' # check prevotes/precommits curl -s localhost:$PORT/consensus_state | jq '.result.round_state.height_vote_set[0].prevotes_bit_array' && \ curl -s localhost:$PORT/consensus_state | jq '.result.round_state.height_vote_set[0].precommits_bit_array' # check prevote of your validator curl -s localhost:$PORT/consensus_state -s | grep $(curl -s localhost:26657/sta