Skip to content

Commit

Permalink
[UPDATE BASE BEFORE MERGING][Docs] Update docker walkthrough & cheats…
Browse files Browse the repository at this point in the history
…heet (#982)

## Summary

Adapt docker-compose walkthrough and cheatsheet to use PATH instead of
AppGate.
This is a follow-up to AppGate-to-Path documentation PR #945 

It will be applicable once
pokt-network/poktroll-docker-compose-example#31
is merged.

## Issue

AppGate Server deprecation and removal requires documentation update to
use PATH Gateway instead.


## Type of change

Select one or more from the following:

- [ ] New feature, functionality or library
- [ ] Consensus breaking; add the `consensus-breaking` label if so. See
#791 for details
- [ ] Bug fix
- [ ] Code health or cleanup
- [x] Documentation
- [ ] Other (specify)

## Testing

- [x] **Documentation**: `make docusaurus_start`; only needed if you
make doc changes

## Sanity Checklist

- [x] I have tested my changes using the available tooling
- [ ] I have commented my code
- [x] I have performed a self-review of my own code; both comments &
source code
- [ ] I create and reference any new tickets, if applicable
- [ ] I have left TODOs throughout the codebase, if applicable

---------

Co-authored-by: Daniel Olshansky <[email protected]>
  • Loading branch information
red-0ne and Olshansk authored Dec 11, 2024
1 parent 471ba91 commit 5d8c6dc
Show file tree
Hide file tree
Showing 3 changed files with 198 additions and 157 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import ReactPlayer from "react-player";
- [Create new addresses for all your accounts and update .env](#create-new-addresses-for-all-your-accounts-and-update-env)
- [Fund your accounts](#fund-your-accounts)
- [Stake a Supplier \& Deploy a RelayMiner](#stake-a-supplier--deploy-a-relayminer)
- [Stake an Application \& Deploy a PATH Gateway](#stake-an-application--deploy-a-path-gateway)
- [Stake an Application and Gateway](#stake-an-application-and-gateway)
- [Deploy a PATH Gateway](#deploy-a-path-gateway)
- [Send a Relay](#send-a-relay)
- [Ensure you get a response](#ensure-you-get-a-response)
- [Managing a re-genesis](#managing-a-re-genesis)
Expand Down Expand Up @@ -157,24 +158,28 @@ address=$(awk '/address:/{print $3; exit}' /tmp/supplier | tr -d '\r'); sed -i "
Application:

```bash
poktrolld keys add application > /tmp/application
poktrolld keys add application

mnemonic=$(tail -n 1 /tmp/application | tr -d '\r'); sed -i "s|APPLICATION_MNEMONIC=\".*\"|APPLICATION_MNEMONIC=\"$mnemonic\"|" .env
privKey=$(export_priv_key_hex application); sed -i "s|APPLICATION_PRIV_KEY_HEX=\".*\"|APPLICATION_PRIV_KEY_HEX=\"$privKey\"|" .env

address=$(awk '/address:/{print $3; exit}' /tmp/application | tr -d '\r'); sed -i "s|APPLICATION_ADDR=\".*\"|APPLICATION_ADDR=\"$address\"|g" .env
address=$(poktrolld keys show application -a | tr -d '\r'); sed -i "s|APPLICATION_ADDR=\".*\"|APPLICATION_ADDR=\"$address\"|g" .env
```

Gateway:

```bash
poktrolld keys add gateway > /tmp/gateway
poktrolld keys add gateway

mnemonic=$(tail -n 1 /tmp/gateway | tr -d '\r'); sed -i "s|GATEWAY_MNEMONIC=\".*\"|GATEWAY_MNEMONIC=\"$mnemonic\"|" .env
privKey=$(export_priv_key_hex gateway); sed -i "s|GATEWAY_PRIV_KEY_HEX=\".*\"|GATEWAY_PRIV_KEY_HEX=\"$privKey\"|" .env

address=$(awk '/address:/{print $3; exit}' /tmp/gateway | tr -d '\r'); sed -i "s|GATEWAY_ADDR=\".*\"|GATEWAY_ADDR=\"$address\"|g" .env
address=$(poktrolld keys show gateway -a | tr -d '\r'); sed -i "s|GATEWAY_ADDR=\".*\"|GATEWAY_ADDR=\"$address\"|g" .env
```

FINALLY, `source .env` to update the environment variables.
FINALLY, update your environment:

```bash
source .env
```

## Fund your accounts

Expand Down Expand Up @@ -204,14 +209,14 @@ Stake the supplier:
```bash
sed -i -e s/YOUR_NODE_IP_OR_HOST/$NODE_HOSTNAME/g ./stake_configs/supplier_stake_config_example.yaml
sed -i -e s/YOUR_OWNER_ADDRESS/$SUPPLIER_ADDR/g ./stake_configs/supplier_stake_config_example.yaml
poktrolld tx supplier stake-supplier --config=/poktroll/stake_configs/supplier_stake_config_example.yaml --from=supplier --chain-id=poktroll --yes
poktrolld tx supplier stake-supplier --config=/poktroll/stake_configs/supplier_stake_config_example.yaml --from=supplier $TX_PARAM_FLAGS_BETA

# OPTIONALLY check the supplier's status
poktrolld query supplier show-supplier $SUPPLIER_ADDR

# Start the relay miner (please update the grove app ID if you can)
sed -i -e s/YOUR_NODE_IP_OR_HOST/$NODE_HOSTNAME/g relayminer/config/relayminer_config.yaml
sed -i -e "s|backend_url: \".*\"|backend_url: \"https://eth-mainnet.rpc.grove.city/v1/c7f14c60\"|g" relayminer/config/relayminer_config.yaml
sudo sed -i -e s/YOUR_NODE_IP_OR_HOST/$NODE_HOSTNAME/g relayminer/config/relayminer_config.yaml
sudo sed -i -e "s|backend_url: \".*\"|backend_url: \"https://eth-mainnet.rpc.grove.city/v1/c7f14c60\"|g" relayminer/config/relayminer_config.yaml
```

Start the supplier
Expand All @@ -222,29 +227,57 @@ docker compose up -d relayminer
docker logs -f --tail 100 relayminer
```

## Stake an Application & Deploy a PATH Gateway
## Stake an Application and Gateway

Stake the application:

```bash
poktrolld tx application stake-application --config=/poktroll/stake_configs/application_stake_config_example.yaml --from=application --chain-id=poktroll --yes
poktrolld tx application stake-application --config=/poktroll/stake_configs/application_stake_config_example.yaml --from=application $TX_PARAM_FLAGS_BETA

# OPTIONALLY check the application's status
poktrolld query application show-application $APPLICATION_ADDR
```

Stake the gateway:

```bash
poktrolld tx gateway stake-gateway --config=/poktroll/stake_configs/gateway_stake_config_example.yaml --from=gateway $TX_PARAM_FLAGS_BETA

# OPTIONALLY check the application's status
poktrolld query gateway show-gateway $GATEWAY_ADDR
```

Delegate the application to the gateway:

```bash
poktrolld tx application delegate-to-gateway $GATEWAY_ADDR --from=application $TX_PARAM_FLAGS_BETA

# OPTIONALLY check the application's delegation status
poktrolld query application show-application $APPLICATION_ADDR
```

## Deploy a PATH Gateway

Configure the PATH gateway:

```bash
sudo sed -i -e s/YOUR_PATH_GATEWAY_ADDRESS/$GATEWAY_ADDR/g gateway/config/gateway_config.yaml
sudo sed -i -e s/YOUR_PATH_GATEWAY_PRIVATE_KEY/$GATEWAY_PRIV_KEY_HEX/g gateway/config/gateway_config.yaml
sudo sed -i -e s/YOUR_OWNED_APP_PRIVATE_KEY/$APPLICATION_PRIV_KEY_HEX/g gateway/config/gateway_config.yaml
```

Start the PATH gateway:

```bash
docker compose up -d pathgw
docker compose up -d gateway
# OPTIONALLY view the logs
docker logs -f --tail 100 pathgw
docker logs -f --tail 100 gateway
```

## Send a Relay

```bash
curl http://eth-mainnet.$NODE_HOSTNAME:3000/v1 \
curl http://eth.localhost:3000/v1 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}'
Expand All @@ -256,7 +289,7 @@ To ensure you get a response, run the request a few times.

```bash
for i in {1..10}; do
curl http://$NODE_HOSTNAME:85/0021 \
curl http://eth.localhost:3000/v1 \
-X POST \
-H "Content-Type: application/json" \
--data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' \
Expand Down Expand Up @@ -306,14 +339,14 @@ echo $SUPPLIER_ADDR
```bash
# Import the faucet using the mnemonic
poktrolld keys add --recover -i faucet
poktrolld tx bank multi-send faucet $APPLICATION_ADDR $GATEWAY_ADDR $SUPPLIER_ADDR 100000upokt --chain-id=poktroll --yes
poktrolld tx bank multi-send faucet $APPLICATION_ADDR $GATEWAY_ADDR $SUPPLIER_ADDR 100000upokt $TX_PARAM_FLAGS_BETA
```

### Start the RelayMiner

```bash
# Stake
poktrolld tx supplier stake-supplier --config=/poktroll/stake_configs/supplier_stake_config_example.yaml --from=supplier --chain-id=poktroll --yes
poktrolld tx supplier stake-supplier --config=/poktroll/stake_configs/supplier_stake_config_example.yaml --from=supplier $TX_PARAM_FLAGS_BETA
# Check
poktrolld query supplier show-supplier $SUPPLIER_ADDR
# Start
Expand All @@ -326,11 +359,11 @@ docker logs -f --tail 100 relayminer

```bash
# Stake
poktrolld tx application stake-application --config=/poktroll/stake_configs/application_stake_config_example.yaml --from=application --chain-id=poktroll --yes
poktrolld tx application stake-application --config=/poktroll/stake_configs/application_stake_config_example.yaml --from=application $TX_PARAM_FLAGS_BETA
# Check
poktrolld query application show-application $APPLICATION_ADDR
# Start
docker compose up -d pathgw
docker compose up -d gateway
# View
docker logs -f --tail 100 pathgw
```
docker logs -f --tail 100 gateway
```
Loading

0 comments on commit 5d8c6dc

Please sign in to comment.