# Node Installation

### Hardware requirements The following requirements are recommended for running AIRCHAIN:

* **6 or more physical CPU cores**
* **At least 1TB of SSD disk storage**
* **At least 16GB of memory (RAM)**
* **At least 500mbps network bandwidth**

## Manual Installation

```bash
# Update & install dependencies
sudo apt update && sudo apt upgrade -y
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils git make ncdu gcc git jq htop tmux chrony liblz4-tool -y


# Install Go
cd $HOME
VER="1.22.2"
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
go version


#Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh 
rustc --version 

# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export AIR_CHAIN_ID="varanasi-1"" >> $HOME/.bash_profile
echo "export AIR_CHAIN_PORT="55"" >> $HOME/.bash_profile
source $HOME/.bash_profile


# Download 
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/


# Config and Init App
junctiond init $MONIKER --chain-id $AIR_CHAIN_ID


# Add Genesis File and Addrbook
wget -O $HOME/.junctiond/config/genesis.json https://testnet-files.syanodes.my.id/airchain-genesis.json
wget -O $HOME/.junctiond/config/addrbook.json https://testnet-files.syanodes.my.id/airchain-addrbook.json


#Configure Seeds and Peers
SEEDS=""
PEERS="db0ef38866b19583db494d7700908ab47c6eddf3@95.214.55.198:55656,9b709b70af46e71d0f468db599b8d3eaeb9905fc@95.214.55.31:34656,db686fcfdf0b4676d601d5beb11faee5ad96bff1@37.27.71.199:28656,ec7d3566e70f479a4a6dd98d1e02e8827cf34f76@72.251.3.24:56256, cfb052e64e508f4b40f0ec07b52a31abfda82270@95.217.62.179:11956, f84b41b95e828ee915aea19dd656cca7d39cf47b@37.17.244.207:33656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.junctiond/config/config.toml
sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.001uamf\"/" $HOME/.junctiond/config/app.toml
sed -i -e 's|^indexer *=.*|indexer = "null"|' $HOME/.junctiond/config/config.toml
sed -i 's|^prometheus *=.*|prometheus = true|' $HOME/.junctiond/config/config.toml


# Config Pruning
pruning="custom"
pruning_keep_recent="100"
pruning_keep_every="0"
pruning_interval="10"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.junctiond/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.junctiond/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.junctiond/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.junctiond/config/app.toml


# Set Custom Port
sed -i.bak -e "s%:1317%:${AIR_CHAIN_PORT}317%g;
s%:8080%:${AIR_CHAIN_PORT}080%g;
s%:9090%:${AIR_CHAIN_PORT}090%g;
s%:9091%:${AIR_CHAIN_PORT}091%g;
s%:8545%:${AIR_CHAIN_PORT}545%g;
s%:8546%:${AIR_CHAIN_PORT}546%g;
s%:6065%:${AIR_CHAIN_PORT}065%g" $HOME/.junctiond/config/app.toml
sed -i.bak -e "s%:26658%:${AIR_CHAIN_PORT}658%g;
s%:26657%:${AIR_CHAIN_PORT}657%g;
s%:6060%:${AIR_CHAIN_PORT}060%g;
s%:26656%:${AIR_CHAIN_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${AIR_CHAIN_PORT}656\"%;
s%:26660%:${AIR_CHAIN_PORT}660%g" $HOME/.junctiond/config/config.toml
sed -i \
  -e 's|^chain-id *=.*|chain-id = "varanasi-1"|' \
  -e 's|^node *=.*|node = "tcp://localhost:55657"|' \
  $HOME/.junctiond/config/client.toml


# Set Service File
sudo tee /etc/systemd/system/junctiond.service > /dev/null <<EOF
[Unit]
Description=airchain-testnet
After=network-online.target

[Service]
User=$USER
ExecStart=$(which junctiond) start --home $HOME/.junctiond
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF


# Enable and Start Service
sudo systemctl daemon-reload
sudo systemctl enable junctiond
sudo systemctl start junctiond
sudo journalctl -fu junctiond -o cat
```

## Auto Installation

```bash
wget https://snapshot.syanodes.my.id/auto/testnet/airchain_auto && chmod +x airchain_auto && ./airchain_auto && rm airchain_auto
```
