Skip to main content

Airchains

Endpoints

API: https://airchains-v-testnet-api.kgnodes.xyz

RPC: https://airchains-v-testnet-rpc.kgnodes.xyz

Explorer: https://explorer.kgnodes.xyz/Airchains-Testnet

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.6" # Make sure that this version does not broke any other apps you run!
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"
[ ! -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 AIRCHAIN_PORT="52"" >> $HOME/.bash_profile
source $HOME/.bash_profile

Downloading and installing node

cd $HOME
wget -O junctiond https://github.com/airchains-network/junction/releases/download/v0.3.1/junctiond-linux-amd64
chmod +x junctiond
mv junctiond $HOME/go/bin/

Initializing the node

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
junctiond init your-moniker --chain-id varanasi-1
sed -i -e "s|^node *=.*|node = \"tcp://localhost:${AIRCHAIN_PORT}657\"|" $HOME/.junctiond/config/client.toml

Downloading genesis and addressbook

wget -O $HOME/.junctiond/config/genesis.json https://snapshot.kgnodes.xyz/snapshot/junctiond/genesis.json
wget -O $HOME/.junctiond/config/addrbook.json  https://snapshot.kgnodes.xyz/snapshot/junctiond/addrbook.json

Setting seeds and peers

SEEDS=""
PEERS="[email protected]:30856,[email protected]:41656,[email protected]:36656,[email protected]:26656,[email protected]:56256,[email protected]:19656,[email protected]:19656,[email protected]:26756,[email protected]:19656,[email protected]:24656"
sed -i -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*seeds *=.*/seeds = \"$SEEDS\"/}" \
-e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*persistent_peers *=.*/persistent_peers = \"$PEERS\"/}" $HOME/.junctiond/config/config.toml

Setting custom ports

Updating ports in app.toml

sed -i.bak -e "s%:1317%:${AIRCHAIN_PORT}317%g;
s%:8080%:${AIRCHAIN_PORT}080%g;
s%:9090%:${AIRCHAIN_PORT}090%g;
s%:9091%:${AIRCHAIN_PORT}091%g;
s%:8545%:${AIRCHAIN_PORT}545%g;
s%:8546%:${AIRCHAIN_PORT}546%g;
s%:6065%:${AIRCHAIN_PORT}065%g" $HOME/.junctiond/config/app.toml

Updating ports in config.toml

sed -i.bak -e "s%:26658%:${AIRCHAIN_PORT}658%g;
s%:26657%:${AIRCHAIN_PORT}657%g;
s%:6060%:${AIRCHAIN_PORT}060%g;
s%:26656%:${AIRCHAIN_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${AIRCHAIN_PORT}656\"%;
s%:26660%:${AIRCHAIN_PORT}660%g" $HOME/.junctiond/config/config.toml

Configuring pruning settings

sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.junctiond/config/app.toml 
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.junctiond/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"10\"/" $HOME/.junctiond/config/app.toml

Setting gas and other configurations

sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.001uamf"|g' $HOME/.junctiond/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.junctiond/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.junctiond/config/config.toml

Creating service file

sudo tee /etc/systemd/system/junctiond.service > /dev/null <<EOF
[Unit]
Description=Airchains node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.junctiond
ExecStart=$(which junctiond) start --home $HOME/.junctiond
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 junctiond

Snapshot (Every 6 hrs)

sudo systemctl stop junctiond

cp $HOME/.junctiond/data/priv_validator_state.json $HOME/.junctiond/priv_validator_state.json.backup

junctiond tendermint unsafe-reset-all --home $HOME/.junctiond --keep-addr-book
curl https://snapshot.kgnodes.xyz/snapshot/junctiond/snap_junctiond.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.junctiond


mv $HOME/.junctiond/priv_validator_state.json.backup $HOME/.junctiond/data/priv_validator_state.json

sudo systemctl restart junctiond
sudo journalctl -u junctiond -f --no-hostname -o cat

Wallet

Creating a New Wallet

junctiond keys add <wallet_name> 

Importing existing wallet

junctiond keys add wallet-name --recover

Check Sync Status

junctiond status 2>&1 | jq 

Check Wallet Balance

junctiond query bank balances wallet-adress

Creating Validator

#Creating validator.json file
cd $HOME
echo "{\"pubkey\":{\"@type\":\"/cosmos.crypto.ed25519.PubKey\",\"key\":\"$(junctiond comet show-validator | grep -Po '\"key\":\s*\"\K[^"]*')\"},
\"amount\": \"1000000uamf\",
\"moniker\": \"your-moniker\",
\"identity\": \"\",
\"website\": \"\",
\"security\": \"\",
\"details\": \"\",
\"commission-rate\": \"0.1\",
\"commission-max-rate\": \"0.2\",
\"commission-max-change-rate\": \"0.01\",
\"min-self-delegation\": \"1\"
}" > validator.json

#Now create a validator using json file
junctiond tx staking create-validator validator.json \
--from wallet-name \
--chain-id varanasi-1 \
--fees 5000uamf

Self-Delegating

junctiond tx staking delegate $(junctiond keys show wallet --bech val -a) 1000000uamf --from wallet --chain-id varanasi-1 --fees 5000uamf  -y 

Deleting the Node

sudo systemctl stop junctiond
sudo systemctl disable junctiond
sudo rm -rf /etc/systemd/system/junctiond.service
sudo rm $(which junctiond)
sudo rm -rf $HOME/.junctiond
sed -i "/AIRCHAIN_/d" $HOME/.bash_profile