Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update testnet_instructions.md #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
175 changes: 109 additions & 66 deletions testnet_instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

## **Quick Links**

Genesis: `link`
Genesis: `https://raw.githubusercontent.com/Distributed-Validators-Synctems/sputnik-school-testnet/master/genesis.json`

Block explorer: `TBA`
Block explorer: https://sputnik-testnet-explorer.nodejumper.io/sputnik-school-testnet/staking

Seeds: TBA
Peers: `745870cb265d8c3785da62317d46ecfaf7afa20a@95.217.164.96:26656,db0b3f18280de5ef4cb294912df6a3bf2c1a3f49@95.214.53.164:26656,7413a980948bf2208876d8bb40bb76ea957b1d97@178.215.71.199:26656,d236c62edc593476ad79bb13b028ab80e1c15d3a@128.199.142.104:26656,af6a8ce05b07dadf452fde8c645814c579d06142@88.218.60.250:26656`,23cecdac3b81632feb8e39d9963080e1412b075f@84.54.44.147:26656

Chain Id: TBA
Chain Id: `sputnik-practice-1`

## **Hardware Requirements**

Expand All @@ -20,160 +20,203 @@ Here are the minimal hardware configs required for running a validator/sentry no

## **Software Requirements**

- Ubuntu 20.04+ or Debian 10+
- [Go v1.18+](https://golang.org/doc/install)
- Ubuntu 22.04+
- [Go v1.21](https://golang.org/doc/install)

## **Install Gaiad, Generate Wallet and Submit GenTx**
## **Install sputnikd, Generate Wallet and Submit GenTx**

### ****Cosmos Hub binaries installation (gaiad)****
### ****Sputnik app-chain binaries installation (sputnikd)****

For the sake of simplicity we decided to use Cosmos Hub service binary. In order to install it please follow steps from official Cosmos HUB [instructions](https://hub.cosmos.network/main/getting-started/installation.html). It is based on the `v7.0.2` version of `gaiad` binary. Please check version of used binary by running this command `gaiad version --long`. You should get big list of text and at the beginning of it you should have following lines:
Sputnik app testnet binary repo
https://github.com/Distributed-Validators-Synctems/sputnik-app-chain-practice

```
name: gaia
server_name: gaiad
version: v7.0.2
commit: cd27aaaf39cc7819b5164e4baf3fd5aad23ec52a
build_tags: netgo ledger
commit: d3ed2906478c1558e4be1a2e0f98305f7be46832
cosmos_sdk_version: v0.47.13-ics-lsm
go: go version go1.21.9 linux/amd64
name: sputnik
server_name: sputnik
version: main-d3ed2906478c1558e4be1a2e0f98305f7be46832
```

### Network init

`cd ~`
`gaiad init "<moniker-name>" --chain-id <current course chain id>`
```bash
cd ~
sputnikd init "<moniker-name>" --chain-id sputnik-practice-1
```

example:

`gaiad init course-participant-1 --chain-id dvs-course-testnet-1`
```bash
sputnikd init course-participant-1 --chain-id dvs-course-testnet
```

### **Create Validator Key**

It's very important that after you run this command that you save the seed phrase that is generated. If you do not save you phrase, you will not be able to recover this account.

`gaiad keys add <your validator key name>`
`sputnikd keys add <your validator key name>`

or restore existing wallet with mnemonic seed phrase. You will be prompted to enter mnemonic seed.

`gaiad keys add <key-name> --recover`
`sputnikd keys add <key-name> --recover`

or add keys using ledger

`gaiad keys add <key-name> --ledger`
`sputnikd keys add <key-name> --ledger`

Check your key:

`gaiad keys show <key-name> -a`
`sputnikd keys show <key-name> -a`

### ****Create account to genesis****

This command will help you to create account in your local genesis file. It will add funds to your address. Otherwise `gaiad getntx` command will fail because of lack of funds.
This command will help you to create account in your local genesis file. It will add funds to your address. Otherwise `sputnikd getntx` command will fail because of lack of funds.

`gaiad add-genesis-account <key-name> 1000000000uatom`
`sputnikd add-genesis-account <key-name> 1000000000usputnik`

### ****Create GenTX****

Create the gentx file. Note, your gentx will be rejected if you use any amount greater than 1000000000uatom.
Create the gentx file. Note, your gentx will be rejected if you use any amount greater than 10000000usputnik.

```
gaiad gentx <key-name> 1000000000uatom --output-document=gentx.json \
--chain-id=dvs-course-testnet-1 \
sputnikd gentx <key-name> 10000000usputnik \
--chain-id=sputnik-practice-1 \
--moniker="<moniker-name>" \
--website=<your-node-website> \
--details=<your-node-details> \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1"
--commission-max-change-rate="0.01"
```

After gentx will be ready you can find it in the `~/.gaiad/config/gentx` directory. After that you will be required to upload it into `gentxs` directory of this repository. Please name it using following template `gentx-<validator name>.json`.
After gentx will be ready you can find it in the `~/.sputnik/config/gentx` directory. After that you will be required to upload it into `gentxs` directory of this repository. Please name it using following template `gentx-<validator name>.json`.

In order to upload this file you will need to create fork of this repository. Please click on “Fork” button in the top right corner of this page, and name it somehow or leave repository name unchanged.

![fork.png](https://raw.githubusercontent.com/kuraassh/school-testnet/master/fork.png)

After that you can upload `gentx` file into appropriate directory of your repository. Next, you will need to create a PR (Pull request) to add changes from your cloned repository into main repository.

Please go into root directory of your repository and click on “Contribute” button.

![contribute.png](https://raw.githubusercontent.com/kuraassh/school-testnet/master/contribute.png)

You will see this popup window.

![popup.png](https://raw.githubusercontent.com/kuraassh/school-testnet/master/popup.png)

Please “Open pull request”, check data, put some description into text box field and click on “Create pull request” inside it. Congratulations you have created your first pull request!

### Create validator after genesis

```
gaiad tx staking create-validator \
--amount=1000000000uatom \
--pubkey=$(gaiad tendermint show-validator) \
--chain-id=dvs-course-testnet-1 \
sputnikd tx staking create-validator \
--amount=10000000usputnik \
--pubkey=$(sputnikd tendermint show-validator) \
--chain-id=sputnik-practice-1 \
--moniker="<moniker-name>" \
--website=<your-node-website> \
--website="<your-node-website>"\
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1" \
--gas="auto" \
--gas-prices="0.0025uatom" \
--gas-adjustment=1.3 \
--gas-prices="0.1usputnik" \
--from=<key_name>
```

## Run node

### ****Set Up Cosmovisor****
Install `curl`
```
sudo apt install curl -y
```

Set up cosmovisor to ensure any future upgrades happen flawlessly. To install Cosmovisor:
### ****Download genesis****

`go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@v1.0.0`
To download `genesis.json` file
```
curl https://raw.githubusercontent.com/Distributed-Validators-Synctems/sputnik-school-testnet/master/genesis.json > ~/.sputnik/config/genesis.json
```
After downloading you need to verify your `genesis.json` checksum

Create the required directories:
```
sha256sum ~/.sputnik/config/genesis.json
```

you should see `d416341bd5dd384bb78dc43c0a4413014827c54e82989df9fcc28d3d5df5e8ab` in the output.

Set the peers
```bash
PEERS="745870cb265d8c3785da62317d46ecfaf7afa20a@95.217.164.96:26656,db0b3f18280de5ef4cb294912df6a3bf2c1a3f49@95.214.53.164:26656,7413a980948bf2208876d8bb40bb76ea957b1d97@178.215.71.199:26656,d236c62edc593476ad79bb13b028ab80e1c15d3a@128.199.142.104:26656,af6a8ce05b07dadf452fde8c645814c579d06142@88.218.60.250:26656"
sed -i 's|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.sputnik/config/config.toml
```
mkdir -p ~/.gaiad/cosmovisor/genesis/bin
mkdir -p ~/.gaiad/cosmovisor/upgrades

Set `minimum-gas-prices` to `.sputnik/config/app.toml`
```bash
MIN_GAS_PRICES=0.001usputnik
sed -i 's|^minimum-gas-prices *=.*|minimum-gas-prices = "'$MIN_GAS_PRICES'"|' $HOME/.sputnik/config/app.toml
```

After directories will be ready please copy `gaiad` binaries created in the “Cosmos Hub binaries installation (gaiad)” section into `~/.gaiad/cosmovisor/genesis/bin` directory. You can do it using `cp ~/go/bin/gaiad ~/.gaiad/cosmovisor/genesis/bin/gaiad` command.
### ****Set Up Cosmovisor****

### ****Set Up Gaiad Service****
Set up cosmovisor to ensure any future upgrades happen flawlessly. To install Cosmovisor
```
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0
```

Set up a service to allow cosmovisor to run in the background as well as restart automatically if it runs into any problems:
Create the required directories and files
```
mkdir -p ~/.sputnik/cosmovisor/genesis/bin
mkdir -p ~/.sputnik/cosmovisor/upgrades
```

After directories will be ready please copy `sputnikd` binaries created in the “Cosmos Hub binaries installation (sputnikd)” section into `~/.sputnikd/cosmovisor/genesis/bin` directory. You can do it using next command
```
cp ~/go/bin/sputnikd ~/.sputnik/cosmovisor/genesis/bin/sputnikd
```

### ****Set Up sputnikd Service****

Set up a service to allow cosmovisor to run in the background as well as restart automatically if it runs into any problems:
```
echo "[Unit]
Description=Cosmos Hub daemon
sudo tee /etc/systemd/system/sputnikd.service > /dev/null << EOF
[Unit]
Description=Sputnik app chain daemon
After=network-online.target
[Service]
Environment="DAEMON_NAME=gaiad"
Environment="DAEMON_HOME=${HOME}/.gaiad"
Environment="DAEMON_NAME=sputnikd"
Environment="DAEMON_HOME=${HOME}/.sputnik"
Environment="DAEMON_RESTART_AFTER_UPGRADE=true"
Environment="DAEMON_ALLOW_DOWNLOAD_BINARIES=false"
Environment="DAEMON_LOG_BUFFER_SIZE=512"
Environment="UNSAFE_SKIP_BACKUP=true"
User=$USER
ExecStart=${HOME}/go/bin/cosmovisor start
ExecStart=${HOME}/go/bin/cosmovisor run start
Restart=always
RestartSec=3
LimitNOFILE=infinity
LimitNPROC=infinity
[Install]
WantedBy=multi-user.target
" >cosmovisor.service
EOF
```

Move this new file to the systemd directory:
And start service:
```
sudo systemctl daemon-reload
sudo systemctl enable sputnikd
sudo systemctl restart sputnikd
```

`sudo mv cosmovisor.service /lib/systemd/system/gaiad.service`
How you can check the logs
```
sudo journalctl -u sputnikd -f
```

Set chain-id to `sputnik-practice-1` (for CLI)
```
sputnikd config chain-id sputnik-practice-1
```

## **More about validators**

Please refer to the Cosmos Hub documentation on validators for a general overview of running a validator. We are using the exact same validator model and software, but with slightly different parameters and other functionality specific to the Cosmic Horizon Network.

- [Run a Validator](https://hub.cosmos.network/main/validators/validator-setup.html)
- [Validators Overview](https://hub.cosmos.network/main/validators/overview.html)
- [Validator Security](https://hub.cosmos.network/main/validators/security.html)
- [Validator FAQ](https://hub.cosmos.network/main/validators/validator-faq.html)
- [Run a Validator](https://hub.cosmos.network/validators/validator-setup)
- [Validators Overview](https://hub.cosmos.network/validators/overview)
- [Validator Security](https://hub.cosmos.network/validators/security)
- [Validator FAQ](https://hub.cosmos.network/validators/validator-faq)