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

[Docs] Validator cheatsheet and walkthrough #1012

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
161 changes: 148 additions & 13 deletions docusaurus/docs/operate/quickstart/validator_cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,163 @@ title: Validator Cheat Sheet
sidebar_position: 4
---

## Validator Cheat Sheet <!-- omit in toc -->
This cheat sheet provides quick copy-pasta instructions for staking and running a Validator node on Pocket Network.

<!-- TODO_MAINNET(@okdas, #754): Update this page with all the details. -->
- [Prerequisites](#prerequisites)
- [Account Setup](#account-setup)
- [Create and Fund the Validator Account](#create-and-fund-the-validator-account)
- [Get the Validator's PubKey](#get-the-validators-pubkey)
- [Create the Validator JSON File](#create-the-validator-json-file)
- [Create the Validator](#create-the-validator)
- [Verify the Validator Status](#verify-the-validator-status)
- [Additional Commands](#additional-commands)
- [Notes](#notes)

This cheat sheet provides quick copy-pasta like instructions for installing and
running a Validator using an automated script.
## Prerequisites

**Run a Full Node**: Make sure you have followed the [Full Node Cheat Sheet](./full_node_cheatsheet.md) to install and run a Full Node first.

## Account Setup

:::tip

If you're interested in understanding everything, or having full control of every
step, check out the [Validator Walkthrough](../run_a_node/validator_walkthrough.md).
if you're running a full node using the [Full Node Cheat Sheet](./full_node_cheatsheet.md), you can can switch to
the user you created in the full node setup to get access to the `poktrolld` CLI. Like this:

```bash
su - poktroll # or a different user if you used a different name
```

:::

- [Introduction](#introduction)
- [Pre-Requisites](#pre-requisites)
### Create and Fund the Validator Account

Create a new key pair for the validator:

```bash
poktrolld keys add validator
```

This will generate a new address and mnemonic. **Save the mnemonic securely**.

Set the validator address in an environment variable for convenience:

```bash
export VALIDATOR_ADDR=$(poktrolld keys show validator -a)
```

Fund the validator account using [the faucet](../../explore/tools.md) or by transferring tokens from another account.

Check the balance:

```bash
poktrolld query bank balances $VALIDATOR_ADDR
```

## Get the Validator's PubKey

To get the validator's public key, run:

```bash
poktrolld comet show-validator
```

This will output something like:

```json
{"@type":"/cosmos.crypto.ed25519.PubKey","key":"YdlQyhjtrq9pk7afmz6oQ275L4FElzjzEJvB1fj3e1w="}
```

Copy the entire output; you will need it in the next step.

## Create the Validator JSON File

Create a JSON file named `validator.json` with the following content:

```json
{
"pubkey": {"@type":"/cosmos.crypto.ed25519.PubKey","key":"YdlQyhjtrq9pk7afmz6oQ275L4FElzjzEJvB1fj3e1w="},
"amount": "1000000upokt",
"moniker": "YourValidatorName",
"identity": "",
"website": "",
"security": "",
"details": "",
"commission-rate": "0.100000000000000000",
"commission-max-rate": "0.200000000000000000",
"commission-max-change-rate": "0.010000000000000000",
"min-self-delegation": "1"
}
```

- Replace the `"pubkey"` value with the output from `poktrolld comet show-validator`.
- Update the `"amount"` field with the amount you wish to stake (e.g., `"1000000upokt"`).
- Set the `"moniker"` to your validator's name.
- You can optionally fill in `"identity"`, `"website"`, `"security"`, and `"details"`.

## Create the Validator

## Introduction
Run the following command to create the validator:

This guide will help you install a Validator on Pocket Network,
**using helpers that abstract out some of the underlying complexity.**
```bash
poktrolld tx staking create-validator ./validator.json --from=validator --chain-id=pocket-beta --gas=auto --gas-adjustment=1.5 --gas-prices=1upokt
```

### Pre-Requisites
This command uses the `validator.json` file to submit the `create-validator` transaction.

1. **Run a Full Node**: Make sure you have followed the [Full Node Cheat Sheet](../quickstart/full_node_cheatsheet.md) to install and run a Full Node first
**Example**:

```bash
poktrolld tx staking create-validator ./validator.json --from=validator --chain-id=pocket-beta --gas=auto --gas-prices=1upokt --gas-adjustment=1.5
```

## Verify the Validator Status

You can verify the status of your validator by running:

```bash
poktrolld query staking validator $VALIDATOR_ADDR
```

This will display information about your validator, including its status and delegation.

## Additional Commands

- **Delegate additional tokens to your validator**:

```bash
poktrolld tx staking delegate $VALIDATOR_ADDR 1000000upokt --from your_account --chain-id=pocket-beta --gas=auto --gas-adjustment=1.5 --gas-prices=1upokt
```

- **Unbond (undelegate) tokens from your validator**:

```bash
poktrolld tx staking unbond $VALIDATOR_ADDR 500000upokt --from your_account --chain-id=pocket-beta --gas=auto --gas-adjustment=1.5 --gas-prices=1upokt
```

- **Withdraw rewards**:

```bash
poktrolld tx distribution withdraw-rewards $VALIDATOR_ADDR --commission --from validator --chain-id=pocket-beta --gas=auto --gas-adjustment=1.5 --gas-prices=1upokt
```

- **Check validator's commission and rewards**:

```bash
poktrolld query distribution commission $VALIDATOR_ADDR
poktrolld query distribution rewards $VALIDATOR_ADDR
```

## Notes

- Ensure your node is fully synced before attempting to create the validator.
- Keep your mnemonic and private keys secure.
- Adjust the `"amount"` in `validator.json` and delegation amounts according to your available balance.
- The `commission-rate`, `commission-max-rate`, and `commission-max-change-rate` are expressed as decimal numbers (e.g., `0.1` for 10%).

:::tip

If you're interested in understanding everything validator related, or having full control of every
step, check out the [Validator Walkthrough](../run_a_node/validator_walkthrough.md).

:::
Loading
Loading