May 15, 2024
Airchains (validator setup guide and network monitoring system)
Airchains is a Modular zk Rollup SDK that ensures better scalability in comparison to conventional Rollup solutions.
----------------------------------------------------------------------------------------
sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev libleveldb-dev jq build-essential bsdmainutils git make ncdu htop screen unzip bc fail2ban htop -y
wget https://golang.org/dl/go1.20.linux-amd64.tar.gz sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
cat <<EOF >> ~/.profile export GOROOT=/usr/local/go export GOPATH=$HOME/go export GO111MODULE=on export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin EOF source ~/.profile go version
The output should be:go version go1.20 linux/amd64
wget -O junctiond https://github.com/airchains-network/junction/releases/download/v0.1.0/junctiond chmod +x junctiond mv junctiond $HOME/go/bin/
Specify variables, for ease of work:
AIRCHAINS_MONIKER="YourValidatorName" AIRCHAINS_WALLET="YourWalletName"
echo 'export AIRCHAINS_MONIKER='${AIRCHAINS_MONIKER} >> $HOME/.profile echo 'export AIRCHAINS_WALLET='${AIRCHAINS_WALLET} >> $HOME/.profile source $HOME/.profile
junctiond init $AIRCHAINS_MONIKER --chain-id junction
junctiond config chain-id junction && \ peers="d1c949abeb7805546eca0b5e60c4889649760b9c@rpc.airchains.stakeup.tech:13356" && \ sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.junction/config/config.toml && \ seeds="6b0ffcce9b59b91ceb8eea5d4599e27707e3604a@seeds.stakeup.tech:10219" && \ sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.junction/config/config.toml
junctiond keys add $AIRCHAINS_WALLET
Or restore if there is a mnemonic:
junctiond keys add $AIRCHAINS_WALLET --recover
wget -O genesis.json "https://snapshots.stakeup.tech/airchains/genesis.json" --inet4-only mv genesis.json ~/.junction/config
cd $HOME/.junction/config && \ indexer="null" && \ snapshot_interval="0" && \ pruning="custom" && \ pruning_keep_recent="1000" && \ pruning_keep_every="0" && \ pruning_interval="50" && \ sed -i.bak -e "s/^indexer *=.*/indexer = \"$indexer\"/" config.toml && \ sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$snapshot_interval\"/" app.toml && \ sed -i.bak -e "s/^pruning *=.*/pruning = \"$pruning\"/" app.toml && \ sed -i.bak -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" app.toml && \ sed -i.bak -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" app.toml && \ sed -i.bak -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" app.toml
cd $HOME/.junction/config && \ sed -i.bak -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:26653\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:26652\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:6061\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:26651\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":26655\"%" config.toml && \ sed -i.bak -e "s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:9092\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:9093\"%" app.toml && \ echo 'export NODE=http://localhost:26652' >> $HOME/.bash_profile && \ source $HOME/.bash_profile && \ junctiond config node $NODE
sudo tee /etc/systemd/system/junctiond.service > /dev/null <<EOF [Unit] Description=junction After=network-online.target [Service] User=$USER ExecStart=$(which junctiond) start Restart=on-failure RestartSec=3 LimitNOFILE=65535 [Install] WantedBy=multi-user.target EOF
sudo systemctl daemon-reload && sudo systemctl enable junctiond && sudo systemctl restart junctiond && sudo journalctl -u junctiond -f -o cat
Running a node from a state sync (optional)
sudo systemctl stop junctiond && \ junctiond tendermint unsafe-reset-all --home /root/.junction --keep-addr-book
peers="d1c949abeb7805546eca0b5e60c4889649760b9c@rpc.airchains.stakeup.tech:13356" && \ sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" ~/.junction/config/config.toml && \ SNAP_RPC="https://rpc.airchains.stakeup.tech:443" && \ LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \ BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000)); \ TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) && \ echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH && \ sed -i.bak -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\"| ; \ s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.junction/config/config.toml
sudo systemctl restart junctiond && journalctl -u junctiond -f -o cat
Running a node from a snapshot (optional)
sudo systemctl stop junctiond.service
Backup priv_validator_state.json
cp $HOME/.junction/data/priv_validator_state.json $HOME/priv_validator_state.json
Remove old data in directory ~/.junction/data
rm -rf ~/. junction/data; \ mkdir -p ~/.junction/data; \ cd ~/.junction/data
wget http://snapshots.stakeup.tech/airchains/junction_latest.tar tar -xf junction_latest.tar -C $HOME/.junction/data/
Return your priv_validator_state.json
mv $HOME/priv_validator_state.json $HOME/.junction/data/priv_validator_state.json
wget -O $HOME/.junction/config/addrbook.json "https://snapshots.stakeup.tech/airchains/addrbook.json"
sudo systemctl restart junctiond && journalctl -u junctiond -f -o cat
Network monitoring system (optional)
sudo apt-get install jq sysstat bc smartmontools fdisk -y
mkdir status && \ cd status
Download the script and settings
wget https://raw.githubusercontent.com/landerosua/status/main/tendermint/node_status/cosmos.sh && \ wget https://raw.githubusercontent.com/landerosua/status/main/tendermint/node_status/cosmos.conf && \ wget https://raw.githubusercontent.com/landerosua/status/main/tendermint/node_status/name.conf
chmod +x cosmos.sh
CHAT_ID_ALARM="you_id_chat_for_alarm_messages(telegram)"
CHAT_ID_STATUS="you_id_chat_for_log_messages(telegram)"
BOT_TOKEN="you_bot_token(telegram bot)"
VALIDATOR_ADDRESS="you_valoper_address"
DELEGATOR_ADDRESS="you_wallet"
MONIKER="you_validator_moniker"
Updating and configuring settings in files
mv name.conf airchains.conf && \ sed -i 's,# CURL=,CURL=, g' $HOME/status/airchains.conf && \ sed -i "s/^SERVER *=.*/SERVER = \"Airchains\"/" $HOME/status/cosmos.conf && \ sed -i "s/^CHAT_ID_ALARM *=.*/CHAT_ID_ALARM = \"$CHAT_ID_ALARM\"/" $HOME/status/cosmos.conf && \ sed -i "s/^BOT_TOKEN *=.*/BOT_TOKEN = \"$BOT_TOKEN\"/" $HOME/status/cosmos.conf && \ sed -i "s/^MONIKER *=.*/MONIKER = \"$MONIKER\"/" $HOME/status/airchains.conf && \ sed -i 's,https://api-cosmos.cosmostation.io/v1/status/,https://api.airchains.stakeup.tech/cosmos/base/tendermint/v1beta1/blocks/latest, g' $HOME/status/airchains.conf && \ sed -i "s/^DELEGATOR_ADDRESS *=.*/DELEGATOR_ADDRESS = \"$DELEGATOR_ADDRESS\"/" $HOME/status/airchains.conf && \ sed -i "s/^VALIDATOR_ADDRESS *=.*/VALIDATOR_ADDRESS = \"$VALIDATOR_ADDRESS\"/" $HOME/status/airchains.conf && \ sed -i "s/^TOKEN *=.*/TOKEN = \"amf\"/" $HOME/status/airchains.conf && \ sed -i "s/^DENOM *=.*/DENOM = \"1000000\"/" $HOME/status/airchains.conf && \ sed -i "s/^PROJECT *=.*/PROJECT = \"airchains-testnet\"/" $HOME/status/airchains.conf && \ sed -i 's,/root/go/bin/cosmosd,/root/go/bin/junctiond, g' $HOME/status/airchains.conf && \ sed -i 's,/root/.cosmos/config/,/root/.junction/config/, g' $HOME/status/airchains.conf && \ sed -i "s/^CHAT_ID_ALARM *=.*/CHAT_ID_ALARM = \"$CHAT_ID_ALARM\"/" $HOME/status/airchains.conf && \ sed -i "s/^CHAT_ID_STATUS *=.*/CHAT_ID_STATUS = \"$CHAT_ID_STATUS\"/" $HOME/status/airchains.conf && \ sed -i "s/^BOT_TOKEN *=.*/BOT_TOKEN = \"$BOT_TOKEN\"/" $HOME/status/airchains.conf
crontab -e
Adding a line
1,11,21,31,41,51 * * * * bash $HOME/status/cosmos.sh >> $HOME/status/cosmos.log 2>&1
Useful links
Website - https://www.airchains.io/
Discord - https://discord.gg/airchains
Twitter - https://twitter.com/airchains_io
Github - https://github.com/airchains-network