Skip to content

Commit

Permalink
[Docs] Beta TestNet - Supplier Cheatsheet (#947)
Browse files Browse the repository at this point in the history
Adding the Supplier cheatsheet!

Issue #901

---------

Co-authored-by: Dima K. <[email protected]>
Co-authored-by: Bryan White <[email protected]>
  • Loading branch information
3 people authored Dec 18, 2024
1 parent 91250b3 commit 7ed0e99
Show file tree
Hide file tree
Showing 2 changed files with 311 additions and 46 deletions.
76 changes: 30 additions & 46 deletions docusaurus/docs/operate/quickstart/gateway_cheatsheet.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@ sidebar_position: 7
title: Gateway Cheat Sheet
---

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

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

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

:::note

These instructions are intended to run on a Linux machine.

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

:::

Expand All @@ -32,15 +36,22 @@ TODO_TECHDEBT(@olshansky): Adapt the instructions to be macOS friendly.
- [\[TODO\] Run the `PATH` Gateway using Docker](#todo-run-the-path-gateway-using-docker)
- [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

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).

:::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. ⚠️

:::

## Account Setup

### Create and fund the `Gateway` and `Application` accounts
Expand All @@ -49,27 +60,14 @@ Create a new key pair for the delegating `Application`:

```bash
poktrolld keys add application

# Optionally, to avoid entering the password each time:
# poktrolld keys add application --keyring-backend test
```

Create a new key pair for the `Gateway`:

```bash
poktrolld keys add gateway

# Optionally, to avoid entering the password each time:
# poktrolld keys add gateway --keyring-backend test
```

:::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).

:::

### Prepare your environment

For convenience, we're setting several environment variables to streamline
Expand All @@ -78,21 +76,18 @@ 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"
export NODE_FLAGS="--node=https://shannon-testnet-grove-rpc.beta.poktroll.com"
export POCKET_NODE="https://shannon-testnet-grove-rpc.beta.poktroll.com"
export NODE_FLAGS="--node=$POCKET_NODE"
export TX_PARAM_FLAGS="--gas=auto --gas-prices=1upokt --gas-adjustment=1.5 --chain-id=pocket-beta --yes"
export GATEWAY_ADDR=$(poktrolld keys show gateway -a)
export APP_ADDR=$(poktrolld keys show application -a)

# Optionally, to avoid entering the password each time:
# export GATEWAY_ADDR=$(poktrolld keys show gateway -a --keyring-backend test)
# export APP_ADDR=$(poktrolld keys show application -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.
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.

:::

Expand All @@ -116,26 +111,25 @@ 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`

Create a Gateway stake configuration file:

```bash
cat <<EOF > /tmp/stake_gateway_config.yaml
cat <<🚀 > /tmp/stake_gateway_config.yaml
stake_amount: 1000000upokt
EOF
🚀
```

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

```bash
poktrolld tx gateway stake-gateway --config=/tmp/stake_gateway_config.yaml --from=$GATEWAY_ADDR $TX_PARAM_FLAGS $NODE_FLAGS

# Optionally, to avoid entering the password each time:
# poktrolld tx gateway stake-gateway --config=/tmp/stake_gateway_config.yaml --from=$GATEWAY_ADDR $TX_PARAM_FLAGS $NODE_FLAGS --keyring-backend test
```

After about a minute, you can check the `Gateway`'s status like so:
Expand All @@ -149,20 +143,17 @@ poktrolld query gateway show-gateway $GATEWAY_ADDR $NODE_FLAGS
Create an Application stake configuration file:

```bash
cat <<EOF > /tmp/stake_app_config.yaml
cat <<🚀 > /tmp/stake_app_config.yaml
stake_amount: 100000000upokt
service_ids:
- "F00C"
EOF
🚀
```

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

```bash
poktrolld tx application stake-application --config=/tmp/stake_app_config.yaml --from=$APP_ADDR $TX_PARAM_FLAGS $NODE_FLAGS

# Optionally, to avoid entering the password each time:
# poktrolld tx application stake-application --config=/tmp/stake_app_config.yaml --from=$APP_ADDR $TX_PARAM_FLAGS $NODE_FLAGS --keyring-backend test
```

After about a minute, you can check the `Application`'s status like so:
Expand All @@ -175,9 +166,6 @@ poktrolld query application show-application $APP_ADDR $NODE_FLAGS

```bash
poktrolld tx application delegate-to-gateway $GATEWAY_ADDR --from=$APP_ADDR $TX_PARAM_FLAGS $NODE_FLAGS

# Optionally, to avoid entering the password each time:
# poktrolld tx application delegate-to-gateway $GATEWAY_ADDR --from=$APP_ADDR $TX_PARAM_FLAGS $NODE_FLAGS --keyring-backend test
```

After about a minute, you can check the `Application`'s status like so:
Expand Down Expand Up @@ -233,10 +221,6 @@ sed -i "s|host_port: ".*"|host_port: shannon-testnet-grove-grpc.beta.poktroll.co
sed -i "s|gateway_address: .*|gateway_address: $GATEWAY_ADDR|" config/.config.yaml
sed -i "s|gateway_private_key_hex: .*|gateway_private_key_hex: $(export_priv_key_hex gateway)|" config/.config.yaml
sed -i '/owned_apps_private_keys_hex:/!b;n;c\ - '"$(export_priv_key_hex application)" config/.config.yaml

# If you're using the test keyring-backend:
# sed -i "s|gateway_private_key_hex: .*|gateway_private_key_hex: $(export_priv_key_hex gateway)|" config/.config.yaml
# sed -i '/owned_apps_private_keys_hex:/!b;n;c\ - '"$(export_priv_key_hex application)" config/.config.yaml
```

When you're done, run `cat config/.config.yaml` to view the updated config file.
Expand Down
Loading

0 comments on commit 7ed0e99

Please sign in to comment.