Skip to content

Commit

Permalink
add mainnet docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshbhagi committed Aug 12, 2024
1 parent d22f898 commit e32e731
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 1 deletion.
21 changes: 21 additions & 0 deletions docs/validators/running-a-validator/on-mainnet/README.md
Original file line number Diff line number Diff line change
@@ -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-sentry-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)
Original file line number Diff line number Diff line change
@@ -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,[email protected]:3656,[email protected]:15656,[email protected]:26656,[email protected]:23756,[email protected]:26656,[email protected]:26656,[email protected]: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.
:::
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
---
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=<routerd-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! 🎉


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=<routerd-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=<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
```
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 1
---

Before running a Sentry node on , 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 Sentry node on Router's testnet:
Expand Down

0 comments on commit e32e731

Please sign in to comment.