docs: add testnet docs

This commit is contained in:
Sai Kumar 2021-10-25 18:35:59 +05:30
parent 5a6e2ec46f
commit 151747bc81
5 changed files with 665 additions and 0 deletions

7
testnet/README.md Normal file
View File

@ -0,0 +1,7 @@
# Testnet
## Setup Local ethermint multi node
```shell
$ bash multinode_testnet.sh
```

174
testnet/full-node.md Normal file
View File

@ -0,0 +1,174 @@
# Instructions to Run Full Node
Hardware
---
#### Supported
- **Operating System (OS):** Ubuntu 20.04
- **CPU:** 1 core
- **RAM:** 2GB
- **Storage:** 25GB SSD
#### Recommended
- **Operating System (OS):** Ubuntu 20.04
- **CPU:** 2 core
- **RAM:** 4GB
- **Storage:** 50GB SSD
# A) Setup
## 1) Install Golang (go)
1.1) Remove any existing installation of `go`
```
sudo rm -rf /usr/local/go
```
1.2) Install latest/required Go version (installing `go1.16.7`)
```
curl https://dl.google.com/go/go1.16.7.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
```
1.3) Update env variables to include `go`
```
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
```
1.4) Check the version of go installed
```
go version
```
### 2) Install required software packages
```
sudo apt-get install git curl build-essential make jq -y
```
### 3) Install `ethermint`
```
git clone https://github.com/vulcanize/ethermint.git
cd ethermint
git fetch --all
git checkout v0.1.0-dev
make install
```
### 4) Verify your installation
```
ethermintd 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
```
name: ethermint
server_name: ethermintd
```
### 5) Initialize Node
**Not required if you have already initialized before**
```
ethermintd init <your-node-moniker> --chain-id ethermint_9000-1
```
On running the above command, node will be initialized with default configuration. (config files will be saved in node's
default home directory (~/.ethermintd/config)
NOTE: Backup node and validator keys . You will need to use these keys at a later point in time.
---
**Execute below instructions only after publishing of final genesis file**
genesis file will be published to [vulcanize//testnets/ethermint_9000-1](https://github.com/vulcanize/testnets)
# B) Starting Node
TBU
```
## 3) Start the Node
#### 3.1) Start node as `systemctl` service
3.1.1) Create the service file
```
sudo tee /etc/systemd/system/ethermintd.service > /dev/null <<EOF
[Unit]
Description=EthermintD Daemon After=network-online.target
[Service]
User=$USER ExecStart=$(which ethermintd) start --gql-playground --gql-server Restart=always RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target EOF
```
3.1.2) Load service and start
```
sudo systemctl daemon-reload sudo systemctl enable ethermintd sudo systemctl start ethermintd
```
3.1.3) Check status of service
```
sudo systemctl status ethermintd
```
`NOTE:`
A helpful command here is `journalctl` that can be used to:
a) check logs
```
journalctl -u ethermintd
```
b) most recent logs
```
journalctl -xeu ethermintd
```
c) logs from previous day
```
journalctl --since "1 day ago" -u ethermintd
```
d) Check logs with follow flag
```
journalctl -f -u ethermintd
```

View File

@ -0,0 +1,230 @@
# Setting up a Genesis Validator for Vulcanize Ethermint Testnet (ethermint_9000-1)
Hardware
---
#### Supported
- **Operating System (OS):** Ubuntu 20.04
- **CPU:** 1 core
- **RAM:** 2GB
- **Storage:** 25GB SSD
#### Recommended
- **Operating System (OS):** Ubuntu 20.04
- **CPU:** 2 core
- **RAM:** 4GB
- **Storage:** 50GB SSD
# A) Setup
## 1) Install Golang (go)
1.1) Remove any existing installation of `go`
```
sudo rm -rf /usr/local/go
```
1.2) Install latest/required Go version (installing `go1.16.7`)
```
curl https://dl.google.com/go/go1.16.7.linux-amd64.tar.gz | sudo tar -C/usr/local -zxvf -
```
1.3) Update env variables to include `go`
```
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
```
1.4) Check the version of go installed
```
go version
```
### 2) Install required software packages
```
sudo apt-get install git curl build-essential make jq -y
```
### 3) Install `ethermint`
```
git clone https://github.com/vulcanize/ethermint.git
cd ethermint
git fetch --all
git checkout v0.1.0-dev
make install
```
### 4) Verify your installation
```
ethermintd 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
```
name: ethermint
server_name: ethermintd
```
### 5) Initialize Node
**Not required if you have already initialized before**
```
ethermintd init <your-node-moniker> --chain-id ethermint_9000-1
```
On running the above command, node will be initialized with default configuration. (config files will be saved in node's
default home directory (~/.ethermintd/config)
NOTE: Backup node and validator keys . You will need to use these keys at a later point in time.
---
## 6) Create Account keys
if you have participated in previous testnet and have mnemonic phrase, use below command to recover your account
```
ethermintd keys add <key-name> --recover
```
to create new account
```
ethermintd keys add <key-name>
```
NOTE: Save `mnemonic` and related account details (public key). You will need to use the need mnemonic/private key to
recover accounts at a later point in time.
## 7) Add Genesis Account
```
ethermintd add-genesis-account <key-name> 50000000uwire
```
## 8) Create Your `gentx`
```
ethermintd gentx <key-name> 50000000uwire \
--pubkey=$(ethermintd tendermint show-validator) \
--chain-id="ethermint_9000-1" \
--moniker="my-moniker" \
--website="https://yourweb.site" \
--details="description of my validator" \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1"
```
Note:
- `<key-name>` and `chain-id` are required. other flags are optional
- Don't change amount value while creating your gentx
- Genesis transaction file will be saved in `~/.ethermintd/config/gentx` folder
## 9) Submit Your gentx
Submit your `gentx` file to the [testnets]() in the format of
`<validator-moniker>-gentx.json`
NOTE: (Do NOT use space in the file name)
To submit the gentx file, follow the below process:
- Fork the [testnets]() repository
- Upload your gentx file in `ethermint_9000-1/gentxs` folder
- Submit Pull Request to [testnets]() with name `ADD <your-moniker> gentx`
---
**Execute below instructions only after publishing of final genesis file**
genesis file will be published to [testnets/ethermint_9000-1]()
# B) Starting the validator
TBU
## 3) Start the Node
#### 3.1) Start node as `systemctl` service
3.1.1) Create the service file Note: this step is not required if you did setup before
```
sudo tee /etc/systemd/system/ethermintd.service > /dev/null <<EOF
[Unit]
Description=ethermintd Daemon
After=network-online.target
[Service]
User=$USER
ExecStart=$(which ethermintd) start
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
```
3.1.2) Load service and start
```
sudo systemctl daemon-reload
sudo systemctl enable ethermintd
sudo systemctl start ethermintd
```
3.1.3) Check status of service
```
sudo systemctl status ethermintd
```
`NOTE:`
A helpful command here is `journalctl` that can be used to:
a) check logs
```
journalctl -u ethermintd
```
b) most recent logs
```
journalctl -xeu ethermintd
```
c) logs from previous day
```
journalctl --since "1 day ago" -u ethermintd
```
d) Check logs with follow flag
```
journalctl -f -u ethermintd
```

View File

@ -0,0 +1,203 @@
#/bin/sh
# clean the existed chain
rm -rf ~/.testethermint*
echo "Installing the require tools "
sudo apt-get install git curl build-essential make nohup jq -y
echo "Done Installing the tools"
# chain env variables
export DAEMON_HOME=~/.testethermint
export CHAINID=ethermint_9000-1
export DENOM=uether
export GH_URL=https://github.com/vulcanize/ethermint.git
export CHAIN_VERSION=dev
export DAEMON=ethermintd
display_usage() {
printf "** Please check the exported values:: **\n Daemon : $DAEMON\n Denom : $DENOM\n ChainID : $CHAINID\n DaemonHome : $DAEMON_HOME\n \n Github URL : $GH_URL\n Chain Version : $CHAIN_VERSION\n"
exit 1
}
if [ -z $DAEMON ] || [ -z $DENOM ] || [ -z $CHAINID ] || [ -z $DAEMON_HOME ] || [ -z $GH_URL ] || [ -z $CHAIN_VERSION ]; then
display_usage
fi
echo "--------- Install $DAEMON ---------"
git clone -b $CHAIN_VERSION --single-branch $GH_URL && cd $(basename $_ .git)
git fetch && git checkout $CHAIN_VERSION
make install
cd $HOME
# check version
$DAEMON version --long
#echo "----------Create test keys-----------"
export DAEMON_HOME_1=$DAEMON_HOME-1
export DAEMON_HOME_2=$DAEMON_HOME-2
export DAEMON_HOME_3=$DAEMON_HOME-3
export DAEMON_HOME_4=$DAEMON_HOME-4
printf "DAEMON_HOME_1=$DAEMON_HOME_1\nDAEMON_HOME_2=$DAEMON_HOME_2\nDAEMON_HOME_3=$DAEMON_HOME_3\nDAEMON_HOME_4=$DAEMON_HOME_4\n"
rm -rf $DAEMON_HOME*
echo "-----Create daemon home directories if not exist------"
mkdir -p "$DAEMON_HOME_1"
mkdir -p "$DAEMON_HOME_2"
mkdir -p "$DAEMON_HOME_3"
mkdir -p "$DAEMON_HOME_4"
echo "--------Start initializing the chain ($CHAINID)---------"
$DAEMON init --chain-id $CHAINID $DAEMON_HOME_1 --home $DAEMON_HOME_1 --keyring-backend test
$DAEMON init --chain-id $CHAINID $DAEMON_HOME_2 --home $DAEMON_HOME_2 --keyring-backend test
$DAEMON init --chain-id $CHAINID $DAEMON_HOME_3 --home $DAEMON_HOME_3 --keyring-backend test
$DAEMON init --chain-id $CHAINID $DAEMON_HOME_4 --home $DAEMON_HOME_4 --keyring-backend test
echo "---------Creating four keys-------------"
$DAEMON keys add validator1 --home $DAEMON_HOME_1 --keyring-backend test
$DAEMON keys add validator2 --home $DAEMON_HOME_2 --keyring-backend test
$DAEMON keys add validator3 --home $DAEMON_HOME_3 --keyring-backend test
$DAEMON keys add validator4 --home $DAEMON_HOME_4 --keyring-backend test
echo "----------Genesis creation---------"
$DAEMON --home $DAEMON_HOME_1 add-genesis-account validator1 1000000000000$DENOM --keyring-backend test
$DAEMON --home $DAEMON_HOME_2 add-genesis-account validator2 1000000000000$DENOM --keyring-backend test
$DAEMON --home $DAEMON_HOME_3 add-genesis-account validator3 1000000000000$DENOM --keyring-backend test
$DAEMON --home $DAEMON_HOME_4 add-genesis-account validator4 1000000000000$DENOM --keyring-backend test
$DAEMON --home $DAEMON_HOME_1 add-genesis-account $($DAEMON keys show validator2 -a --home $DAEMON_HOME_2 --keyring-backend test) 1000000000000$DENOM
$DAEMON --home $DAEMON_HOME_1 add-genesis-account $($DAEMON keys show validator3 -a --home $DAEMON_HOME_3 --keyring-backend test) 1000000000000$DENOM
$DAEMON --home $DAEMON_HOME_1 add-genesis-account $($DAEMON keys show validator4 -a --home $DAEMON_HOME_4 --keyring-backend test) 1000000000000$DENOM
echo "--------Gentx--------"
$DAEMON gentx validator1 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_1
$DAEMON gentx validator2 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_2
$DAEMON gentx validator3 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_3
$DAEMON gentx validator4 90000000000$DENOM --chain-id $CHAINID --keyring-backend test --home $DAEMON_HOME_4
echo "---------Copy all the genesis to $DAEMON_HOME_1----------"
cp $DAEMON_HOME_2/config/gentx/*.json $DAEMON_HOME_1/config/gentx/
cp $DAEMON_HOME_3/config/gentx/*.json $DAEMON_HOME_1/config/gentx/
cp $DAEMON_HOME_4/config/gentx/*.json $DAEMON_HOME_1/config/gentx/
echo "----------collect-gentxs------------"
$DAEMON collect-gentxs --home $DAEMON_HOME_1
echo "---------Updating $DAEMON_HOME_1 genesis.json ------------"
sed -i "s/172800000000000/600000000000/g" $DAEMON_HOME_1/config/genesis.json
sed -i "s/172800s/600s/g" $DAEMON_HOME_1/config/genesis.json
sed -i "s/stake/$DENOM/g" $DAEMON_HOME_1/config/genesis.json
echo "---------Distribute genesis.json of $DAEMON_HOME_1 to remaining nodes-------"
cp $DAEMON_HOME_1/config/genesis.json $DAEMON_HOME_2/config/
cp $DAEMON_HOME_1/config/genesis.json $DAEMON_HOME_3/config/
cp $DAEMON_HOME_1/config/genesis.json $DAEMON_HOME_4/config/
echo "---------Getting public IP address-----------"
IP="127.0.0.1"
echo "Public IP address: ${IP}"
echo "----------Update node-id of $DAEMON_HOME_1 in remaining nodes---------"
nodeID=$("${DAEMON}" tendermint show-node-id --home $DAEMON_HOME_1)
echo $nodeID
PERSISTENT_PEERS="$nodeID@$IP:16656"
echo "PERSISTENT_PEERS : $PERSISTENT_PEERS"
echo "----------Updating $DAEMON_HOME_1 chain config-----------"
sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:16657#g' $DAEMON_HOME_1/config/config.toml
sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:16656#g' $DAEMON_HOME_1/config/config.toml
sed -i '/persistent_peers =/c\persistent_peers = "'""'"' $DAEMON_HOME_1/config/config.toml
sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_1/config/config.toml
sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_1/config/config.toml
sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_1/config/config.toml
sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_1/config/config.toml
sed -i 's#0.0.0.0:9090#0.0.0.0:1090#g' $DAEMON_HOME_1/config/app.toml
sed -i 's#0.0.0.0:9091#0.0.0.0:1091#g' $DAEMON_HOME_1/config/app.toml
sed -i 's#0.0.0.0:8545#0.0.0.0:1545#g' $DAEMON_HOME_1/config/app.toml
sed -i 's#0.0.0.0:8546#0.0.0.0:1546#g' $DAEMON_HOME_1/config/app.toml
echo "----------Updating $DAEMON_HOME_2 chain config-----------"
sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:26657#g' $DAEMON_HOME_2/config/config.toml
sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:26656#g' $DAEMON_HOME_2/config/config.toml
sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' $DAEMON_HOME_2/config/config.toml
sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_2/config/config.toml
sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_2/config/config.toml
sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_2/config/config.toml
sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_2/config/config.toml
sed -i 's#0.0.0.0:9090#0.0.0.0:2090#g' $DAEMON_HOME_2/config/app.toml
sed -i 's#0.0.0.0:9091#0.0.0.0:2091#g' $DAEMON_HOME_2/config/app.toml
sed -i 's#0.0.0.0:8545#0.0.0.0:2545#g' $DAEMON_HOME_2/config/app.toml
sed -i 's#0.0.0.0:8546#0.0.0.0:2546#g' $DAEMON_HOME_2/config/app.toml
echo "----------Updating $DAEMON_HOME_3 chain config------------"
sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:36657#g' $DAEMON_HOME_3/config/config.toml
sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:36656#g' $DAEMON_HOME_3/config/config.toml
sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' $DAEMON_HOME_3/config/config.toml
sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_3/config/config.toml
sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_3/config/config.toml
sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_3/config/config.toml
sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_3/config/config.toml
sed -i 's#0.0.0.0:9090#0.0.0.0:3090#g' $DAEMON_HOME_3/config/app.toml
sed -i 's#0.0.0.0:9091#0.0.0.0:3091#g' $DAEMON_HOME_3/config/app.toml
sed -i 's#0.0.0.0:8545#0.0.0.0:3545#g' $DAEMON_HOME_3/config/app.toml
sed -i 's#0.0.0.0:8546#0.0.0.0:3546#g' $DAEMON_HOME_3/config/app.toml
echo "----------Updating $DAEMON_HOME_4 chain config------------"
sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:46657#g' $DAEMON_HOME_4/config/config.toml
sed -i 's#tcp://0.0.0.0:26656#tcp://0.0.0.0:46656#g' $DAEMON_HOME_4/config/config.toml
sed -i '/persistent_peers =/c\persistent_peers = "'"$PERSISTENT_PEERS"'"' $DAEMON_HOME_4/config/config.toml
sed -i '/max_num_inbound_peers =/c\max_num_inbound_peers = 140' $DAEMON_HOME_4/config/config.toml
sed -i '/max_num_outbound_peers =/c\max_num_outbound_peers = 110' $DAEMON_HOME_4/config/config.toml
sed -i '/pprof_laddr =/c\# pprof_laddr = "localhost:6060"' $DAEMON_HOME_4/config/config.toml
sed -i '/allow_duplicate_ip =/c\allow_duplicate_ip = true' $DAEMON_HOME_4/config/config.toml
sed -i 's#0.0.0.0:9090#0.0.0.0:4090#g' $DAEMON_HOME_4/config/app.toml
sed -i 's#0.0.0.0:9091#0.0.0.0:4091#g' $DAEMON_HOME_4/config/app.toml
sed -i 's#0.0.0.0:8545#0.0.0.0:4545#g' $DAEMON_HOME_4/config/app.toml
sed -i 's#0.0.0.0:8546#0.0.0.0:4546#g' $DAEMON_HOME_4/config/app.toml
echo "starting the chains"
nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_1 >$DAEMON_HOME_1.log &
sleep 5s
echo "Checking $DAEMON_HOME_1 chain status"
$DAEMON status --node tcp://localhost:16657
nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_2 >$DAEMON_HOME_2.log &
sleep 5s
echo "Checking $DAEMON_HOME_2 chain status"
$DAEMON status --node tcp://localhost:26657
nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_3 >$DAEMON_HOME_3.log &
sleep 5s
echo "Checking $DAEMON_HOME_3 chain status"
$DAEMON status --node tcp://localhost:36657
nohup $(which $DAEMON) start --gql-playground --gql-server --home $DAEMON_HOME_4 >$DAEMON_HOME_4.log &
sleep 5s
echo "Checking $DAEMON_HOME_4 chain status"
$DAEMON status --node tcp://localhost:46657

51
testnet/validator-node.md Normal file
View File

@ -0,0 +1,51 @@
### Create Validator Post Genesis
1. Run Full Node
2. Create Account and Get test tokens
3. Create Validator
### 1.Run Full Node
- Check "[Run Full Node](full-node.md)" section to Run a Full Node
### 2. Create Account & Get test tokens
```
ethermintd keys add <key-name>
```
NOTE: Save `mnemonic` and related account details (public key). You will need to use the need mnemonic/private key to
recover accounts at a later point in time.
##### Get Test tokens from faucet
- TBU
### 3.Create Validator
- ##### Check full node sync status
`ethermintd status 2>&1 | jq -r ".SyncInfo"`
`catching_up: false` means node is completely synced
- ##### Create validator
`Note:` Only execute below transaction after complete sync of your full node
```
ethermintd tx staking create-validator \
--amount=1000000uwire \
--pubkey=$(ethermintd tendermint show-validator) \
--moniker="my-moniker" \
--website="https://myweb.site" \
--details="description of your validator" \
--chain-id="flixnet-2" \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--gas="auto" \
--gas-adjustment="1.2" \
--gas-prices="0.025uwire" \
--from=<key_name>
```