laconicd/testnet/genesis-validators.md

260 lines
6.1 KiB
Markdown
Raw Normal View History

2022-08-03 17:51:28 +00:00
# Validator Guide for chibaclonk_81337-3 Testnet
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
## Hardware Prerequisites
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
### Supported
2022-04-06 01:28:21 +00:00
- **Operating System (OS):** Ubuntu 20.04
- **CPU:** 1 core
- **RAM:** 2GB
- **Storage:** 25GB SSD
2022-08-03 17:51:28 +00:00
### Recommended
2022-04-06 01:28:21 +00:00
- **Operating System (OS):** Ubuntu 20.04
- **CPU:** 2 core
- **RAM:** 4GB
- **Storage:** 50GB SSD
2022-08-03 17:51:28 +00:00
## Network Prerequisites
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
- **TCP 26656** for Peer-to-Peer Network Communication
- **TCP 26660** for Prometheus Metrics (doesn't have to be exposed publicly)
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Validator Setup
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
## Install required software packages
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
# Update Ubuntu
sudo apt update
sudo apt upgrade -y
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Install required software packages
sudo apt install git curl build-essential make jq -y
2022-04-06 01:28:21 +00:00
```
2022-08-03 17:51:28 +00:00
---
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
## Install Go
```sh
# Remove any existing installation of `go`
sudo rm -rf /usr/local/go
# Install Go version 1.17.2
curl https://dl.google.com/go/go1.17.2.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
# Update env variables to include go
2022-04-06 01:28:21 +00:00
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF
source $HOME/.profile
```
2022-08-03 17:51:28 +00:00
Check the version of go installed
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
2022-04-06 01:28:21 +00:00
go version
2022-08-03 17:51:28 +00:00
# Should return something like: go version go1.17.2 linux/amd64
2022-04-06 01:28:21 +00:00
```
2022-08-03 17:51:28 +00:00
---
## Install `chibaclonk`
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
2022-04-06 01:28:21 +00:00
git clone https://github.com/vulcanize/chiba-clonk.git
cd chiba-clonk
2022-08-03 17:51:28 +00:00
# Checkout main branch
2022-04-06 01:28:21 +00:00
git fetch --all
git checkout main
2022-08-03 17:51:28 +00:00
# Build and install chibaclonk
2022-04-06 01:28:21 +00:00
make install
```
2022-08-03 17:51:28 +00:00
Verify your installation
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
2022-04-06 01:28:21 +00:00
chibaclonkd version --long
```
On running the above command, you should see a similar response like this. Make sure that the *version* and *commit
hash* are accurate
2022-08-03 17:51:28 +00:00
```sh
2022-04-06 01:28:21 +00:00
name: chibaclonk
server_name: chibaclonkd
```
2022-08-03 17:51:28 +00:00
---
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
## Initialize Validator Node
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
First we have to reset the previous genesis state (only because the `chibaclonk_81337-2` testnet failed) whereafter we can initialize the validator node for `chibaclonk_81337-3`
```sh
# Stop your node (in case it was still running)
systemctl stop chibaclonkd
# Keep a backup of your old validator directory
cp -a ~/.chibaclonkd ~/backup-chibaclonk_81337-2
# Reset the state of your validator
chibaclonkd tendermint unsafe-reset-all --home $HOME/.chibaclonkd
# Remove your previous genesis transactions
rm $HOME/.chibaclonkd/config/gentx/gentx*.json
# Overwrite your genesis state with the new chain-id
chibaclonkd init --overwrite <your-node-moniker> --chain-id chibaclonk_81337-3
# Initialize the validator node
chibaclonkd init <your-node-moniker> --chain-id chibaclonk_81337-3
2022-04-06 01:28:21 +00:00
```
2022-08-03 17:51:28 +00:00
Running the above commands will initialize the validator node with default configuration. The config files will be saved in the default location (`~/.chibaclonkd/config`).
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
**NOTE:** Backup your node and validator keys. You will need to use these keys at a later point in time.
2022-04-06 01:28:21 +00:00
---
2022-08-03 17:51:28 +00:00
## Create Account keys
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
If you have participated in a previous testnet and have a mnemonic phrase, use below command to recover your account:
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
2022-04-06 01:28:21 +00:00
chibaclonkd keys add <key-name> --recover
```
2022-08-03 17:51:28 +00:00
To create a new account use:
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
2022-04-06 01:28:21 +00:00
chibaclonkd keys add <key-name>
```
2022-08-03 17:51:28 +00:00
**NOTE:** Save the `mnemonic` and related account details (public key). You will need to use the mnemonic and / or private key to recover accounts at a later point in time.
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
---
## Add Genesis Account
**NOTE:** Don't add more than 12,900 CHK , if you add more than that, your gentx will be ignored.
```sh
chibaclonkd add-genesis-account <key-name> 12900000000000000000000achk --keyring-backend os
2022-04-06 01:28:21 +00:00
```
2022-08-03 17:51:28 +00:00
Create Your `gentx` transaction file
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
chibaclonkd gentx <key-name> 12900000000000000000000achk \
2022-04-06 01:28:21 +00:00
--pubkey=$(chibaclonkd tendermint show-validator) \
2022-08-03 17:51:28 +00:00
--chain-id="chibaclonk_81337-3" \
--moniker="<your-moniker-name>" \
--website="<your-validator-website>" \
--details="<your-validator-description>" \
--identity="<your-keybase-public-key>" \
2022-04-06 01:28:21 +00:00
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1"
```
2022-08-03 17:51:28 +00:00
**NOTE:**
2022-04-06 01:28:21 +00:00
- `<key-name>` and `chain-id` are required. other flags are optional
2022-08-03 17:51:28 +00:00
- Don't change the amount value while creating your gentx
2022-04-06 01:28:21 +00:00
- Genesis transaction file will be saved in `~/.chibaclonkd/config/gentx` folder
2022-08-03 17:51:28 +00:00
---
## Submit Your gentx
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
Submit your `gentx` file to the [testnets]() repository in the following format:
2022-04-06 01:28:21 +00:00
`<validator-moniker>-gentx.json`
2022-08-03 17:51:28 +00:00
**NOTE:** (Do NOT use spaces in the file name)
2022-04-06 01:28:21 +00:00
To submit the gentx file, follow the below process:
- Fork the [testnets]() repository
2022-08-03 17:51:28 +00:00
- Upload your gentx file in `chibaclonk_81337-3/config/gentxs` folder
2022-04-06 01:28:21 +00:00
- Submit Pull Request to [testnets]() with name `ADD <your-moniker> gentx`
2022-08-03 17:51:28 +00:00
The genesis file will be published to [testnets/chibaclonk_81337-3]()
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# CONTINUE WITH BELOW STEPS ONLY AFTER GENESIS FILE HAS BEEN PUBLISHED
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
## Adjust validator node configuration
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
# Set seed & peers variable
seeds="<seeds node list here>"
peers="<peers node list here>"
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Update seeds, persistent_peers and prometheus parameters in config.toml
sed -i.bak -e "s/^seeds *=.*/seeds = \"$seeds\"/; s/^persistent_peers *=.*/persistent_peers = \"$peers\"/; s/^prometheus *=.*/prometheus = true/" $HOME/.chibaclonkd/config/config.toml
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Create systemd validator service
2022-04-06 01:28:21 +00:00
sudo tee /etc/systemd/system/chibaclonkd.service > /dev/null <<EOF
[Unit]
Description=chibaclonkd Daemon
After=network-online.target
[Service]
User=$USER
2022-08-03 17:51:28 +00:00
ExecStart=$(which chibaclonkd) start --mode validator --gql-playground --gql-server --log_level=warn
2022-04-06 01:28:21 +00:00
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
2022-08-03 17:51:28 +00:00
#Reload systemd and start the validator node
2022-04-06 01:28:21 +00:00
sudo systemctl daemon-reload
sudo systemctl enable chibaclonkd
sudo systemctl start chibaclonkd
```
2022-08-03 17:51:28 +00:00
Check status of service
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
2022-04-06 01:28:21 +00:00
sudo systemctl status chibaclonkd
```
2022-08-03 17:51:28 +00:00
---
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
## Helpful Commands
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
```sh
# Check logs
journalctl -u chibaclonkd
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Most recent logs
journalctl -xeu chibaclonkd
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Logs from previous day
journalctl --since "1 day ago" -u chibaclonkd
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Check logs with follow flag
journalctl -f -u chibaclonkd
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Check discovered peers
curl http://localhost:26657/net_info
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Check network consensus state
curl http://localhost:26657/consensus_state
2022-04-06 01:28:21 +00:00
2022-08-03 17:51:28 +00:00
# Check the sync status of your validator node
chibaclonkd status | jq .SyncInfo
```