# Node Installation

## [EXPLORER](https://explorer.stavr.tech/GravityBridge/)

* **Minimum hardware requirements**:

| Node Type | CPU | RAM  | Storage |
| --------- | --- | ---- | ------- |
| Mainnet   | 8   | 16GB | 250GB   |

## 1) Auto\_install script

```bash
wget -O gravitym https://raw.githubusercontent.com/111STAVR111/props/main/Gravity/gravitym && chmod +x gravitym && ./gravitym
```

## 2) Manual installation

#### Preparing the server

```bash
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 chrony liblz4-tool -y
```

### GO 1.21.6

```bash
ver="1.21.6"
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 05.09.25

```bash
cd $HOME && mkdir -p go/bin/
mkdir gravity-bin && cd gravity-bin
wget -O gravity https://github.com/Gravity-Bridge/Gravity-Bridge/releases/download/v1.13.3/gravity-linux-amd64
mv gravity-linux-amd64 gravity
wget https://github.com/Gravity-Bridge/Gravity-Bridge/releases/download/v1.13.3/gbt
chmod +x *
mv $HOME/gravity /usr/bin/
mv $HOME/gbt /usr/bin/
```

`gravity version --long | head`

* version: v1.13.3
* commit: a30a8398ea6ec243a89f1bdf56c532f6739380c8

## Initiation

```python
gravity init STAVR_guide --chain-id gravity-bridge-3
gravity config chain-id gravity-bridge-3
gbt init
```

### Create wallet

```bash
gravity keys add <wallet_name> --algo secp256k1 --coin-type 118
gravity keys add <wallet_orchestrator_name>
gravity eth_keys add <wallet_eth_name>
```

### Key set for orchestrator

```python
gbt keys set-ethereum-key --key <your Ethereum PRIVATE key>
gbt keys set-orchestrator-key --phrase "<your mnemonic from orchestrator wallet>"
```

### Download Genesis

```python
wget -O $HOME/.gravity/config/genesis.json "https://raw.githubusercontent.com/111STAVR111/props/main/Gravity/genesis.json"
```

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

* 3c1cb9bf8003a1045b415b19bc92890b5a69ec8cf1ef909b61d5503b5e1c1dff

### Set up the minimum gas price and Peers/Seeds/Filter peers/MaxPeers

```bash
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.001ugraviton\"/;" ~/.gravity/config/app.toml
external_address=$(wget -qO- eth0.me) 
sed -i.bak -e "s/^external_address *=.*/external_address = \"$external_address:26656\"/" $HOME/.gravity/config/config.toml
peers=""
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.gravity/config/config.toml
seeds=""
sed -i.bak -e "s/^seeds =.*/seeds = \"$seeds\"/" $HOME/.gravity/config/config.toml
sed -i 's/max_num_inbound_peers =.*/max_num_inbound_peers = 50/g' $HOME/.gravity/config/config.toml
sed -i 's/max_num_outbound_peers =.*/max_num_outbound_peers = 50/g' $HOME/.gravity/config/config.toml
```

#### Pruning (optional)

```bash
pruning="custom"
pruning_keep_recent="1000"
pruning_keep_every="0"
pruning_interval="10"
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.gravity/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.gravity/config/app.toml
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.gravity/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.gravity/config/app.toml
```

#### Indexer (optional)

```bash
indexer="null" &&
sed -i -e "s/^indexer *=.*/indexer = \"$indexer\"/" $HOME/.gravity/config/config.toml
```

### Download addrbook

```bash
wget -O $HOME/.gravity/config/addrbook.json "https://raw.githubusercontent.com/111STAVR111/props/main/Gravity/addrbook.json"
```

## Create a service file

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

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

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

## StateSync Gravity Mainnet

```bash
SOOON
```

## SnapShot Mainnet updated every 5 hours

```bash
SOOON
```

### Start

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

### Create the service file Orchestrator

```python
sudo tee /etc/systemd/system/orchestrator.service > /dev/null <<EOF
[Unit]
Description=Gravity Bridge Orchestrator
Requires=network.target
[Service]
Type=simple
TimeoutStartSec=10s
Restart=on-failure
RestartSec=10
ExecStart=$(which gbt) orchestrator \
--fees 5000ugraviton \
--gravity-contract-address 0xa4108aA1Ec4967F8b52220a4f7e94A8201F2D906 \
--ethereum-rpc "https://eth.althea.net/"
[Install]
WantedBy=default.target
EOF
```

### Load service and start

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

#### Create validator

```python
gravity tx staking create-validator \
--commission-rate 0.1 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.2 \
--min-self-delegation "1" \
--amount 1000000000000000000ugraviton \
--pubkey $(gravity tendermint show-validator) \
--from <wallet> \
--moniker="STAVR_guide" \
--chain-id gravity-bridge-3 \
--fees="500ugraviton" \
--identity="" \
--website="" \
--details="" -y
```

## [🧩Services and Tools🧩](https://stavr-team.gitbook.io/nodes-guides/mainnets/gravity/statesync-snapshot)

## Monitoring

You can set up your node status alarm here - [Monitoring](https://stavr-team.gitbook.io/nodes-guides/monitoring)

## Security

You can create secure management of your wallet and your node by following this links.

[TMKMS](https://stavr-team.gitbook.io/nodes-guides/tmkms)               [Wallet Security](https://stavr-team.gitbook.io/nodes-guides/wallet-security)

### Delete node

```bash
sudo systemctl stop gravity
sudo systemctl disable gravity
rm /etc/systemd/system/gravity.service
sudo systemctl daemon-reload
cd $HOME
rm -rf gravity-bin
rm -rf .gravity
rm -rf $(which gravity)
```
