# Node Installation

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

* **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


# Set Vars
MONIKER=<YOUR_MONIKER_NAME_GOES_HERE>
echo "export MONIKER=$MONIKER" >> $HOME/.bash_profile
echo "export SELFCHAIN_CHAIN_ID="self-1"" >> $HOME/.bash_profile
echo "export SELFCHAIN_PORT="102"" >> $HOME/.bash_profile
source $HOME/.bash_profile


# Download Binary
cd $HOME
rm -rf selfchaind
wget https://snapshot2.syanodes.my.id/selfchain/selfchaind
chmod +x selfchaind
sudo mv selfchaind /usr/local/bin


# Config and Init App
selfchaind config node tcp://localhost:${SELFCHAIN_PORT}57
selfchaind config chain-id $SELFCHAIN_CHAIN_ID
selfchaind init $MONIKER --chain-id $SELFCHAIN_CHAIN_ID


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


#Configure Seeds and Peers
SEEDS="b307b56b94bd3a02fcad5b6904464a391e13cf48@128.199.33.181:26656,71b8d630e7c3e31f2743fda68e6d3ac64f41cece@209.97.174.97:26656,6ae10267d8581414b37553655be22297b2f92087@174.138.25.159:26656"
PEERS="6ae10267d8581414b37553655be22297b2f92087@174.138.25.159:26656,b307b56b94bd3a02fcad5b6904464a391e13cf48@128.199.33.181:26656,34c3a8a2955b4d6e5deef15c6b091250f5878afe@18.117.74.150:26656,4c8b8296e767cf3d67355dba98781ee0348e87ea@144.76.30.94:30056,c139f537755d5614a3ceaeb0f01b03be94e7ecb5@162.19.171.121:26656,6a3a0db2763d8222d00af55cbbe35824a39c8292@176.9.183.45:34656,e22a53afe2caa3aafae89edec68531e5dffa071f@188.40.72.97:26656,7a9038d1efd34c7f3baea17d8822262a981568b1@217.182.136.79:30156,f238d6a52578975198ceac2b0c2b004d49d5613f@88.198.5.77:31656,8401cbf633c496e464a2d016b333f61ff34e9ee9@167.71.233.135:26656,aab5f0267427d9dbd840fd04e634a02837d44365@51.77.20.28:25565,c743758973f5543578949228ff623918a4b43c54@165.232.177.11:26656,e5b970c7b4e9b0281fc2fc58166c9e9af476c9a3@46.4.23.120:58656,0a67ac1518c816e1927554dfc17c47f4ee457bcb@168.119.75.88:36656,2f547f93392d7351c74a0d8cae1d44f172cf32e5@64.227.156.23:26656,55d3e1761d6752eeb72b8b86decbca0d56f6a885@159.89.173.150:26656,02982b993b659c377238db477ae3698065ebc941@13.250.113.56:26656,9512a59cf93b987aff830148421a514cacb8a1b8@170.64.141.15:26656,024aa95bbdcef24d8d55c04f9c4de2fec2bc3bf6@34.159.240.168:26656,5fec0f158870a9e82e8a48fed83a78d567fb639a@167.235.12.38:22156,7efdc46e50e03e1f1208c8f276047b7fea345cc8@34.159.40.118:26656,62771c2083623cb6db6eda99f404036759c5f4b3@65.109.99.157:16609,a96b7c56cb64c16917a629c9ae0f3b3c0aea584c@35.234.89.188:26656,b844793daeffaedfcdbd5b08688cd10e1859d678@37.120.245.116:26656,790544e857cfe673cab570668131aa7ae2be7e5d@178.63.100.102:26656,a0c70d4dcce7b979faaa375a21300efd03001c99@34.48.99.116:26656,c87c1b17045b27fd14b13d7dbb3469a2248cb1f7@95.217.204.58:24356,637077d431f618181597706810a65c826524fd74@5.9.151.56:24356,d93bbc2d467800a10581d38261041d7dc0bcc4cd@158.220.90.61:26656,e097dc629cbe874b139841dedb06775cc75435ee@65.108.237.188:20656,7bad33a03bec7c0bd174a386045d5ff583b39570@95.216.7.84:36656,c1499d43cf198e2bc5490b9e2018ef22cd657d89@65.108.81.240:26656,d0478546164151adfc225ebc52509736bb05375a@173.234.17.129:26656,ee1265e95bcbfbeff7d096befe17e24c88549c65@65.108.9.83:11356,f282af2ba286abb9d4aab611a8f39176c26d6928@213.239.207.175:61656,e9376f40ac2b672e9f2f66ad212f59801d53afe8@178.162.165.193:26656,9d7dbaa0cb7f28ab8926c738860c18bd6d00aaaf@168.119.75.89:26656,c597aa118302d417e039e5a81d722422e73c85e1@135.125.67.227:26656,a950d48fce4a648aacf7327198e6ea3e545f3112@168.119.166.138:26656,e3edeec5261ec00ba4a87cdd419f601ee5e5e063@109.199.118.239:11356,473303f1a0dff43121cff9b7a12b5b39a42bc46c@37.27.31.253:26656,75f56904bf31a89b4b085eeaaf0fcea04311abed@113.176.142.7:10056,923758c6f7adaec3c9a668dc74ba28fda7066b1c@65.109.120.211:24656,c91ca713d48dac1ac940da53db1ff99cedb3f171@154.38.172.102:10256"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.selfchain/config/config.toml
sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.005uslf\"/" $HOME/.selfchain/config/app.toml
sed -i -e 's|^indexer *=.*|indexer = "null"|' $HOME/.selfchain/config/config.toml
sed -i 's|^prometheus *=.*|prometheus = true|' $HOME/.selfchain/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/.selfchain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.selfchain/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.selfchain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.selfchain/config/app.toml


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


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

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

[Install]
WantedBy=multi-user.target
EOF


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

## Auto Installation

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