Skip to main content

Supplier (RelayMiner) Cheat Sheet

Supplier Cheat Sheet

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

For detailed instructions, troubleshooting, and observability setup, see the Supplier Walkthrough.

note

These instructions are intended to run on a Linux machine.

TODO_TECHDEBT(@olshansky): Adapt instructions to be macOS friendly in order to streamline development and reduce friction for any new potential contributor.

Pre-Requisites

  1. Make sure to install the poktrolld CLI.
  2. Make sure you know how to create and fund a new account.
  3. You have either staked a new service or found an existing one.
  4. [Optional] You can run things locally or have dedicated long-running hardware. See the Docker Compose Cheat Sheet if you're interested in the latter.
warning

You can append --keyring-backend test to all the poktrolld commands throughout this guide to avoid entering the password each time.

This is not recommended but provided for convenience for NON PRODUCTION USE ONLY.

⚠️ Use at your own risk. ⚠️

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 off-chain, and claim on-chain rewards.

Account Setup

Create and fund the Supplier account

Create a new key pair for the Supplier

poktrolld keys add supplier

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:

export NODE="https://shannon-testnet-grove-rpc.beta.poktroll.com"
export NODE_FLAGS="--node=https://shannon-testnet-grove-rpc.beta.poktroll.com"
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)
tip

As an alternative to appending directly to ~/.bashrc, you can put the above in a special ~/.poktrollrc and add source ~/.poktrollrc to your ~/.profile (or ~/.bashrc) file for a cleaner organization.

Supplier Configuration

Fund the Supplier account

Run the following command to get the Supplier:

echo "Supplier address: $SUPPLIER_ADDR"

Then use the Shannon Beta TestNet faucet to fund the (supplier owner address) account. See Non-Custodial Staking for more information about supplier owner vs operator and non-custodial staking.

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

poktrolld query bank balances $SUPPLIER_ADDR $NODE_FLAGS
tip

You can find all the explorers, faucets and tools at the tools page.

Stake the Supplier

info

For an in-depth look at how to stake a supplier, see the Supplier configuration docs.

These instructions help you stake a supplier for a specific service (POKT Morse) using a pre-configured RPC endpoint (Liquify public RPC endpoint).

Retrieve your external IP address:

EXTERNAL_IP=$(curl -4 ifconfig.me/ip)

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

You can use the following command for OSs that use ufw (learn more here):

sudo ufw allow 8545/tcp

Create a Supplier stake configuration file:

cat <<🚀 > /tmp/stake_supplier_config.yaml
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
🚀

And run the following command to stake the Supplier:

poktrolld tx supplier stake-supplier --config /tmp/stake_supplier_config.yaml --from=$SUPPLIER_ADDR $TX_PARAM_FLAGS $NODE_FLAGS

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

poktrolld query supplier show-supplier $SUPPLIER_ADDR $NODE_FLAGS

RelayMiner Configuration

Configure the RelayMiner

cat <<🚀 > /tmp/relayminer_config.yaml
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
🚀

Start the RelayMiner

poktrolld \
relayminer \
--grpc-insecure=false \
--log_level=debug \
--config=/tmp/relayminer_config.yaml

Secure vs Non-Secure query_node_grpc_url

In /tmp/relayminer_config.yaml, you'll see that we specify an endpoint for query_node_grpc_url which is TLS terminated.

If grpc-insecure=true then it MUST be an HTTP port, no TLS. Once you have an endpoint exposed, it can be validated like so:

grpcurl -plaintext <host>:<port> list

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 shannon-testnet-grove-grpc.beta.poktroll.com:443 list

Note that no -plaintext flag is required when an endpoint is TLS terminated and must be omitted if it is not.

tip

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

Supplier FAQ

What Supplier operations are available?

poktrolld tx supplier -h

What Supplier queries are available?

poktrolld query supplier -h

How do I query for all existing onchain Suppliers?

Then, you can query for all services like so:

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