# Installation

If you want to setup Lava fullnode manually follow the steps below

## Update and upgrade

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

## Install GO

```
if ! [ -x "$(command -v go)" ]; then
  ver="1.20.3"
  cd $HOME
  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" >> ~/.bash_profile
  source ~/.bash_profile
fi
```

## Install node

```
cd $HOME
rm -rf lava
git clone https://github.com/lavanet/lava.git
cd lava
git checkout v0.22.0
export LAVA_BINARY=lavad
make install
```

## Setting up vars

You should replace values in <>\
\<YOUR\_MONIKER> Here you should put name of your moniker (validator) that will be visible in explorer\
\<YOUR\_WALLET> Here you shoud put the name of your wallet

```
LAVA_WALLET="<YOUR_WALLET_NAME>"
LAVA_NODENAME="<YOUR_MONIKER>"
LAVA_CHAIN_ID="lava-testnet-2"
```

```
echo "
export LAVA_WALLET=${LAVA_WALLET}
export LAVA_NODENAME=${LAVA_NODENAME}
export LAVA_CHAIN_ID=${LAVA_CHAIN_ID}
" >> $HOME/.bash_profile

source $HOME/.bash_profile
```

## Configure your node

```
lavad config chain-id ${LAVA_CHAIN_ID}
```

## Initialize your node

```
lavad init ${LAVA_NODENAME} --chain-id ${LAVA_CHAIN_ID}
```

## Download genesis

```
curl -Ls "https://snapshots.l0vd.com/lava-testnet/genesis.json" > $HOME/.lava/config/genesis.json
```

## (OPTIONAL) Set custom ports

### If you want to use non-default ports

```
LAVA_PORT=<SET_CUSTOM_PORT> #Example: LAVA_PORT=56 (numbers from 1 to 64)
```

```
sed -i.bak -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:${LAVA_PORT}658\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:${LAVA_PORT}657\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:${LAVA_PORT}060\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:${LAVA_PORT}656\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":${LAVA_PORT}660\"%" /$HOME/.lava/config/config.toml
sed -i.bak -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:${LAVA_PORT}317\"%; s%^address = \"tcp://localhost:1317\"%address = \"tcp://0.0.0.0:${LAVA_PORT}317\"%; s%^address = \":8080\"%address = \":${LAVA_PORT}080\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:${LAVA_PORT}090\"%; s%^address = \"localhost:9090\"%address = \"localhost:${LAVA_PORT}090\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:${LAVA_PORT}091\"%; s%^address = \"localhost:9091\"%address = \"localhost:${LAVA_PORT}091\"%; s%^address = \"0.0.0.0:8545\"%address = \"0.0.0.0:${LAVA_PORT}545\"%; s%^ws-address = \"0.0.0.0:8546\"%ws-address = \"0.0.0.0:${LAVA_PORT}546\"%" /$HOME/.lava/config/app.toml
```

## Set seeds and peers

```
PEERS="7902b049bae54b62ca6a70f5f4c60411cf13ae52@lava-testnet.peers.l0vd.com:20656"
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.lava/config/config.toml
```

## Config pruning

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

## Set minimum gas price and null indexer

```
sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0ulava\"/" $HOME/.lava/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.lava/config/config.toml
```

## Set config

```
sed -i \
  -e 's/timeout_commit = ".*"/timeout_commit = "30s"/g' \
  -e 's/timeout_propose = ".*"/timeout_propose = "1s"/g' \
  -e 's/timeout_precommit = ".*"/timeout_precommit = "1s"/g' \
  -e 's/timeout_precommit_delta = ".*"/timeout_precommit_delta = "500ms"/g' \
  -e 's/timeout_prevote = ".*"/timeout_prevote = "1s"/g' \
  -e 's/timeout_prevote_delta = ".*"/timeout_prevote_delta = "500ms"/g' \
  -e 's/timeout_propose_delta = ".*"/timeout_propose_delta = "500ms"/g' \
  -e 's/skip_timeout_commit = ".*"/skip_timeout_commit = false/g' \
  $HOME/.lava/config/config.toml
```

## Create Service

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

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

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

## Reset blockchain info and restart your node

```
sudo systemctl daemon-reload
sudo systemctl enable lavad
lavad tendermint unsafe-reset-all --home $HOME/.lava --keep-addr-book
sudo systemctl restart lavad && sudo journalctl -u lavad -f -o cat
```

## (OPTIONAL) Use State Sync

### [State Sync](https://chain-services.l0vd.com/testnets/lava/installation-guide)

## Starting a validator

### 1. Add a new key

```
lavad keys add ${LAVA_WALLET}
```

#### (OR)

### 1. Recover your key

```
lavad keys add ${LAVA_WALLET} --recover
```

```
LAVA_WALLET_ADDR=$(lavad keys show ${LAVA_WALLET} -a)
echo "export LAVA_WALLET_ADDR=${LAVA_WALLET_ADDR}" >> $HOME/.bash_profile

source $HOME/.bash_profile
```

## 2. Create validator

{% hint style="info" %}
Wait until the node is synchronized.
{% endhint %}

```
lavad tx staking create-validator \
--amount 1000000ulava \
--commission-max-change-rate "0.01" \
--commission-max-rate "0.20" \
--commission-rate "0.1" \
--min-self-delegation "1" \
--details "" \
--pubkey $(lavad tendermint show-validator) \
--moniker ${LAVA_NODENAME} \
--chain-id ${LAVA_CHAIN_ID} \
--from ${LAVA_WALLET_ADDR} \
--gas-prices 0ulava \
--gas-adjustment 1.5 \
--gas auto \
--yes
```
