# validator

Guidence for create validator

#### Create wallet

To create new wallet you can use command below. Don’t forget to save the mnemonic

```
nibid keys add $WALLET
```

To recover your wallet using seed phrase

```
nibid keys add $WALLET --recover
```

Show your wallet list

```
nibid keys list
```

#### Save wallet info

Add wallet and validator address into variables

```
NIBIRU_WALLET_ADDRESS=$(nibid keys show $WALLET -a)
NIBIRU_VALOPER_ADDRESS=$(nibid keys show $WALLET --bech val -a)
echo 'export NIBIRU_WALLET_ADDRESS='${NIBIRU_WALLET_ADDRESS} >> $HOME/.bash_profile
echo 'export NIBIRU_VALOPER_ADDRESS='${NIBIRU_VALOPER_ADDRESS} >> $HOME/.bash_profile
source $HOME/.bash_profile
```

#### Fund your wallet

```
Go to Discrod and #faucet channel
```

#### Create validator

check your wallet balance:

```
nibid query bank balances $NIBIRU_WALLET_ADDRESS
```

To create your validator run command below

```
nibid tx staking create-validator \
  --amount 10000000unibi \
  --from $WALLET \
  --commission-max-change-rate "0.1" \
  --commission-max-rate "0.2" \
  --commission-rate "0.1" \
  --min-self-delegation "1" \
  --pubkey  $(nibid tendermint show-validator) \
  --moniker $NODENAME \
  --chain-id $NIBIRU_CHAIN_ID
```

#### Check your validator key

```
[[ $(nibid q staking validator $NIBIRU_VALOPER_ADDRESS -oj | jq -r .consensus_pubkey.key) = $(nibid status | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "\n\e[1m\e[32mTrue\e[0m\n" || echo -e "\n\e[1m\e[31mFalse\e[0m\n"
```

#### Get list of validators

```
nibid q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl
```

### Usefull commands

#### Service management

Check logs

```
journalctl -fu nibid -o cat
```

Start service

```
sudo systemctl start nibid
```

Stop service

```
sudo systemctl stop nibid
```

Restart service

```
sudo systemctl restart nibid
```

#### Node info

Synchronization info

```
nibid status 2>&1 | jq .SyncInfo
```

Validator info

```
nibid status 2>&1 | jq .ValidatorInfo
```

Node info

```
nibid status 2>&1 | jq .NodeInfo
```

Show node id

```
nibid tendermint show-node-id
```

#### Wallet operations

List of wallets

```
nibid keys list
```

Recover wallet

```
nibid keys add $WALLET --recover
```

Delete wallet

```
nibid keys delete $WALLET
```

Get wallet balance

```
nibid query bank balances $NIBIRU_WALLET_ADDRESS
```

Transfer funds

```
nibid tx bank send $NIBIRU_WALLET_ADDRESS <TO_NIBIRU_WALLET_ADDRESS> 10000000unibi
```

#### Voting

```
nibid tx gov vote 1 yes --from $WALLET --chain-id=$NIBIRU_CHAIN_ID
```

#### Staking, Delegation and Rewards

Delegate stake

```
nibid tx staking delegate $NIBIRU_VALOPER_ADDRESS 10000000unibi --from=$WALLET --chain-id=$NIBIRU_CHAIN_ID --gas=auto
```

Redelegate stake from validator to another validator

```
nibid tx staking redelegate <srcValidatorAddress> <destValidatorAddress> 10000000unibi --from=$WALLET --chain-id=$NIBIRU_CHAIN_ID --gas=auto
```

Withdraw all rewards

```
nibid tx distribution withdraw-all-rewards --from=$WALLET --chain-id=$NIBIRU_CHAIN_ID --gas=auto
```

Withdraw rewards with commision

```
nibid tx distribution withdraw-rewards $NIBIRU_VALOPER_ADDRESS --from=$WALLET --commission --chain-id=$NIBIRU_CHAIN_ID
```

#### Validator management

Edit validator

```
nibid tx staking edit-validator \
  --moniker=$NODENAME \
  --identity=<your_keybase_id> \
  --website="<your_website>" \
  --details="<your_validator_description>" \
  --chain-id=$NIBIRU_CHAIN_ID \
  --from=$WALLET
```

Unjail validator

```
nibid tx slashing unjail \
  --broadcast-mode=block \
  --from=$WALLET \
  --chain-id=$NIBIRU_CHAIN_ID \
  --gas=auto
```
