From f370a5d800101238fc5c0d0e75f35cb98ef81dbf Mon Sep 17 00:00:00 2001 From: Alexander Kolesov Date: Thu, 15 Jul 2021 18:31:28 +0300 Subject: [PATCH 1/3] Rename how-to-add-new-node.md to how-to-setup-a-new-validator.md --- docs/{how-to-add-new-node.md => how-to-setup-a-new-validator.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/{how-to-add-new-node.md => how-to-setup-a-new-validator.md} (100%) diff --git a/docs/how-to-add-new-node.md b/docs/how-to-setup-a-new-validator.md similarity index 100% rename from docs/how-to-add-new-node.md rename to docs/how-to-setup-a-new-validator.md From 4940bf232519448ea3cb2955a182bd2153463bae Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Fri, 16 Jul 2021 12:40:00 +0300 Subject: [PATCH 2/3] Improve the instruction on how to set up a new validator --- README.md | 38 ++++- ci/docker_testnet/README.md | 2 +- docs/how-to-run-local-testnet-in-docker.md | 45 ------ docs/how-to-setup-a-new-validator.md | 159 +++++++++++++-------- 4 files changed, 133 insertions(+), 111 deletions(-) delete mode 100644 docs/how-to-run-local-testnet-in-docker.md diff --git a/README.md b/README.md index 861c3f212..cfd2bdb67 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,37 @@ verim is a blockchain built using Cosmos SDK and Tendermint and created with [Starport](https://github.com/tendermint/starport). -## Get started +## Building node from source + +Prerequisites: + +- Install [Go](https://golang.org/doc/install) +- Install [Starport](https://docs.starport.network/intro/install.html) + +To build the node executable run: + +``` +starport build +``` + +To look up binary's location run: + +``` +which verim-noded +``` + +## Building node in docker + +Use this [instruction](ci/docker/README.md). + +## Running local network using starport + +Prerequisites: + +- Install [Go](https://golang.org/doc/install) +- Install [Starport](https://docs.starport.network/intro/install.html) + +Only the network of one node is supported. To run the network of one node: ``` starport serve @@ -10,13 +40,11 @@ starport serve `serve` command installs dependencies, builds, initializes and starts your blockchain in development. -## Configure - Your blockchain in development can be configured with `config.yml`. To learn more see the [reference](https://github.com/tendermint/starport#documentation). -## Launch +## Running local network using docker -To launch your blockchain live on mutliple nodes use `starport network` commands. Learn more about [Starport Network](https://github.com/tendermint/spn). +Use this [instruction](ci/local_net/README.md). ## Learn more diff --git a/ci/docker_testnet/README.md b/ci/docker_testnet/README.md index 69bb74ef0..d271610d0 100644 --- a/ci/docker_testnet/README.md +++ b/ci/docker_testnet/README.md @@ -2,7 +2,7 @@ ## Description -Debian based docker image with the latest version of `verim-nonded` executable and preconfigured network of 4 nodes. Intended for use in CI pipelines. +Debian based docker image with the latest version of `verim-nonded` executable and preconfigured network of 2 nodes. Intended for use in CI pipelines. ## Prerequisites diff --git a/docs/how-to-run-local-testnet-in-docker.md b/docs/how-to-run-local-testnet-in-docker.md deleted file mode 100644 index a4dc14a13..000000000 --- a/docs/how-to-run-local-testnet-in-docker.md +++ /dev/null @@ -1,45 +0,0 @@ -# Running a Local Testnet in Docker - -This document describes steps how to run local testnet in docker. - -## Prerequisites - -You need to have Go and Node.js toolchains installed. - -## Deploy steps - -1. Build node executable: `starport build` -2. Use `genlocalnetconfig.sh` script to generate node configurations: `./genlocalnetconfig.sh` -3. Use docker-compose to run nodes: `docker-compose up --build` - -This will setup 4 nodes listening on the following ports: - -| | Node0 | Node1 | Node2 | Node3 | -|-----|-------|-------|-------|-------| -| P2P | 26656 | 26666 | 26676 | 26686 | -| RPC | 26657 | 26667 | 26677 | 26687 | - - -You can tests connection to a node using browser: `http://localhost:`. Example for the fitst node: `http://localhost:26657`. - -Keys of all accounts are located in `localnet/client`. When connecting using CLI, point path to home directory: `--home localnet/client`. This directory contains keys from genesis accounts. - -## Command examples: - -Show balances: - -``` -verim-noded query bank balances $(verim-noded keys show anna -a --home localnet/client) --home localnet/client -``` - -Create NYM: - -``` -verim-noded tx verimnode create-nym "alias" "verkey" "did" "role" --from anna --gas-prices 1token --chain-id verimnode --home localnet/client -``` - -List NYMs: - -``` -verim-noded query verimnode list-nym --home localnet/client -``` diff --git a/docs/how-to-setup-a-new-validator.md b/docs/how-to-setup-a-new-validator.md index 616c6a967..87b7df009 100644 --- a/docs/how-to-setup-a-new-validator.md +++ b/docs/how-to-setup-a-new-validator.md @@ -2,9 +2,10 @@ This document describes in detail how to configure a validator node, and add it to the existing network. -If a new network needs to be initialized, please first follow the instructions for [Creating a new network from genesis](how-to-deploy-genesis-network.md). After this, more validator nodes can be added by following the instructions from this document. +If a new network needs to be initialized, please first follow the instructions for [creating a new network from genesis](how-to-deploy-genesis-network.md). After this, more validator nodes can be added by following the instructions from this document. ### Hardware requirements + Minimal: - 1GB RAM - 25GB of disk space @@ -16,85 +17,123 @@ Recommended (for highload applications): - x64 2.0 GHz 2v CPU ### Operating System + Current delivery is compiled and tested for `Ubuntu 20.04 LTS` so we recommend using this distribution for now. In the future, it will be possible to compile the application for a wide range of operating systems thanks to the Go language. -## Deployment steps +### Binary distribution -New participant: +There are several ways to get binary: -1. Creates an account: +- Compile from source code - [instruction](../README.md); +- Get `tar` archive with the binary compiled for Ubuntu 20.04 in [releases](https://github.com/verim-id/verim-node/releases); <-- Recommended +- Get `deb` for Ubuntu 20.04 in [releases](https://github.com/verim-id/verim-node/releases); +- Get docker image form [packages](https://github.com/verim-id/verim-node/pkgs/container/verim-node). - - **Generates local keys for the future account:** +## Node deployment - Command: `verim-noded keys add ` +Follow these steps to deploy a new node: - Example: `verim-noded keys add alice` +1. Setup a server that satisfies [hardware requirements](#hardware-requirements) and [operating system requirements](#operating-system); - - **Asks another member to transfer some tokens:** + More about hardware requirements can be found [here](https://docs.tendermint.com/master/nodes/running-in-production.html#hardware). - Tokens are used to post transactions. It also used to create a stake for new nodes. +2. Get the binary using one of the [described ways](#binary-distribution); - Another mmber will ask for the address of the new participant. Cosmos account address is a function of the public key. - - Use this command to find out your adress and other key information: `verim-noded keys show ` + It's recommended to put the binary to the location which is in PATH. -2. Initializes new node and connects it to the network as observer: + Example: - - **Find out ``:** + ``` + cp verim-noded /usr/bin + ``` - Command `verim-noded status --node ` - - Chain id will show as `network` property. - - Another way is to look into the genesis file. The chain id should also be defined there. - - - **Initializes node config files:** - - Command: `verim-noded init --chain-id ` - - Example: `verim-noded init alice-node --chain-id verim-node` - - - **Gets genesis:** - - Genesis should be published for public networks. If not, you can ask any existing network participant for it. - - Location (destination) of the genesis file: `$HOME/.verimnode/config/genesis.json` - - - **Updates address book of your node:** +3. Initialize node config files: - Persistent nodes addresses should also be published publically. If not, you can ask any existing network participant for it. - - Open node's config file: `$HOME/.verimnode/config/config.toml` - - Search for `persistent_peers` parameter and set it's value to a comma separated list of other participant node addresses. + Command: `verim-noded init ` + + Example: `verim-noded init alice-node` - Format: `@, @, @, @`. +4. Set genesis: - Domain names can be used instead of IP adresses. + Genesis should be published for public networks. If not, you can ask any existing network participant for it. + + Location (destination) of the genesis file: `$HOME/.verimnode/config/genesis.json` - Example: +5. Set persistent peers: - ``` - persistent_peers = "d45dcc54583d6223ba6d4b3876928767681e8ff6@node0:26656, 9fb6636188ad9e40a9caf86b88ffddbb1b6b04ce@node1:26656, abbcb709fb556ce63e2f8d59a76c5023d7b28b86@node2:26656, cda0d4dbe3c29edcfcaf4668ff17ddcb96730aec@node3:26656" - ``` + Persistent nodes addresses should also be published publically. If not, you can ask any existing network participant for it. + + Open node's config file: `$HOME/.verimnode/config/config.toml` + + Search for `persistent_peers` parameter and set it's value to a comma separated list of other participant node addresses. + + Format: `@, @, @, @`. + + Domain names can be used instead of IP adresses. + + Example: + + ``` + persistent_peers = "d45dcc54583d6223ba6d4b3876928767681e8ff6@node0:26656, 9fb6636188ad9e40a9caf86b88ffddbb1b6b04ce@node1:26656, abbcb709fb556ce63e2f8d59a76c5023d7b28b86@node2:26656, cda0d4dbe3c29edcfcaf4668ff17ddcb96730aec@node3:26656" + ``` - - **Makes RPC endpoint available externally (optional):** - - This step is necessary if you want to allow incoming client application connections to your node. Otherwise, the node will be accessible only locally. - - Open the node configuration file using the text editor that you prefer: `$HOME/.verimnode/config/config.toml` - - Search for `ladr` parameter in `RPC Server Configuration Options` section and replace it's value to `0.0.0.0:26657` - - Example: `laddr = "tcp://0.0.0.0:26657"` - - - **Start node:** - - Command: `verim-noded start` - - It's better to use a process supervisor like `systemd` to run persistent nodes. +6. (optional) Make RPC endpoint available externally: + + This step is necessary if you want to allow incoming client application connections to your node. Otherwise, the node will be accessible only locally. + + Open the node configuration file using the text editor that you prefer: `$HOME/.verimnode/config/config.toml` + + Search for `ladr` parameter in `RPC Server Configuration Options` section and replace it's value to `0.0.0.0:26657` -3. Promotes the node to the validator: + Example: `laddr = "tcp://0.0.0.0:26657"` + +7. Configure firewall rules: + + Allow incoming tcp connections on the P2P port - `26656` by default. + + If you made RPC endpoint available externally, allow incoming tcp connections on the RPC port - `26657` by default. + + Allow all outgoing tcp connections for P2P communication. You can restrict port to the default P2P port `26656` but your node will not be able to connect to nodes with non default P2P port in this case. + +8. Start node: + + Command: `verim-noded start` + + It's highly recommended to use a process supervisor like `systemd` to run persistent nodes. + +9. (optional) Setup sentry nodes for DDOS protection: + + You can read about sentry nodes [here](https://docs.tendermint.com/master/nodes/validators.html). + +10. (optional) Setup cosmovisor for automatic updates: + + You can read about sentry nodes [here](https://docs.cosmos.network/master/run-node/cosmovisor.html). + +11. (optional) Read other advices about running node in production: + + You can read advices [here](https://docs.tendermint.com/master/nodes/running-in-production.html). + +## Network configuration + +Follow these steps to promote the deployed node to a validator: + +1. Create an account: + + - **Generate local keys for the future account:** + + Command: `verim-noded keys add ` + + Example: `verim-noded keys add alice` + + - **Ask another member to transfer some tokens:** + + Tokens are used to post transactions. It also used to create a stake for new nodes. + + Another mmber will ask for the address of the new participant. Cosmos account address is a function of the public key. + + Use this command to find out your adress and other key information: `verim-noded keys show ` + +3. Promote the node to the validator: - **Post a transaction to the network:** From 1a7a531669f9d1402c6a7b7e26ff1b6b34dd3bb8 Mon Sep 17 00:00:00 2001 From: Alexandr Kolesov Date: Fri, 16 Jul 2021 12:50:07 +0300 Subject: [PATCH 3/3] Fixed starport build command --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 2 +- ci/docker/Dockerfile | 2 +- ci/local_net/README.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17feb0fcb..240221862 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: uses: actions/checkout@v2 - name: Starport build - run: starport build + run: starport chain build build-node-and-testnet-images: name: Build node and testnet images diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 068183ec5..f6caec610 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -84,7 +84,7 @@ jobs: uses: actions/checkout@v2 - name: Build - run: starport build + run: starport chain build - name: Create artifacts directory run: mkdir ${{ env.OUTPUT_DIR }} diff --git a/README.md b/README.md index cfd2bdb67..5024f47d5 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Prerequisites: To build the node executable run: ``` -starport build +starport chain build ``` To look up binary's location run: diff --git a/ci/docker/Dockerfile b/ci/docker/Dockerfile index 4429ff179..eb491c344 100644 --- a/ci/docker/Dockerfile +++ b/ci/docker/Dockerfile @@ -24,7 +24,7 @@ COPY x ./x COPY go.mod . COPY go.sum . -RUN starport build +RUN starport chain build ##### Run container ##### diff --git a/ci/local_net/README.md b/ci/local_net/README.md index 8fd5e73ad..013f4e682 100644 --- a/ci/local_net/README.md +++ b/ci/local_net/README.md @@ -18,7 +18,7 @@ The set of scripts to generate configuration for a testnet of four nodes and run 2. Build verim-noded: ``` - starport build + starport chain build ``` 3. Generate node configurations: