Skip to main content

Airchains

Endpoints

APIRPCgRPC
junction.api.kgnodes.xyzjunction.rpc.kgnodes.xyzjunction.grpc.kgnodes.xyz:11093

Explorer: explorer.kgnodes.xyz/airchains

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.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 WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="kgnodesWASHERE"" >> $HOME/.bash_profile
echo "export AIRCHAINS_CHAIN_ID="junction"" >> $HOME/.bash_profile
echo "export AIRCHAINS_PORT="13"" >> $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.1.0/junctiond
chmod +x junctiond
mv junctiond $HOME/go/bin/

Initializing the node

junctiond init $MONIKER --chain-id $AIRCHAINS_CHAIN_ID
sed -i -e "s|^node *=.*|node = \"tcp://localhost:${AIRCHAINS_PORT}657\"|" $HOME/.junction/config/client.toml

Downloading genesis and addressbook

cd $HOME
curl https://junction.rpc.kgnodes.xyz/genesis | jq ".result.genesis" > .junction/config/genesis.json
wget -O $HOME/.junction/config/addrbook.json http://snapshots.ngsolutions.xyz/addrbook/airchains/addrbook.json

Setting seeds and peers

PEERS="11dbcb884666395524db7f5af26a9101aff51982@11dbcb884666395524db7f5af26a9101aff51982:43456,1a91c08b0154512ca28f32a04c6d52b0bc0a5d68@1a91c08b0154512ca28f32a04c6d52b0bc0a5d68:43456,ebaa262c9e6930152a05d66d2880898d330efd5c@ebaa262c9e6930152a05d66d2880898d330efd5c:43456,cc27f4e54a78b950adaf46e5413f92f5d53d2212@cc27f4e54a78b950adaf46e5413f92f5d53d2212:43456,eabd6509b8cce372e42eeb4c62fb530781b42bd8@eabd6509b8cce372e42eeb4c62fb530781b42bd8:63656,e2c7580464314c9d5d6972bef182d964ba39c519@e2c7580464314c9d5d6972bef182d964ba39c519:43456,68e01ac90e591cea46bad76c4fcb59c3bf21c01c@68e01ac90e591cea46bad76c4fcb59c3bf21c01c:43456,dd6d2a51fd1415045f4956e6a4948b9c7fb475e7@dd6d2a51fd1415045f4956e6a4948b9c7fb475e7:43456,56339f22f1d4cc633d7d442e10a714e561148721@56339f22f1d4cc633d7d442e10a714e561148721:43456,d972afc6c6327ba783ed3147dcc29293667cfb70@d972afc6c6327ba783ed3147dcc29293667cfb70:43456"
sed -i -e "s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.junction/config/config.toml

Setting custom ports

Updating ports in app.toml

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

Updating ports in config.toml

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

Configuring pruning settings

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

Setting gas and other configurations

sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.0025ujunction"|g' $HOME/.junction/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.junction/config/config.toml
sed -i 's/max_num_inbound_peers =.*/max_num_inbound_peers = 50/g' $HOME/.junction/config/config.toml
sed -i 's/max_num_outbound_peers =.*/max_num_outbound_peers = 50/g' $HOME/.junction/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/.junction
ExecStart=$(which junctiond) start --home $HOME/.junction --chain-id $AIRCHAINS_CHAIN_ID
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Snapshot

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!

# If you want to apply this snap after installing the node, first stop the node using following command
# systemctl stop junctiond

cp $HOME/.junction/data/priv_validator_state.json $HOME/.junction/priv_validator_state.json.backup
cp $HOME/.junction/config/priv_validator_key.json $HOME/.junction/config/priv_validator_key.key.backup

junctiond tendermint unsafe-reset-all --home $HOME/.junction --keep-addr-book


cp $HOME/.junction/priv_validator_state.json.backup $HOME/.junction/data/priv_validator_state.json
cp $HOME/.junction/config/priv_validator_key.json.backup $HOME/.junction/config/priv_validator_key.key

# If you applied this snap after installing the node, then you can restart your node using following command
# Also visually inspect your logs. Your node is started to work again.
# systemctl start junctiond && journalctl -u junctiond -f --no-hostname -o cat

Enabling and starting the service.

# You need to inspect logs visually after the  to make sure that it is working
sudo systemctl daemon-reload
sudo systemctl enable junctiond
sudo systemctl restart junctiond && sudo journalctl -u junctiond -f

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.
junctiond keys add $WALLET

# If you want to import a wallet using mnemonics, execute following command and enter your mnemonics
junctiond keys add $WALLET --recover

# Get your keys and their addresses to request faucet
junciond 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.

junctiond status | jq -r .sync_info.catching_up

Creating a Validator:

The following snippet will create a validator.json file in your node's home directory. This file stores the details necessary to create your validator. While you can edit the validator.json file later, keep in mind that doing so may incur token fees. Therefore, it's important to ensure the information within the file is accurate before proceeding.

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

Next Steps:

Once you're satisfied with the contents of validator.json, you can proceed with creating the validator using the information stored within the file.

# Create a validator using the JSON configuration
junctiond tx staking create-validator validator.json \
--from $WALLET \
--chain-id $AIRCHAINS_CHAIN_ID \
--fees 200amf

Delegate to yourself

You might need to update number of tokens before executing the following command.

junctiond tx staking delegate \
$(junctiond keys show $WALLET --bech val -a) 1900000amf \
--from $WALLET \
--chain-id $AIRCHAINS_CHAIN_ID \
--fees=5000amf

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 junctiond
sudo systemctl disable junctiond
sudo rm -rf /etc/systemd/system/junctiond.service
sudo rm $(which junctiond)
sudo rm -rf $HOME/.junction
sed -i "/AIRCHAINS_/d" $HOME/.bash_profile