# Installation

## H**ardware Requirements**

<table><thead><tr><th>Node Type</th><th width="155">CPU</th><th width="160">RAM</th><th>Storage</th></tr></thead><tbody><tr><td>Mainnet</td><td>4</td><td>8 GB</td><td>200GB (SSD or NVME)</td></tr></tbody></table>

## Server preparation

1. **Update your system packages:**

```
sudo apt update && sudo apt upgrade -y
```

2. **Install essential dependencies**:.

```
sudo apt install curl tar wget clang pkg-config libssl-dev jq build-essential bsdmainutils git make ncdu gcc git jq chrony liblz4-tool -y
```

3. **Install Go** 1.23.1 (required for building Stargaze):

```
ver="1.23.1"
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"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version
```

***

## Build Stargaze Node

1. **Clone Stargaze Git repository**:

```
cd $HOME
git clone https://github.com/public-awesome/stargaze stargaze
cd stargaze
```

2. **Checkout the desired version**:

```
git checkout v16.0.0
```

3. **Build the Stargaze node**:

```
make install
```

4. **Check the version**:

```
starsd version --long | grep -e commit -e version
```

> Expected output:
>
> * **version:** 16.0.0
> * **commit:** 08a5ac1e53ba4935cb45c5390e9f23abf60654c8

***

## Node Initialization

1. **Set your moniker** (validator name) by replacing `<moniker>` with your desired name:

```
starsd init <moniker> --chain-id stargaze-1
```

2. **Configure the chain ID**:

```
starsd config chain-id stargaze-1
```

***

## Create / recover wallet

1. **Create a new wallet**:

```
starsd keys add <walletname>
```

2. **Or recover an existing wallet**:

```
starsd keys add <walletname> --recover
```

***

## Download genesis and addrbook

1. **Download Genesis and Addrbook files**:

```
wget -O $HOME/.starsd/config/genesis.json "https://files.block-pro.net/stargaze/genesis.json"
wget -O $HOME/.starsd/config/addrbook.json "https://files.block-pro.net/stargaze/addrbook.json"
```

2. **Verify the integrity of the Genesis file**:

```
sha256sum $HOME/.starsd/config/genesis.json
```

> **Expected output**:
>
> * c3c746be26da62715314fb568288eaf04c87d00906c6d1fe6c66e985a609ccbb

***

## Setup Peers

1. **Edit the configuration to include a peer** (use the BlockPro peer in this example):

```
sed -i 's/seeds = ""/seeds = "cb4b4a5b9876b7b36c52e299833c7e4f896499cd@stargaze-mainnet-peer.block-pro.net:60556"/' ~/.starsd/config/config.toml
```

***

## Pruning (optional)

Pruning helps reduce the storage size of the node. You can set it up as follows:

1. **Enable pruning and set values**:

```
pruning="custom"
pruning_keep_recent="10000"
pruning_keep_every="0"
pruning_interval="1000"

sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.starsd/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.starsd/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.starsd/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.starsd/config/app.toml
```

***

## Create a Systemd Service File

1. **Create and configure the systemd service** to run Stargaze as a service:

```
sudo tee /etc/systemd/system/starsd.service > /dev/null <<EOF
[Unit]
Description=stargaze main
After=network-online.target

[Service]
User=$USER
ExecStart=$(which starsd) start
Restart=on-failure
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF
```

2. **Reload and start the Stargaze service**:

```
sudo systemctl daemon-reload
sudo systemctl enable starsd
sudo systemctl restart starsd && sudo journalctl -fu starsd -o cat
```

***

## Create validator

1. **Create your validator** by replacing the placeholders with your values:

```
starsd tx staking create-validator \
  --amount 1000000ustars \
  --from <walletName> \
  --commission-max-change-rate "0.01" \
  --commission-max-rate "0.20" \
  --commission-rate "0.05" \
  --min-self-delegation "1" \
  --pubkey $(starsd tendermint show-validator) \
  --moniker <YOUR_MONIKER_NAME> \
  --chain-id stargaze-1 \
  --identity="<YOUR_KEYBASE_ID>" \
  --details="<YOUR_DETAILS>" \
  --website="<YOUR_WEBSITE_URL>" \
  --fees 200000ustars \
  --gas-adjustment 1.5 \
  -y

```

## Delete node

1. **Stop the Stargaze service**:

```
sudo systemctl stop starsd
sudo systemctl disable starsd
```

2. **Remove systemd service**:

```
rm /etc/systemd/system/starsd.service
sudo systemctl daemon-reload
```

3. **Remove the Stargaze node and data**:

```
cd $HOME
rm -rf stargaze
rm -rf .starsd
rm -rf $(which starsd)
```
