# Node Installation

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

* **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.20.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"
[ ! -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


# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export STAFIHUB_CHAIN_ID="stafihub-1"" >> $HOME/.bash_profile
echo "export STAFIHUB_PORT="100"" >> $HOME/.bash_profile
source $HOME/.bash_profile


# Download Binary
cd $HOME
rm -rf stafihub
git clone https://github.com/stafihub/stafihub
cd stafihub
git checkout v0.5.0
make install


# Config and Init App
stafihubd config node tcp://localhost:${STAFIHUB_PORT}57
stafihubd config keyring-backend file
stafihubd config chain-id $STAFIHUB_CHAIN_ID
stafihubd init $MONIKER --chain-id $STAFIHUB_CHAIN_ID


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


#Configure Seeds and Peers
SEEDS=""
PEERS="4ef1b0675641c3bb507356004ed9dcd4c901bd29@65.109.112.170:36656,a5f1489f5d250c8516f13b625226e5ad0af1a16a@65.108.106.131:26666,722c8b02d40d017d76dbb390c8290ae1d24a4665@34.230.84.121:26656,b16a5d941f3c4086bac4bb0ba419d92614202933@47.236.9.84:26656,1ffd9b533b37c58ad651c80cd404689b0800d17f@185.252.220.88:26656,23713826f39eef7ecc8b057fd19345634a1177e1@52.28.96.113:26656,bdd81fda6021be566293509c60968c015cde2315@15.235.119.114:26656,20c0b45c47426c51b3187aa5dca82d9900c2fb36@65.108.5.184:26656,045fe6e054a5abe35f5433bd333f0a1b18aa28cf@45.136.28.11:26656,3aeb3273b60ec8602f5ab2e4cc493ab99554cf44@158.160.7.35:26656,b747cb4906e0dee3f8d937738d36ae8314214cd8@141.95.103.59:26656,a1395521de6111c74cc634c414489f01b2250411@142.132.248.214:26656,767770c8d079687458e49b952783c92d967b2034@65.108.130.246:26656,b6d95e8c295092fab1f9fafbca024a427def8709@135.125.180.36:46656,fac8d4eace04557d518c9275f0e75fcf42d1a013@57.128.133.10:26656,dabf5766124e627dfc344eb7b47fdc75a6f406d5@144.202.9.124:15500,bed296dfadd972ed07cab82c87a0ee5c182dea43@18.136.189.120:26656,2a8762cd32c4d49ef018c9bb0176492237d59142@178.63.41.154:30400,c281d1a4903fc7bf63cdc8ca53ed7182f11332e8@141.95.66.226:15500,59bb809fa8ee7d69caf0e9d87f9bb3407703b5b9@54.234.35.56:26656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.stafihub/config/config.toml
sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0ufis\"/" $HOME/.stafihub/config/app.toml
sed -i -e 's|^indexer *=.*|indexer = "null"|' $HOME/.stafihub/config/config.toml
sed -i 's|^prometheus *=.*|prometheus = true|' $HOME/.stafihub/config/config.toml


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


# Set Custom Port
sed -i -e "s%:1317%:${STAFIHUB_PORT}17%; s%:8080%:${STAFIHUB_PORT}80%; s%:9090%:${STAFIHUB_PORT}90%; s%:9091%:${STAFIHUB_PORT}91%; s%:8545%:${STAFIHUB_PORT}45%; s%:8546%:${STAFIHUB_PORT}46%; s%:6065%:${STAFIHUB_PORT}65%" $HOME/.stafihub/config/app.toml
sed -i -e "s%:26658%:${STAFIHUB_PORT}58%; s%:26657%:${STAFIHUB_PORT}57%; s%:6060%:${STAFIHUB_PORT}60%; s%:26656%:${STAFIHUB_PORT}56%; s%:26660%:${STAFIHUB_PORT}61%" $HOME/.stafihub/config/config.toml


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

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

[Install]
WantedBy=multi-user.target
EOF


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

## Auto Installation

```
wget https://snapshot.syanodes.my.id/auto/mainnet/stafihub_auto && chmod +x stafihub_auto && ./stafihub_auto
```
