From c02453b2d1f18b0fcb772cab95dd2595105c8f28 Mon Sep 17 00:00:00 2001 From: Sachin Kamath Date: Tue, 14 Nov 2023 16:57:04 +0530 Subject: [PATCH] docs: update staking denoms, outdated validator info and small improvements --- .../operators/src/nodes/validator-setup.md | 194 ++++++++---------- 1 file changed, 91 insertions(+), 103 deletions(-) diff --git a/documentation/operators/src/nodes/validator-setup.md b/documentation/operators/src/nodes/validator-setup.md index ca35c0b2b9..53f979019f 100644 --- a/documentation/operators/src/nodes/validator-setup.md +++ b/documentation/operators/src/nodes/validator-setup.md @@ -1,12 +1,12 @@ # Validators -> Nym has two main codebases: +> Nym has two main codebases: > - the [Nym platform](https://github.com/nymtech/nym), written in Rust. This contains all of our code except for the validators. -> - the [Nym validators](https://github.com/nymtech/nyxd), written in Go. +> - the [Nym validators](https://github.com/nymtech/nyxd), written in Go & maintained as a no-modification fork of [wasmd](https://github.com/CosmWasm/wasmd) -The validator is built using [Cosmos SDK](https://cosmos.network) and [Tendermint](https://tendermint.com), with a [CosmWasm](https://cosmwasm.com) smart contract controlling the directory service, node bonding, and delegated mixnet staking. +The validator is a Go application which implements it's functionalities using [Cosmos SDK](https://v1.cosmos.network/sdk). The underlying state-replication engine is powered by [CometBFT](https://cometbft.com/), where the consensus mechanism is based on the [Tendermint Consensus Algorithm](https://arxiv.org/abs/1807.04938). Finally, a [CosmWasm](https://cosmwasm.com) smart contract module controls crucial mixnet functionalities like decentralised directory service, node bonding, and delegated mixnet staking. -> We are currently working towards building up a closed set of reputable validators. You can ask us for coins to get in, but please don't be offended if we say no - validators are part of our system's core security and we are starting out with people we already know or who have a solid reputation. +> We are currently running mainnet with a closed set of reputable validators. To ensure decentralisation of Nyx chain, we are working on a mechanism to onboard new validators to the network. To join the waitlist, please drop an email to `validators [at] nymtech.net` with details of your setup, experience and any other relevent information ## Building your validator @@ -33,9 +33,9 @@ pacman -S git gcc jq `Go` can be installed via the following commands (taken from the [Go Download and install page](https://go.dev/doc/install)): ``` -# First remove any existing old Go installation and extract the archive you just downloaded into /usr/local: +# First remove any existing old Go installation and extract the archive you just downloaded into /usr/local: # You may need to run the command as root or through sudo -rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.6.linux-amd64.tar.gz +rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.10.linux-amd64.tar.gz # Add /usr/local/go/bin to the PATH environment variable export PATH=$PATH:/usr/local/go/bin @@ -47,16 +47,12 @@ Verify `Go` is installed with: ``` go version # Should return something like: -go version go1.20.4 linux/amd64 +go version go1.20.10 linux/amd64 ``` ### Download a precompiled validator binary You can find pre-compiled binaries for Ubuntu `22.04` and `20.04` [here](https://github.com/nymtech/nyxd/releases). -```admonish caution title="" -There are seperate releases for Mainnet and the Sandbox testnet - make sure to download the correct binary to avoid `bech32Prefix` mismatches. -``` - ### Manually compiling your validator binary The codebase for the Nyx validators can be found [here](https://github.com/nymtech/nyxd). @@ -64,15 +60,13 @@ The validator binary can be compiled by running the following commands: ``` git clone https://github.com/nymtech/nyxd.git cd nyxd + +# Make sure to check releases for the latest version information git checkout release/ -# Mainnet +# Build the binaries make build - -# Sandbox testnet -BECH32_PREFIX=nymt make build ``` - At this point, you will have a copy of the `nyxd` binary in your `build/` directory. Test that it's compiled properly by running: ``` @@ -83,50 +77,49 @@ You should see a similar help menu printed to you: ~~~admonish example collapsible=true title="Console output" ``` -Wasm Daemon (server) +Nyx Daemon (server) Usage: nyxd [command] Available Commands: - add-genesis-account Add a genesis account to genesis.json - add-wasm-genesis-message Wasm genesis subcommands - collect-gentxs Collect genesis txs and output a genesis.json file - config Create or query an application CLI configuration file - debug Tool for helping with debugging your application - export Export state to JSON - gentx Generate a genesis tx carrying a self delegation - help Help about any command - init Initialize private validator, p2p, genesis, and application configuration files - keys Manage your application's keys - query Querying subcommands - rollback rollback cosmos-sdk and tendermint state by one height - start Run the full node - status Query remote node for status - tendermint Tendermint subcommands - tx Transactions subcommands - validate-genesis validates the genesis file at the default location or at the location passed as an arg - version Print the application binary version information + completion Generate the autocompletion script for the specified shell + config Create or query an application CLI configuration file + debug Tool for helping with debugging your application + export Export state to JSON + genesis Application's genesis-related subcommands + help Help about any command + init Initialize private validator, p2p, genesis, and application configuration files + keys Manage your application's keys + prune Prune app history states by keeping the recent heights and deleting old heights + query Querying subcommands + rollback rollback cosmos-sdk and tendermint state by one height + rosetta spin up a rosetta server + start Run the full node + status Query remote node for status + tendermint Tendermint subcommands + testnet subcommands for starting or configuring local testnets + tx Transactions subcommands + version Print the application binary version information Flags: -h, --help help for nyxd - --home string directory for config and data (default "/home/willow/.nyxd") + --home string directory for config and data --log_format string The logging format (json|plain) (default "plain") --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") --trace print out full stack trace on errors Use "nyxd [command] --help" for more information about a command. - ``` ~~~ ### Linking `nyxd` to `libwasmvm.so` -`libwasmvm.so` is the wasm virtual machine which is needed to execute smart contracts in `v0.26.1`. This file is renamed in `libwasmvm.x86_64.so` in `v0.31.1`. +`libwasmvm.so` is the wasm virtual machine which is needed to execute smart contracts in `v0.26.1`. This file is renamed in `libwasmvm.x86_64.so` in `v0.31.1` and above. If you downloaded your `nyxd` binary from Github, you will have seen this file when un-`tar`-ing the `.tar.gz` file from the releases page. -If you are seeing an error concerning this file when trying to run `nyxd`, then you need to move the `libwasmvm.so` file to correct location. +If you are seeing an error concerning this file when trying to run `nyxd`, then you need to move the `libwasmvm.x86_64.so` file to correct location. Simply `cp` or `mv` that file to `/lib/x86_64-linux-gnu/` and re-run `nyxd`. @@ -152,40 +145,39 @@ This should return the regular help menu: ~~~admonish example collapsible=true title="Console output" ``` -Wasm Daemon (server) +Nyx Daemon (server) Usage: nyxd [command] Available Commands: - add-genesis-account Add a genesis account to genesis.json - add-wasm-genesis-message Wasm genesis subcommands - collect-gentxs Collect genesis txs and output a genesis.json file - config Create or query an application CLI configuration file - debug Tool for helping with debugging your application - export Export state to JSON - gentx Generate a genesis tx carrying a self delegation - help Help about any command - init Initialize private validator, p2p, genesis, and application configuration files - keys Manage your application's keys - query Querying subcommands - rollback rollback cosmos-sdk and tendermint state by one height - start Run the full node - status Query remote node for status - tendermint Tendermint subcommands - tx Transactions subcommands - validate-genesis validates the genesis file at the default location or at the location passed as an arg - version Print the application binary version information + completion Generate the autocompletion script for the specified shell + config Create or query an application CLI configuration file + debug Tool for helping with debugging your application + export Export state to JSON + genesis Application's genesis-related subcommands + help Help about any command + init Initialize private validator, p2p, genesis, and application configuration files + keys Manage your application's keys + prune Prune app history states by keeping the recent heights and deleting old heights + query Querying subcommands + rollback rollback cosmos-sdk and tendermint state by one height + rosetta spin up a rosetta server + start Run the full node + status Query remote node for status + tendermint Tendermint subcommands + testnet subcommands for starting or configuring local testnets + tx Transactions subcommands + version Print the application binary version information Flags: -h, --help help for nyxd - --home string directory for config and data (default "/home/willow/.nyxd") + --home string directory for config and data --log_format string The logging format (json|plain) (default "plain") --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) (default "info") --trace print out full stack trace on errors Use "nyxd [command] --help" for more information about a command. - ``` ~~~ @@ -224,7 +216,7 @@ You can use the following command to download them for the correct network: wget -O $HOME/.nyxd/config/genesis.json https://nymtech.net/genesis/genesis.json # Sandbox testnet -wget -O $HOME/.nyxd/config/genesis.json https://sandbox-validator1.nymtech.net/snapshots/genesis.json +wget -O $HOME/.nyxd/config/genesis.json https://sandbox-validator1.nymtech.net/snapshots/genesis.json | jq '.result.genesis' ``` ### `config.toml` configuration @@ -234,21 +226,18 @@ Edit the following config options in `$HOME/.nyxd/config/config.toml` to match t ``` # Mainnet persistent_peers = "ee03a6777fb76a2efd0106c3769daaa064a3fcb5@51.79.21.187:26656" -create_empty_blocks = false laddr = "tcp://0.0.0.0:26656" ``` ``` # Sandbox testnet cors_allowed_origins = ["*"] -persistent_peers = "8421c0a3d90d490e27e8061f2abcb1276c8358b6@sandbox-validator1.nymtech.net:26666" -create_empty_blocks = false +persistent_peers = "26f7782aff699457c8e6dd9a845e5054c9b0707e@sandbox-validator1.nymtech.net:26666" laddr = "tcp://0.0.0.0:26656" ``` -These affect the following: +These affect the following: * `persistent_peers = "@.nymtech.net:26666"` allows your validator to start pulling blocks from other validators. **The main sandbox validator listens on `26666` instead of the default `26656` for debugging**. It is recommended you do not change your port from `26656`. -* `create_empty_blocks = false` will save space * `laddr = "tcp://0.0.0.0:26656"` is in your p2p configuration options Optionally, if you want to enable [Prometheus](https://prometheus.io/) metrics then the following must also match in the `config.toml`: @@ -270,11 +259,11 @@ In the file `$HOME/nyxd/config/app.toml`, set the following values: ``` # Mainnet minimum-gas-prices = "0.025unym,0.025unyx" -enable = true in the `[api]` section to get the API server running ``` + ``` # Sandbox Testnet -minimum-gas-prices = "0.025unymt,0.025unyxt" +minimum-gas-prices = "0.025unym,0.025unyx" enable = true` in the `[api]` section to get the API server running ``` @@ -285,9 +274,13 @@ You'll need an admin account to be in charge of your validator. Set that up with nyxd keys add nyxd-admin ``` -This will add keys for your administrator account to your system's keychain and log your name, address, public key, and mnemonic. As the instructions say, remember to **write down your mnemonic**. +```admonish tip title="Key Backends" +Cosmos SDK offers multiple backends for securing your keys. Please refer to the Cosmos SDK [docs on available keyring backends](https://docs.cosmos.network/main/user/run-node/keyring#available-backends-for-the-keyring) to learn more +``` -You can get the admin account's address with: +While using the default settings, this will add keys for your account to your system's keychain and log your name, address, public key, and mnemonic. As the instructions say, remember to **write down your mnemonic**. + +You can get the current account address with: ``` nyxd keys show nyxd-admin -a @@ -297,10 +290,6 @@ Type in your keychain **password**, not the mnemonic, when asked. ## Starting your validator -```admonish caution title="" -If you are running a Sandbox testnet validator, please skip the `validate-genesis` command: it will fail due to the size of the genesis file as this is a fork of an existing chain state. -``` - Everything should now be ready to go. You've got the validator set up, all changes made in `config.toml` and `app.toml`, the Nym genesis file copied into place (replacing the initial auto-generated one). Now let's validate the whole setup: ``` @@ -313,7 +302,7 @@ If this check passes, you should receive the following output: File at /path/to/genesis.json is a valid genesis file ``` -> If this test did not pass, check that you have replaced the contents of `//.nymd/config/genesis.json` with that of the correct genesis file. +> If this test did not pass, check that you have replaced the contents of `//.nyxd/config/genesis.json` with that of the correct genesis file. ### Open firewall ports @@ -323,14 +312,18 @@ Before starting the validator, we will need to open the firewall ports: # if ufw is not already installed: sudo apt install ufw sudo ufw enable -sudo ufw allow 1317,26656,26660,22,80,443/tcp + +# Customise according to your port bindings. This is only for reference +# 26656 : p2p gossip port +# 26660: If prometheus is enabled +# 22 : Default SSH port +sudo ufw allow 26656,26660,22 + # to check everything worked sudo ufw status ``` -Ports `22`, `80`, and `443` are for ssh, http, and https connections respectively. The rest of the ports are documented [here](https://docs.cosmos.network/main/core/grpc_rest). - -For more information about your validator's port configuration, check the [validator port reference table](./maintenance.md#ports) below. +For more information about your validator's port configuration, check the [validator port reference table](./maintenance.md#ports) below. These can be customised in `app.toml` and `config.toml` files. > If you are planning to use [Cockpit](https://cockpit-project.org/) on your validator server then you will have defined a different `grpc` port in your `config.toml` above: remember to open this port as well. @@ -376,8 +369,7 @@ Once your validator has synced and you have received tokens, you can join consen ``` # Mainnet nyxd tx staking create-validator - --amount=10000000unyx - --fees=0unyx + --amount=<10000000unyx> --pubkey=$(/home///nyxd/binaries/nyxd tendermint show-validator) --moniker="" --chain-id=nyx @@ -387,14 +379,14 @@ nyxd tx staking create-validator --min-self-delegation="1" --gas="auto" --gas-adjustment=1.15 - --from="KEYRING_NAME" - --node https://rpc-1.nyx.nodes.guru:443 + --gas-prices=0.025unyx + --from=<"KEYRING_NAME"> + --node=https://rpc.nymtech.net:443 ``` ``` # Sandbox Testnet nyxd tx staking create-validator - --amount=10000000unyxt - --fees=5000unyxt + --amount=<10000000unyx> --pubkey=$(/home///nym/binaries/nyxd tendermint show-validator) --moniker="" --chain-id=sandbox @@ -404,13 +396,13 @@ nyxd tx staking create-validator --min-self-delegation="1" --gas="auto" --gas-adjustment=1.15 - --from="KEYRING_NAME" + --gas-prices=0.025unyx + --from=<"KEYRING_NAME"> --node https://sandbox-validator1.nymtech.net:443 ``` -You'll need either `unyxt` tokens on Sandbox, or `unyx` tokens on mainnet to perform this command. +You'll need Nyx tokens on mainnet / sandbox to perform the above tasks. -> We are currently working towards building up a closed set of reputable validators. You can ask us for coins to get in, but please don't be offended if we say no - validators are part of our system's core security and we are starting out with people we already know or who have a solid reputation. If you want to edit some details for your node you will use a command like this: @@ -424,8 +416,8 @@ nyxd tx staking edit-validator --identity="" --gas="auto" --gas-adjustment=1.15 + --gas-prices=0.025unyx --from="KEYRING_NAME" - --fees 2000unyx ``` ``` # Sandbox testnet @@ -437,8 +429,8 @@ nyxd tx staking edit-validator --identity="" --gas="auto" --gas-adjustment=1.15 + --gas-prices=0.025unyx --from="KEYRING_NAME" - --fees 2000unyxt ``` With above command you can specify the `gpg` key last numbers (as used in `keybase`) as well as validator details and your email for security contact. @@ -446,9 +438,6 @@ With above command you can specify the `gpg` key last numbers (as used in `keyba ### Automating your validator with systemd You will most likely want to automate your validator restarting if your server reboots. Checkout the [maintenance page](./maintenance.md#systemd) with a quick tutorial. -### Installing and configuring nginx for HTTPS - -If you want to set up a reverse proxying on the validator server to improve security and performance, using [nginx](https://www.nginx.com/resources/glossary/nginx/#:~:text=NGINX%20is%20open%20source%20software,%2C%20media%20streaming%2C%20and%20more.&text=In%20addition%20to%20its%20HTTP,%2C%20TCP%2C%20and%20UDP%20servers.), follow the manual on the [maintenance page](./maintenance.md#setup). ### Setting the ulimit @@ -466,7 +455,7 @@ nyxd tx slashing unjail --chain-id=nyx --gas=auto --gas-adjustment=1.4 - --fees=7000unyx + --gas-prices=0.025unyx ``` ``` # Sandbox Testnet @@ -476,7 +465,7 @@ nyxd tx slashing unjail --chain-id=sandbox --gas=auto --gas-adjustment=1.4 - --fees=7000unyxt + --gas-prices=0.025unyx ``` ### Upgrading your validator @@ -496,7 +485,7 @@ If the `/dev/sda` partition is almost full, try pruning some of the `.gz` syslog You can check your current balances with: ``` -nymd query bank balances ${ADDRESS} +nyxd query bank balances ${ADDRESS} ``` For example, on the Sandbox testnet this would return: @@ -504,7 +493,7 @@ For example, on the Sandbox testnet this would return: ```yaml balances: - amount: "919376" -denom: unymt +denom: unym pagination: next_key: null total: "0" @@ -516,22 +505,21 @@ You can, of course, stake back the available balance to your validator with the ``` # Mainnet -nyxd tx staking delegate VALOPERADDRESS AMOUNTunym +nyxd tx staking delegate VALOPERADDRESS AMOUNTunyx --from="KEYRING_NAME" --keyring-backend=os --chain-id=nyx --gas="auto" --gas-adjustment=1.15 - --fees 5000unyx -``` -``` + --gas-prices=0.025unyx + # Sandbox Testnet -nyxd tx staking delegate VALOPERADDRESS AMOUNTunymt +nyxd tx staking delegate VALOPERADDRESS AMOUNTunyx --from="KEYRING_NAME" --keyring-backend=os --chain-id=sandbox --gas="auto" --gas-adjustment=1.15 - --fees 5000unyxt + --gas-prices=0.025unyx ```