Update demo instructions
This commit is contained in:
parent
8770b1df86
commit
65d2d3c979
@ -1,5 +1,7 @@
|
|||||||
# fixturenet-payments
|
# fixturenet-payments
|
||||||
|
|
||||||
|
Instructions to setup and deploy end-to-end fixturenet-payments stack using [laconic-stack-orchestrator](/README.md#install)
|
||||||
|
|
||||||
## Setup
|
## Setup
|
||||||
|
|
||||||
Clone required repositories:
|
Clone required repositories:
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
# Demo
|
# Demo
|
||||||
|
|
||||||
## MobyMask Watcher
|
Stack components:
|
||||||
|
* `ipld-eth-db` database for statediffed data
|
||||||
|
* Local geth + lighthouse blockchain "fixturenet" running in statediffing mode
|
||||||
|
* `ipld-eth-server` which runs an ETH RPC API and a GQL server; serves data from `ipld-eth-db`
|
||||||
|
* A go-nitro node acting as the Nitro node for `ipld-eth-server`
|
||||||
|
* A reverse payment proxy server that proxies requests to `ipld-eth-server`'s RPC endpoint; it talks to `ipld-eth-server`'s go-nitro node to validate payments required for configured RPC requests
|
||||||
|
* A MobyMask v3 watcher that pays the `ipld-eth-server` for ETH RPC requests
|
||||||
|
* A MobyMask v3 app that pays the watcher for GQL requests (queries + mutations)
|
||||||
|
* An example ERC20 Ponder app that pays the `ipld-eth-server` for ETH RPC requests
|
||||||
|
|
||||||
* Check watcher logs and wait for the payment channel to be created with upstream go-nitro node:
|
## Setup
|
||||||
|
|
||||||
|
* On starting the stack, MobyMask watcher creates a payment channel with the `ipld-eth-server`'s go-nitro node. Check watcher logs and wait for the same:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||||
@ -16,7 +26,9 @@
|
|||||||
# vulcanize:server Starting server... +0ms
|
# vulcanize:server Starting server... +0ms
|
||||||
```
|
```
|
||||||
|
|
||||||
* Export the payment channel id to a variable:
|
* Keep the above command running to keep track of incoming payments and GQL requests from the MobyMask app
|
||||||
|
|
||||||
|
* In another terminal, export the payment channel id to a variable:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||||
@ -41,23 +53,26 @@
|
|||||||
# }
|
# }
|
||||||
```
|
```
|
||||||
|
|
||||||
## MobyMask App
|
* In another terminal, check the reverse payment proxy server's logs to keep track of incoming payments and RPC requests:
|
||||||
|
|
||||||
* Track the reverse payment proxy container logs in a terminal:
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker logs -f $(docker ps -aq --filter name="nitro-reverse-payment-proxy")
|
docker logs -f $(docker ps -aq --filter name="nitro-reverse-payment-proxy")
|
||||||
```
|
```
|
||||||
|
|
||||||
* Get the geth node’s port mapped to host:
|
* MetaMask wallet setup for running the MobyMask app:
|
||||||
|
|
||||||
|
* Get the geth node’s port mapped to host:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker port payments-fixturenet-eth-geth-1-1 8545
|
docker port payments-fixturenet-eth-geth-1-1 8545
|
||||||
```
|
```
|
||||||
|
|
||||||
* In MetaMask Flask, add a custom network with the following settings:
|
* In MetaMask Flask, add a custom network with the following settings:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Network name
|
||||||
|
Local fixturenet
|
||||||
|
|
||||||
# New RPC URL
|
# New RPC URL
|
||||||
http://127.0.0.1:<GETH_PORT>
|
http://127.0.0.1:<GETH_PORT>
|
||||||
|
|
||||||
@ -68,16 +83,16 @@
|
|||||||
ETH
|
ETH
|
||||||
```
|
```
|
||||||
|
|
||||||
* Import the faucet account in MetaMask and fund an additional account for usage in the app:
|
* Import a faucet account with the following private key:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Faucet PK
|
# Faucet PK
|
||||||
# 0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
|
# 0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
|
||||||
|
|
||||||
# Clear activity tab for the accounts on chain restart
|
|
||||||
```
|
```
|
||||||
|
|
||||||
* Get the generated root invite link for the app from MobyMask contract deployment container logs:
|
* Create an additional account for usage in the app; fund it from the faucet account
|
||||||
|
|
||||||
|
* Get the generated root invite link for MobyMask from contract deployment container logs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||||
@ -89,9 +104,13 @@
|
|||||||
# http://127.0.0.1:3004/#/members?invitation=<INVITATION>
|
# http://127.0.0.1:3004/#/members?invitation=<INVITATION>
|
||||||
```
|
```
|
||||||
|
|
||||||
* Open app in a browser using the invite link
|
## Run
|
||||||
|
|
||||||
* Run the following in the browser console to enable logs:
|
### MobyMask App
|
||||||
|
|
||||||
|
* Open app in a browser (where MetaMask was setup) using the invite link
|
||||||
|
|
||||||
|
* Run the following in browser console to enable logs:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
localStorage.debug = 'ts-nitro:*'
|
localStorage.debug = 'ts-nitro:*'
|
||||||
@ -104,19 +123,19 @@
|
|||||||
* Click on `Connect Wallet` to connect to MetaMask (make sure that the newly funded account is active)
|
* Click on `Connect Wallet` to connect to MetaMask (make sure that the newly funded account is active)
|
||||||
* Click on `Connect Snap` to install/connect snap
|
* Click on `Connect Snap` to install/connect snap
|
||||||
|
|
||||||
* Perform `DIRECT FUND` with the preset amount
|
* Perform `DIRECT FUND` with the preset amount; confirm the transaction and wait for a ledger channel to be created with the watcher
|
||||||
|
|
||||||
* Perform `VIRTUAL FUND` with amount set to `10000`
|
* Perform `VIRTUAL FUND` with amount set to `10000` and wait for a payment channel to be created with the watcher
|
||||||
|
|
||||||
* Perform phisher status check queries now that a payment channel is created:
|
* Perform phisher status check queries now that a payment channel is created:
|
||||||
* Check the watcher logs for received payments
|
* Check the watcher logs for received payments along with the GQL queries
|
||||||
* Check the payment proxy server logs for charged RPC requests (`eth_getBlockByHash`, `eth_getBlockByNumber`, `eth_getStorageAt`) made from watcher to upstream ETH server
|
* The watcher makes several ETH RPC requests to `ipld-eth-server` to fetch data required for satisfying the GQL request(s); check the payment proxy server logs for charged RPC requests (`eth_getBlockByHash`, `eth_getBlockByNumber`, `eth_getStorageAt`)
|
||||||
|
|
||||||
* Change the amount besides `PAY` button to `>=100` for phisher reports next
|
* Change the amount besides `PAY` button to `>=100` for phisher reports next
|
||||||
|
|
||||||
* Perform a phisher report and check the watcher logs for received payments; the RPC mutation request is sent to geth node and is not charged
|
* Perform a phisher report and check the watcher logs for received payments; the RPC mutation request is sent to geth node and is not charged
|
||||||
|
|
||||||
* Check the watcher - eth-server payment channel status after a few requests:
|
* Check the watcher - ipld-eth-server payment channel status after a few requests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -h go-nitro -p 4005"
|
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -h go-nitro -p 4005"
|
||||||
@ -135,7 +154,7 @@
|
|||||||
# }
|
# }
|
||||||
```
|
```
|
||||||
|
|
||||||
## Ponder App
|
### ERC20 Ponder App
|
||||||
|
|
||||||
* Run the ponder app in it's container:
|
* Run the ponder app in it's container:
|
||||||
|
|
||||||
@ -150,13 +169,17 @@
|
|||||||
# 09:59:14.329 INFO payment Using payment channel 0x10f049519bc3f862e2b26e974be8666886228f30ea54aab06e2f23718afffab0
|
# 09:59:14.329 INFO payment Using payment channel 0x10f049519bc3f862e2b26e974be8666886228f30ea54aab06e2f23718afffab0
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* On starting the Ponder app, it creates a payment channel with the `ipld-eth-server`'s go-nitro node and then starts the historical sync service
|
||||||
|
|
||||||
|
* The sync service makes several ETH RPC requests to the `ipld-eth-server` to fetch required data; check the payment proxy server logs for charged RPC requests (`eth_getBlockByNumber`, `eth_getLogs`)
|
||||||
|
|
||||||
* Export the payment channel id to a variable:
|
* Export the payment channel id to a variable:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export PONDER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
export PONDER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||||
```
|
```
|
||||||
|
|
||||||
* Check the ponder - eth-server payment channel status:
|
* Check the ponder - ipld-eth-server payment channel status:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $PONDER_UPSTREAM_PAYMENT_CHANNEL -h go-nitro -p 4005"
|
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $PONDER_UPSTREAM_PAYMENT_CHANNEL -h go-nitro -p 4005"
|
||||||
@ -175,23 +198,14 @@
|
|||||||
# }
|
# }
|
||||||
```
|
```
|
||||||
|
|
||||||
* Check reverse payment proxy server logs for charged RPC requests made from ponder app to upstream ETH server:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# Expected output:
|
|
||||||
# ...
|
|
||||||
# {"time":"2023-09-28T09:59:14.499841999Z","level":"DEBUG","msg":"Request cost","cost-per-byte":1,"response-length":61,"cost":61}
|
|
||||||
# {"time":"2023-09-28T09:59:14.500060006Z","level":"DEBUG","msg":"sent message","address":"0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE","method":"receive_voucher"}
|
|
||||||
# {"time":"2023-09-28T09:59:14.501221898Z","level":"DEBUG","msg":"Received voucher","delta":5000}
|
|
||||||
# {"time":"2023-09-28T09:59:14.501245984Z","level":"DEBUG","msg":"Destination request","url":"http://ipld-eth-server:8081/?method=eth_getLogs"}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Clean Up
|
## Clean Up
|
||||||
|
|
||||||
* In the MobyMask app, perform `VIRTUAL DEFUND` and `DIRECT DEFUND` (in this order) for closing the payment channel created with watcher
|
* In the MobyMask app, perform `VIRTUAL DEFUND` and `DIRECT DEFUND` (in order) for closing the payment channel created with watcher
|
||||||
|
|
||||||
* Run the following in the browser console to delete the Nitro node's data:
|
* Run the following in the browser console to delete the Nitro node's data:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
await clearNodeStorage()
|
await clearNodeStorage()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* On a restart, clear activity tab data in MetaMask for concerned accounts
|
||||||
|
Loading…
Reference in New Issue
Block a user