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] Beta TestNet - Supplier Cheatsheet #947

Merged
merged 34 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
f1f6136
WIP - Supplier cheatsheet
Olshansk Nov 21, 2024
98c3a89
WIP
Olshansk Nov 22, 2024
6303665
[Docs] Update links to RPC & explorers (#950)
Olshansk Nov 21, 2024
bd24703
Merge branch 'main' into supplier_cheatsheet
Olshansk Nov 25, 2024
f88ca87
Saving some old WIP
Olshansk Nov 25, 2024
2db06ee
Removed configs that sholdn't have been commited
Olshansk Nov 25, 2024
9ce8b2f
Finishing the service cheatsheet
Olshansk Nov 25, 2024
65a825d
Merge branch 'main' into service_cheasheet
Olshansk Nov 25, 2024
9fa7461
self review
Olshansk Nov 25, 2024
d952e5c
self review
Olshansk Nov 25, 2024
3b3c78e
Add back the supplier cheatsheet
Olshansk Nov 25, 2024
0c0794b
self review
Olshansk Nov 25, 2024
b1c22f8
Merge branch 'service_cheasheet' into supplier_cheatsheet
Olshansk Nov 25, 2024
fefd306
Adding the supplier cheatsheet back
Olshansk Nov 25, 2024
081f13f
Checkpoint
Olshansk Nov 26, 2024
6d2edc4
Merge with main
Olshansk Nov 26, 2024
9aed445
Merge branch 'main' into supplier_cheatsheet
Olshansk Dec 3, 2024
c293e09
Checkpoint - reviewing full node configs
Olshansk Dec 4, 2024
b0c00cf
Finish reviewing the full node walkthrough
Olshansk Dec 4, 2024
10c6598
Update the cheatsheet
Olshansk Dec 4, 2024
c2a22ac
rm supplier docs
Olshansk Dec 4, 2024
f2ac3fc
add supplier docs
Olshansk Dec 4, 2024
b196471
Merge with main
Olshansk Dec 5, 2024
8d64e2a
Merge branch 'main' into supplier_cheatsheet
Olshansk Dec 12, 2024
46fea4d
Updated the supplier cheatsheet
Olshansk Dec 13, 2024
2b0a9ac
Merge branch 'main' into supplier_cheatsheet
Olshansk Dec 13, 2024
53df701
Merge branch 'main' into supplier_cheatsheet
Olshansk Dec 16, 2024
dcafa02
Update docusaurus/docs/operate/quickstart/supplier_cheatsheet.md
Olshansk Dec 16, 2024
c9e0ff3
Apply some suggestions from code review
Olshansk Dec 17, 2024
2090fad
Update docusaurus/docs/operate/quickstart/supplier_cheatsheet.md
Olshansk Dec 17, 2024
3c6148d
Apply suggestions from code review
Olshansk Dec 17, 2024
d0a4925
Update docusaurus/docs/operate/quickstart/supplier_cheatsheet.md
Olshansk Dec 17, 2024
a88ed62
Followed up on some comments
Olshansk Dec 17, 2024
19e6f9b
Follow up on all comments
Olshansk Dec 17, 2024
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
8 changes: 7 additions & 1 deletion docusaurus/docs/operate/quickstart/gateway_cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ TODO_TECHDEBT(@olshansky): Adapt the instructions to be macOS friendly.
- [Check the `PATH Gateway` is serving relays](#check-the-path-gateway-is-serving-relays)

:::note

For detailed instructions, troubleshooting, and observability setup, see the [Gateway Walkthrough](./../run_a_node/gateway_walkthrough.md).

:::

## Pre-Requisites
Expand Down Expand Up @@ -66,7 +68,9 @@ poktrolld keys add gateway
:::tip

You can set the `--keyring-backend` flag to `test` to avoid entering the password
each time. Learn more about [cosmos keyring backends here](https://docs.cosmos.network/v0.46/run-node/keyring.html).
each time.

Learn more about [cosmos keyring backends here](https://docs.cosmos.network/v0.46/run-node/keyring.html).

:::

Expand Down Expand Up @@ -116,7 +120,9 @@ poktrolld query bank balances $APP_ADDR $NODE_FLAGS
```

:::tip

You can find all the explorers, faucets and tools at the [tools page](../../explore/tools.md).

:::

### Stake the `Gateway`
Expand Down
265 changes: 265 additions & 0 deletions docusaurus/docs/operate/quickstart/supplier_cheatsheet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,265 @@
---
sidebar_position: 6
title: Supplier (RelayMiner) Cheat Sheet
---

## Supplier Cheat Sheet <!-- omit in toc -->

This guide provides quick reference commands for setting up a **Supplier** and
running a **RelayMiner** on Pocket Network.

:::warning

These instructions are intended to run on a Linux machine.

TODO_TECHDEBT(@olshansky): Adapt the instructions to be macOS friendly.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

:::

- [Pre-Requisites](#pre-requisites)
- [Context](#context)
- [Account Setup](#account-setup)
- [Create and fund the `Supplier` account](#create-and-fund-the-supplier-account)
- [Prepare your environment](#prepare-your-environment)
- [Supplier Configuration](#supplier-configuration)
- [Fund the Supplier account](#fund-the-supplier-account)
- [Stake the Supplier](#stake-the-supplier)
- [RelayMiner Configuration](#relayminer-configuration)
- [Configure the RelayMiner](#configure-the-relayminer)
- [Start the RelayMiner](#start-the-relayminer)
- [Secure vs Non-Secure `query_node_grpc_url`](#secure-vs-non-secure-query_node_grpc_url)
- [Supplier FAQ](#supplier-faq)
- [What Supplier transactions are available?](#what-supplier-transactions-are-available)
- [What Supplier queries are available?](#what-supplier-queries-are-available)
- [How do I query for all existing onchain Suppliers?](#how-do-i-query-for-all-existing-onchain-suppliers)

:::note

For detailed instructions, troubleshooting, and observability setup, see the [Supplier Walkthrough](./../run_a_node/supplier_walkthrough.md).

:::

## Pre-Requisites

1. Make sure to [install the `poktrolld` CLI](../user_guide/install.md).
2. Make sure you know how to [create and fund a new account](../user_guide/create-new-wallet.md).
3. You have either [staked a new `service` or found an existing one](./service_cheatsheet.md).
4. `[Optional]` You can run things locally or have dedicated long-running hardware. See the [Docker Compose Cheat Sheet](./docker_compose_debian_cheatsheet#deploy-your-server) if you're interested in the latter.

### Context

This document is a cheat sheet to get you quickly started with two things:

1. Staking an onchain `Supplier`
2. Deploying an offchain `RelayMiner`

By the end of it, you should be able to serve Relays onchain.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

## Account Setup

### Create and fund the `Supplier` account

Create a new key pair for the `Supplier`

```bash
poktrolld keys add supplier

# Optionally, to avoid entering the password each time:
# poktrolld keys add supplier --keyring-backend test
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

:::tip

You can set the `--keyring-backend` flag to `test` to avoid entering the password
each time.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

Learn more about [cosmos keyring backends here](https://docs.cosmos.network/v0.46/run-node/keyring.html).
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

:::

### Prepare your environment

For convenience, we're setting several environment variables to streamline
the process of interacting with the Shannon network:

We recommend you put these in your `~/.bashrc` file:

```bash
export NODE="https://shannon-testnet-grove-rpc.beta.poktroll.com"
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
export NODE_FLAGS="--node=https://shannon-testnet-grove-rpc.beta.poktroll.com"
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
export TX_PARAM_FLAGS="--gas=auto --gas-prices=1upokt --gas-adjustment=1.5 --chain-id=pocket-beta --yes"
export SUPPLIER_ADDR=$(poktrolld keys show supplier -a)

# Optionally, to avoid entering the password each time:
# export SUPPLIER_ADDR=$(poktrolld keys show supplier -a --keyring-backend test
```

:::tip

You can put the above in a special `~/.poktrollrc` and add `source ~/.poktrollrc` to
your `~/.profile` file for a cleaner organization.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

:::

## Supplier Configuration

### Fund the Supplier account

Run the following command to get the `Supplier`:

```bash
echo "Supplier address: $SUPPLIER_ADDR"
```

Then use the [Shannon Beta TestNet faucet](https://faucet.beta.testnet.pokt.network/) to fund the account.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

Afterwards, you can query the balance using the following command:

```bash
poktrolld query bank balances $SUPPLIER_ADDR $NODE_FLAGS
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

:::tip

You can find all the explorers, faucets and tools at the [tools page](../../explore/tools.md).

:::

### Stake the Supplier

:::info

For an in-depth look at how to stake a supplier, see the [Supplier configuration docs](./../configs/supplier_staking_config.md).

The example below is a very quick and simple way to get you started by staking for
Pocket Network's Morse service on Shannon using a public RPC endpoint provided by
[Liquify](https://liquify.com/).
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

:::

Retrieve your external IP address:

```bash
EXTERNAL_IP=$(curl -4 ifconfig.me/ip)
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

Choose a port that'll be publicly accessible from the internet (e.g. `8545`)

```bash
sudo ufw allow 8545/tcp
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

Create a Supplier stake configuration file:

```bash
cat <<EOF > /tmp/stake_supplier_config.yaml
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
owner_address: $SUPPLIER_ADDR
operator_address: $SUPPLIER_ADDR
stake_amount: 1000069upokt
default_rev_share_percent:
$SUPPLIER_ADDR: 100
services:
- service_id: "morse"
endpoints:
- publicly_exposed_url: http://$EXTERNAL_IP:8545
rpc_type: JSON_RPC
EOF
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

And run the following command to stake the `Supplier`:

```bash
poktrolld tx supplier stake-supplier --config /tmp/stake_supplier_config.yaml --from=$SUPPLIER_ADDR $TX_PARAM_FLAGS $NODE_FLAGS
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

# Optionally, to avoid entering the password each time:
# poktrolld tx supplier stake-supplier --config /tmp/stake_supplier_config.yaml --from=$SUPPLIER_ADDR $TX_PARAM_FLAGS $NODE_FLAGS --keyring-backend test
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

After about a minute, you can check the `Supplier`'s status like so:

```bash
poktrolld query supplier show-supplier $SUPPLIER_ADDR $NODE_FLAGS
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

## RelayMiner Configuration

### Configure the RelayMiner

```bash
cat <<EOF > /tmp/relayminer_config.yaml
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
default_signing_key_names:
- supplier
smt_store_path: /home/pocket/.poktroll/smt
pocket_node:
query_node_rpc_url: https://shannon-testnet-grove-rpc.beta.poktroll.com
query_node_grpc_url: https://shannon-testnet-grove-grpc.beta.poktroll.com:443
tx_node_rpc_url: https://shannon-testnet-grove-rpc.beta.poktroll.com
suppliers:
- service_id: "morse"
service_config:
backend_url: "https://pocket-rpc.liquify.com"
publicly_exposed_endpoints:
- $EXTERNAL_IP
listen_url: http://0.0.0.0:8545
metrics:
enabled: false
addr: :9090
pprof:
enabled: false
addr: :6060
EOF
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
```

### Start the RelayMiner

```bash
poktrolld \
relayminer \
--grpc-insecure=false \
--log_level=debug \
--config=/tmp/relayminer_config.yaml \
# --keyring-backend=test
```

### Secure vs Non-Secure `query_node_grpc_url`

In `/tmp/relayminer_config.yaml`, you'll see that we specify an endpoint with TLS
for `query_node_grpc_url`.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

If `grpc-insecure=true` then it **MUST** be an HTTP port, no TLS.

The Grove team exposed one such endpoint on one of our validators for Beta Testnet at `http://149.28.34.68:9090`.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
It can be validated with `grpcurl -plaintext 149.28.34.68:9090`; note that the `-plaintext` flag meaning no TLS encryption.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

If `grpc-insecure=false`, then it **MUST** be an HTTPS port, with TLS.

The Grove team exposed one such endpoint on one of our validators for Beta Testnet at `https://shannon-testnet-grove-grpc.beta.poktroll.com:443`.
It can be validated with `grpcurl https://shannon-testnet-grove-grpc.beta.poktroll.com:443`; note no `-plaintext` flag meaning no TLS encryption.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
It can be validated with `grpcurl https://shannon-testnet-grove-grpc.beta.poktroll.com:443`; note no `-plaintext` flag meaning no TLS encryption.
It can be validated with `grpcurl https://shannon-testnet-grove-grpc.beta.poktroll.com:443`; note the absence of the `-plaintext` flag meaning no TLS encryption.


:::tip

You can replace both `http` and `https` with `tcp` and it should work the same.

:::

## Supplier FAQ

### What Supplier transactions are available?
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

```bash
poktrolld tx supplier -h
```

### What Supplier queries are available?

```bash
poktrolld query supplier -h
```

### How do I query for all existing onchain Suppliers?

Then, you can query for all services like so:

```bash
poktrolld query supplier list-supplier --node https://shannon-testnet-grove-rpc.beta.poktroll.com --output json | jq
```
Loading