From f93d646c94a701df8311fa3425444fc4ae7e5418 Mon Sep 17 00:00:00 2001 From: Vatsal Gupta Date: Mon, 12 Aug 2024 14:02:07 +0530 Subject: [PATCH] added validator setup for mainnet --- .../running-a-validator/on-mainnet/README.md | 21 ++++ .../on-mainnet/_category_.json | 4 + ...figure-and-run-an-orchestrator-instance.md | 114 ++++++++++++++++++ .../on-mainnet/run-a-node.mdx | 47 ++++++++ .../on-mainnet/setup-a-validator-account.md | 68 +++++++++++ .../on-testnet/_category_.json | 2 +- .../on-testnet/run-a-node.mdx | 2 +- 7 files changed, 256 insertions(+), 2 deletions(-) create mode 100644 docs/validators/running-a-validator/on-mainnet/README.md create mode 100644 docs/validators/running-a-validator/on-mainnet/_category_.json create mode 100644 docs/validators/running-a-validator/on-mainnet/configure-and-run-an-orchestrator-instance.md create mode 100644 docs/validators/running-a-validator/on-mainnet/run-a-node.mdx create mode 100644 docs/validators/running-a-validator/on-mainnet/setup-a-validator-account.md diff --git a/docs/validators/running-a-validator/on-mainnet/README.md b/docs/validators/running-a-validator/on-mainnet/README.md new file mode 100644 index 00000000..db825773 --- /dev/null +++ b/docs/validators/running-a-validator/on-mainnet/README.md @@ -0,0 +1,21 @@ +# On Mainnet + +## Hardware Requirements +Validators should be able to host one or more data center locations with redundant power, networking, firewalls, HSMs, and servers. The initial minimum recommended hardware specifications are specified below. These may change as network usage increases. + +```jsx +-> 6+ vCPU x64 2.0+ GHz +-> 16 to 32+ GB RAM +-> 1TB+ SSD +``` + +:::tip +To check you system configuration, run the following command on your terminal/command prompt: +- **On Linux:** `lshw` or `cat /proc/cpuinfo` +::: + +## Running a Validator on Router Mainnet +To run a validator on Router chain's mainnet, follow these 3 steps: +- [Run a Sentry Node on Mainnet](./on-mainnet/run-a-node) +- [Setup a Validator Account](./on-mainnet/setup-a-validator-account) +- [Configure and Run an Orchestrator Instance](./on-mainnet/configure-and-run-an-orchestrator-instance) \ No newline at end of file diff --git a/docs/validators/running-a-validator/on-mainnet/_category_.json b/docs/validators/running-a-validator/on-mainnet/_category_.json new file mode 100644 index 00000000..35a8d5f7 --- /dev/null +++ b/docs/validators/running-a-validator/on-mainnet/_category_.json @@ -0,0 +1,4 @@ +{ + "label": "On Mainnet", + "position": 1 +} \ No newline at end of file diff --git a/docs/validators/running-a-validator/on-mainnet/configure-and-run-an-orchestrator-instance.md b/docs/validators/running-a-validator/on-mainnet/configure-and-run-an-orchestrator-instance.md new file mode 100644 index 00000000..bcf60f51 --- /dev/null +++ b/docs/validators/running-a-validator/on-mainnet/configure-and-run-an-orchestrator-instance.md @@ -0,0 +1,114 @@ +--- +title: Step 3) Configure and Run an Orchestrator Instance +sidebar_position: 2 +--- + +After setting up the validator, immediately proceed to setup the orchestrator. This is a necessary step in order to prevent the validator from being slashed. + + +### Setup Orchestrator + +1. Create orchestrator account + + ```bash + export ORCHESTRATOR_KEY_NAME="my-orchestrator-name" + routerd keys add $ORCHESTRATOR_KEY_NAME --chain-id router_9600-1 --keyring-backend file + ``` + + get Orchestrator address + + ```bash + routerd keys show $ORCHESTRATOR_KEY_NAME -a --keyring-backend file + export ORCHESTRATOR_ADDRESS= + ``` + +2. Get funds to orchestrator account, check balance after getting funds + + ```bash + routerd q bank balances $ORCHESTRATOR_ADDRESS --chain-id router_9600-1 --keyring-backend file + ``` + +3. Map orchestrator address to validator address. + + `EVM-KEY-FOR-SIGNING-TXNS` is the public ethereum address. You can create one in Metamask, it doesnt need to have funds. We use it to sign transactions on EVM chains. Make sure to save the private key of this address somewhere safe. + + ```bash + export EVM_ADDRESS_FOR_SIGNING_TXNS= + routerd tx attestation set-orchestrator-address $ORCHESTRATOR_ADDRESS $EVM_ADDRESS_FOR_SIGNING_TXNS --from my-validator-key \ + --chain-id router_9600-1 \ + --fees 1000000000000000route \ + --keyring-backend file + ``` + +### Add config.json for Orchestrator + + ```json + { + "chains": [ + { + "chainId": "137", + "chainType": "CHAIN_TYPE_EVM", + "chainName": "Polygon", + "chainRpc": "www.polygon-rpc.com", + "blocksToSearch": 1000, + "blockTime": "5s" + } + ], + "globalConfig": { + "logLevel": "debug", + "networkType": "mainnet", + "dbPath": "orchestrator.db", + "batchSize": 25, + "batchWaitTime": 4, + "routerChainTmRpc": "http://0.0.0.0:26657", + "routerChainGRpc": "tcp://0.0.0.0:9090", + "evmAddress": "", + "cosmosAddress": "", + "ethPrivateKey": "", + "cosmosPrivateKey": "" + } + } + ``` + +- `routerChainTmRpc` and `routerChainGRpc`, point it to your validator IP +- `cosmosAddress` is Router address of orchestrator // router5678abcd +- `cosmosPrivateKey` is private key for your orchestrator cosmos address (private key of above `cosmosAddress`) +- `evmAddress` is EVM address of orchestrator which created in above step in Metamask //0x1234abcd +- `ethPrivateKey` is private key for the the above `evmAddress` wallet you created +- `loglevel` currently kept it as "debug" can be set as "info" evmAddress is EVM address of orchestrator //0x1234abcd + +### Start Validator and Orchestrator + +1. Start validator + + ```bash + sudo systemctl start cosmovisor.service + sudo systemctl status cosmovisor.service + + # check logs + journalctl -u cosmovisor -f + ``` + +2. Start orchestrator + + ```bash + sudo systemctl start orchestrator.service + sudo systemctl status orchestrator.service + + # check logs + journalctl -u orchestrator -f + ``` + +### Check validator and orchestrator status + +1. Check if node is syncing, make sure it is not stuck at some block height + + ```bash + routerd status | jq .SyncInfo.latest_block_height + ``` + +2. Check if orchestrator health is ok + + ```bash + curl localhost:8001/health + ``` \ No newline at end of file diff --git a/docs/validators/running-a-validator/on-mainnet/run-a-node.mdx b/docs/validators/running-a-validator/on-mainnet/run-a-node.mdx new file mode 100644 index 00000000..614b9bc0 --- /dev/null +++ b/docs/validators/running-a-validator/on-mainnet/run-a-node.mdx @@ -0,0 +1,47 @@ +--- +title: Step 1) Run a Sentry Node +sidebar_position: 1 +--- + +Before running a Sentry node on, install the following prerequisites: +- [Golang](https://go.dev/doc/install) (version > `1.21.0`) +- [Python](https://www.python.org/downloads/) (version > `3.9.1`) + +Once all the required dependencies are installed, create a JSON file +`config.json` with the following content: + +```json +{ + "snapshot_url": "https://ss.router.nodestake.org/2024-08-11_router_8721632.tar.lz4", + "seed_peers": "ebc272824924ea1a27ea3183dd0b9ba713494f83@router-mainnet-seed.autostake.com:27336,13a59edcee8ede7afa62ae054f266b44701cedc0@213.246.45.16:3656,10fec659763badc3ec55b845c2e6c17a70e77fd5@51.195.104.64:15656,49e4a20d999fe27868a67fc72bc6bf0e1424a610@188.214.133.133:26656,28459bddd2049d31cf642792e6bb87676edaee1e@65.109.61.125:23756,3f2556a0e390fa6f049e85fc0b27064f9ebdb9d7@57.129.28.26:26656,e90a88795977f7cc24982d5684f0f5a4581cd672@185.8.104.157:26656,fbb30fa866f318e9e1c48188711526fc69f66d18@188.214.133.174:26656", + "genesis": "https://sentry.tm.rpc.routerprotocol.com/genesis", + "genesis_checksum": "34de3eda1e4d9cce80328b96256629817c3baa0643413175e372077b027e9781", + "snap_rpc_url":"https://sentry.tm.rpc.routerprotocol.com/" +} +``` + +execute the following `curl` request from your terminal/command prompt to run a Sentry node on Router's mainnet: + +```bash +curl -L https://bit.ly/48BNjm4 > r.sh && bash r.sh config.json +``` + +:::info +After running the script, you'll be prompted to choose one of the following two options: +- **Option 1) Install Router -** Installs both the orchestrator and the validator. +- **Option 2) Install Orchestrator -** Installs just the orchestrator. + +In case you are following this setup for the first time, select **option 1**. +::: + + +This script will automatically: +1. Clone the `routerd` binary +2. Initialize the chain config +3. Update the default configuration using mainnet's genesis file +4. Configure `systemd` service for `cosmovisor` +5. Start syncing the chain + +:::info +Wait for the chain to sync to the latest block before moving to the next step. +::: \ No newline at end of file diff --git a/docs/validators/running-a-validator/on-mainnet/setup-a-validator-account.md b/docs/validators/running-a-validator/on-mainnet/setup-a-validator-account.md new file mode 100644 index 00000000..09693f8a --- /dev/null +++ b/docs/validators/running-a-validator/on-mainnet/setup-a-validator-account.md @@ -0,0 +1,68 @@ +--- +title: Step 2) Setup a Validator Account +sidebar_position: 2 +--- + +Before creating a validator account, make sure you are running a Sentry node with the chain synced to the latest block as specified in this [step](./run-a-sentry-node). + + +### Setup validator + +1. Create validator account + + ```bash + export VALIDATOR_KEY_NAME="my-validator-name" + routerd keys add $VALIDATOR_KEY_NAME --chain-id router_9600-1 --keyring-backend file + ``` + +2. Copy routerd address + + ```bash + routerd keys show $VALIDATOR_KEY_NAME -a --keyring-backend file + export VALIDATOR_ADDRESS= + ``` + +3. Fund routerd address with some $ROUTE tokens and check balance + + ```bash + routerd q bank balances $VALIDATOR_ADDRESS --chain-id router_9600-1 --keyring-backend file + ``` + +4. Create validator: Initialize new validator with self delegation of $ROUTE tokens. + + ```bash + export VALIDATOR_MONIKER="my-validator-moniker" + + routerd tx staking create-validator \ + --amount=1000000000000000000route \ + --pubkey=$(routerd tendermint show-validator) \ + --moniker=$VALIDATOR_MONIKER \ + --chain-id=router_9600-1 \ + --commission-rate="0.10" \ + --commission-max-rate="0.20" \ + --commission-max-change-rate="0.01" \ + --min-self-delegation="1000000" \ + --gas="auto" \ + --fees="100000000000000route" \ + --from=$VALIDATOR_KEY_NAME \ + --gas-adjustment=1.5 \ + --keyring-backend=file + ``` + +- `amount` flag is the initial amount of ROUTE you're willing to bond +- `pubkey` is the validator public key created earlier +- `moniker` is the human readable name you choose for your validator +- `chain-id` is the network id of the chain you are working with (in the case of Router mainnet: `router_9600-1`) +- `commission-rate` is the initial commission rate you will charge your delegates +- `commission-max-rate` is the highest rate you are allowed to charge your delegates +- `commission-max-change-rate` is how much you can increase your commission rate in a 24 hour period +- `min-self-delegation` is the lowest amount of personal funds the validator is required to have in their validator to stay bonded +- `from` flag is the KEY_NAME you created while initializing the key on your keyring + +5. Verify validator status + + ```bash + routerd q staking validator $VALIDATOR_ADDRESS --chain-id router_9600-1 --keyring-backend file + ``` + +If you see your validator in the list of validators, then congratulations, you have officially joined the Router mainnet as a staking validator! 🎉 diff --git a/docs/validators/running-a-validator/on-testnet/_category_.json b/docs/validators/running-a-validator/on-testnet/_category_.json index ee6c411d..b6aa8f14 100644 --- a/docs/validators/running-a-validator/on-testnet/_category_.json +++ b/docs/validators/running-a-validator/on-testnet/_category_.json @@ -1,4 +1,4 @@ { "label": "On Testnet", - "position": 1 + "position": 2 } \ No newline at end of file diff --git a/docs/validators/running-a-validator/on-testnet/run-a-node.mdx b/docs/validators/running-a-validator/on-testnet/run-a-node.mdx index a86c6818..6c352616 100644 --- a/docs/validators/running-a-validator/on-testnet/run-a-node.mdx +++ b/docs/validators/running-a-validator/on-testnet/run-a-node.mdx @@ -5,7 +5,7 @@ sidebar_position: 1 import APIData from '../../../../src/utils/ReturnChecksum'; Before running a node on the testnet, install the following prerequisites: -- [Golang](https://go.dev/doc/install) (version > `1.19`) +- [Golang](https://go.dev/doc/install) (version > `1.21.0`) - [Python](https://www.python.org/downloads/) (version > `3.9.1`) Once all the required dependencies are installed, execute the following `curl` request from your terminal/command prompt to run a node on Router's testnet: