Setup ipld-eth-server communicating with a remote Nitro node (#587)
* Use durable store for in-process Nitro node * Update setup for external go-nitro node * Add a separate service for ipld-eth-server with remote Nitro node * Update repo branches / versions * Wait for external Nitro node endpoint and update instructions * Update repo branches
This commit is contained in:
parent
8246e3551f
commit
3262ebe4ac
@ -11,10 +11,13 @@ services:
|
||||
condition: service_completed_successfully
|
||||
environment:
|
||||
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
|
||||
CERC_NITRO_PK: ${CERC_NITRO_PK:-2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d}
|
||||
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597}
|
||||
CERC_NITRO_PK: ${CERC_NITRO_PK:-f36f6dd450892224ee113899195ef922a4795d41c32cafb386d9aab6e0b7b0c6}
|
||||
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218}
|
||||
CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true}
|
||||
CERC_NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
||||
CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT:-3006}
|
||||
CERC_NITRO_WS_MSG_PORT: ${CERC_NITRO_WS_MSG_PORT:-5006}
|
||||
CERC_NITRO_RPC_PORT: ${CERC_NITRO_RPC_PORT:-4006}
|
||||
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
|
||||
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
||||
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
||||
@ -24,25 +27,15 @@ services:
|
||||
- nitro_deployment:/app/deployment
|
||||
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "4005"]
|
||||
interval: 10s
|
||||
test: ["CMD", "nc", "-vz", "localhost", "4006"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
ports:
|
||||
- "3005"
|
||||
- "4005:4005"
|
||||
- "5005:5005"
|
||||
|
||||
nitro-rpc-client:
|
||||
image: cerc/nitro-rpc-client:local
|
||||
hostname: nitro-rpc-client
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
# Wait for the go-nitro node to start
|
||||
go-nitro:
|
||||
condition: service_healthy
|
||||
command: ["bash", "-c", "tail -f /dev/null"]
|
||||
- "3006:3006"
|
||||
- "4006:4006"
|
||||
- "5006:5006"
|
||||
|
||||
volumes:
|
||||
go_nitro_data:
|
||||
|
@ -1,6 +1,6 @@
|
||||
version: "3.2"
|
||||
services:
|
||||
ipld-eth-server:
|
||||
ipld-eth-server-1:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
ipld-eth-db:
|
||||
@ -27,11 +27,12 @@ services:
|
||||
PROM_HTTP_PORT: "8090"
|
||||
LOG_LEVEL: "debug"
|
||||
CERC_REMOTE_DEBUG: ${CERC_REMOTE_DEBUG:-true}
|
||||
NITRO_RUN_NODE_IN_PROCESS: ${CERC_NITRO_RUN_NODE_IN_PROCESS:-true}
|
||||
NITRO_PK: ${CERC_NITRO_PK:-2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d}
|
||||
NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597}
|
||||
NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
|
||||
NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-false}
|
||||
NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
||||
NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true}
|
||||
NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/nitro-data/nitro-store}
|
||||
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
|
||||
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
||||
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
||||
@ -40,7 +41,7 @@ services:
|
||||
- type: bind
|
||||
source: ../config/ipld-eth-server/chain.json
|
||||
target: /tmp/chain.json
|
||||
- eth_server_nitro_data:/app/data
|
||||
- eth_server_nitro_data:/app/nitro-data
|
||||
- nitro_deployment:/app/deployment
|
||||
- ../config/ipld-eth-server/entrypoint.sh:/app/entrypoint.sh
|
||||
ports:
|
||||
@ -48,7 +49,7 @@ services:
|
||||
- "8082"
|
||||
- "8090"
|
||||
- "40000"
|
||||
- "3005"
|
||||
- "3005:3005"
|
||||
- "4005:4005"
|
||||
- "5005:5005"
|
||||
healthcheck:
|
||||
@ -58,6 +59,53 @@ services:
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
ipld-eth-server-2:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
ipld-eth-db:
|
||||
condition: service_healthy
|
||||
image: cerc/ipld-eth-server:local
|
||||
environment:
|
||||
SERVER_HTTP_PATH: 0.0.0.0:8081
|
||||
SERVER_GRAPHQL: "true"
|
||||
SERVER_GRAPHQLPATH: 0.0.0.0:8082
|
||||
VDB_COMMAND: "serve"
|
||||
ETH_CHAIN_CONFIG: "/tmp/chain.json"
|
||||
DATABASE_NAME: cerc_testing
|
||||
DATABASE_HOSTNAME: ipld-eth-db
|
||||
DATABASE_PORT: 5432
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_PASSWORD: "password"
|
||||
ETH_CHAIN_ID: 99
|
||||
ETH_FORWARD_ETH_CALLS: "false"
|
||||
ETH_FORWARD_GET_STORAGE_AT: "false"
|
||||
ETH_PROXY_ON_ERROR: "false"
|
||||
METRICS: "true"
|
||||
PROM_HTTP: "true"
|
||||
PROM_HTTP_ADDR: "0.0.0.0"
|
||||
PROM_HTTP_PORT: "8090"
|
||||
LOG_LEVEL: "debug"
|
||||
CERC_REMOTE_DEBUG: ${CERC_REMOTE_DEBUG:-true}
|
||||
NITRO_RUN_NODE_IN_PROCESS: ${CERC_NITRO_RUN_NODE_IN_PROCESS:-false}
|
||||
NITRO_ENDPOINT: ${CERC_NITRO_ENDPOINT:-go-nitro:4006/api/v1}
|
||||
entrypoint: ["bash", "-c", "/app/entrypoint.sh"]
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../config/ipld-eth-server/chain.json
|
||||
target: /tmp/chain.json
|
||||
- ../config/ipld-eth-server/entrypoint.sh:/app/entrypoint.sh
|
||||
ports:
|
||||
- "8081"
|
||||
- "8082"
|
||||
- "8090"
|
||||
- "40000"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "8081"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
volumes:
|
||||
eth_server_nitro_data:
|
||||
nitro_deployment:
|
||||
|
@ -8,13 +8,13 @@ services:
|
||||
working_dir: /app/examples/token-erc20
|
||||
environment:
|
||||
CERC_PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99}
|
||||
CERC_PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://ipld-eth-server:8081}
|
||||
CERC_PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://ipld-eth-server-2:8081}
|
||||
CERC_PONDER_NITRO_PK: ${CERC_PONDER_INDEXER_NITRO_PK:-58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f}
|
||||
CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_INDEXER_NITRO_CHAIN_PK:-fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0}
|
||||
CERC_PONDER_NITRO_CHAIN_URL: ${CERC_PONDER_NITRO_CHAIN_URL:-http://fixturenet-eth-geth-1:8546}
|
||||
CERC_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR}
|
||||
CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE}
|
||||
CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/ipld-eth-server/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv}
|
||||
CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0x660a4bEF3fbC863Fcd8D3CDB39242aE513d7D92e}
|
||||
CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/go-nitro/tcp/5006/ws/p2p/16Uiu2HAmNUiX7bpCpbo5JdqEebp85ptGU2Vk2AT9E3BykvbwQ3F9}
|
||||
CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-100}
|
||||
command: ["bash", "./ponder-start.sh"]
|
||||
volumes:
|
||||
|
@ -89,7 +89,7 @@ services:
|
||||
CERC_PEER_ID: ${CERC_PEER_ID}
|
||||
CERC_ENABLE_UPSTREAM_PAYMENTS: ${CERC_ENABLE_UPSTREAM_PAYMENTS}
|
||||
CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE}
|
||||
CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/ipld-eth-server/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv}
|
||||
CERC_UPSTREAM_NITRO_MULTIADDR: ${CERC_UPSTREAM_NITRO_MULTIADDR:-/dns4/ipld-eth-server-1/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv}
|
||||
CERC_UPSTREAM_NITRO_PAY_AMOUNT: ${CERC_UPSTREAM_NITRO_PAY_AMOUNT:-100}
|
||||
command: ["bash", "./start-server.sh"]
|
||||
volumes:
|
||||
|
@ -47,4 +47,4 @@ while true; do
|
||||
sleep $retry_interval
|
||||
done
|
||||
|
||||
./nitro -chainurl ${CERC_NITRO_CHAIN_URL} -msgport 3005 -rpcport 4005 -wsmsgport 5005 -pk ${CERC_NITRO_PK} -chainpk ${CERC_NITRO_CHAIN_PK} -naaddress ${NA_ADDRESS} -vpaaddress ${VPA_ADDRESS} -caaddress ${CA_ADDRESS} -usedurablestore ${CERC_NITRO_USE_DURABLE_STORE} -durablestorefolder ${CERC_NITRO_DURABLE_STORE_FOLDER}
|
||||
./nitro -chainurl ${CERC_NITRO_CHAIN_URL} -msgport ${CERC_NITRO_MSG_PORT} -rpcport ${CERC_NITRO_RPC_PORT} -wsmsgport ${CERC_NITRO_WS_MSG_PORT} -publicip "0.0.0.0" -pk ${CERC_NITRO_PK} -chainpk ${CERC_NITRO_CHAIN_PK} -naaddress ${NA_ADDRESS} -vpaaddress ${VPA_ADDRESS} -caaddress ${CA_ADDRESS} -usedurablestore ${CERC_NITRO_USE_DURABLE_STORE} -durablestorefolder ${CERC_NITRO_DURABLE_STORE_FOLDER} -tlscertfilepath "" -tlsKeyFilepath ""
|
||||
|
@ -1,34 +1,57 @@
|
||||
#!/bin/sh
|
||||
|
||||
nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
||||
read_nitro_addresses() {
|
||||
nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
||||
|
||||
# Check if CERC_NA_ADDRESS environment variable is set
|
||||
if [ -n "$CERC_NA_ADDRESS" ]; then
|
||||
echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'"
|
||||
echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'"
|
||||
echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'"
|
||||
echo "Using the above Nitro addresses"
|
||||
# Check if CERC_NA_ADDRESS environment variable is set
|
||||
if [ -n "$CERC_NA_ADDRESS" ]; then
|
||||
echo "CERC_NA_ADDRESS is set to '$CERC_NA_ADDRESS'"
|
||||
echo "CERC_VPA_ADDRESS is set to '$CERC_VPA_ADDRESS'"
|
||||
echo "CERC_CA_ADDRESS is set to '$CERC_CA_ADDRESS'"
|
||||
echo "Using the above Nitro addresses"
|
||||
|
||||
export NITRO_NA_ADDRESS=${CERC_NA_ADDRESS}
|
||||
export NITRO_VPA_ADDRESS=${CERC_VPA_ADDRESS}
|
||||
export NITRO_CA_ADDRESS=${CERC_CA_ADDRESS}
|
||||
else
|
||||
# Read addresses from a file
|
||||
# Keep retrying until found
|
||||
echo "Reading Nitro addresses from ${nitro_addresses_file}"
|
||||
export NITRO_NA_ADDRESS=${CERC_NA_ADDRESS}
|
||||
export NITRO_VPA_ADDRESS=${CERC_VPA_ADDRESS}
|
||||
export NITRO_CA_ADDRESS=${CERC_CA_ADDRESS}
|
||||
else
|
||||
# Read addresses from a file
|
||||
# Keep retrying until found
|
||||
echo "Reading Nitro addresses from ${nitro_addresses_file}"
|
||||
retry_interval=5
|
||||
while true; do
|
||||
if [[ -e "$nitro_addresses_file" ]]; then
|
||||
export NITRO_NA_ADDRESS=$(jq -r '.nitroAdjudicatorAddress' ${nitro_addresses_file})
|
||||
export NITRO_VPA_ADDRESS=$(jq -r '.virtualPaymentAppAddress' ${nitro_addresses_file})
|
||||
export NITRO_CA_ADDRESS=$(jq -r '.consensusAppAddress' ${nitro_addresses_file})
|
||||
|
||||
break
|
||||
else
|
||||
echo "File not yet available, retrying in $retry_interval seconds..."
|
||||
sleep $retry_interval
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
wait_for_nitro_endpoint() {
|
||||
retry_interval=5
|
||||
while true; do
|
||||
if [[ -e "$nitro_addresses_file" ]]; then
|
||||
export NITRO_NA_ADDRESS=$(jq -r '.nitroAdjudicatorAddress' ${nitro_addresses_file})
|
||||
export NITRO_VPA_ADDRESS=$(jq -r '.virtualPaymentAppAddress' ${nitro_addresses_file})
|
||||
export NITRO_CA_ADDRESS=$(jq -r '.consensusAppAddress' ${nitro_addresses_file})
|
||||
curl -I -s -o /dev/null $NITRO_ENDPOINT/health
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Nitro endpoint is up"
|
||||
break
|
||||
else
|
||||
echo "File not yet available, retrying in $retry_interval seconds..."
|
||||
echo "Nitro endpoint not available yet, retrying in $retry_interval seconds..."
|
||||
sleep $retry_interval
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [ "$NITRO_RUN_NODE_IN_PROCESS" = "true" ]; then
|
||||
read_nitro_addresses
|
||||
else
|
||||
wait_for_nitro_endpoint
|
||||
fi
|
||||
|
||||
echo "Beginning the ipld-eth-server process"
|
||||
|
@ -4,7 +4,7 @@
|
||||
DEFAULT_CERC_ETH_RPC_ENDPOINT="http://fixturenet-eth-geth-1:8545"
|
||||
|
||||
# ETH RPC endpoint used for queries in the watcher
|
||||
DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT="http://ipld-eth-server:8081"
|
||||
DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT="http://ipld-eth-server-1:8081"
|
||||
|
||||
# ETH RPC endpoint used for mutations in the watcher
|
||||
DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT="http://fixturenet-eth-geth-1:8545"
|
||||
|
16
app/data/container-build/cerc-go-nitro/Dockerfile
Normal file
16
app/data/container-build/cerc-go-nitro/Dockerfile
Normal file
@ -0,0 +1,16 @@
|
||||
FROM golang:1.21-bullseye AS builder
|
||||
|
||||
# Copy files into image
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
# Build the binary
|
||||
RUN go build -v -o nitro .
|
||||
|
||||
# Reduce image size
|
||||
FROM debian:bullseye-slim
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y ca-certificates jq netcat
|
||||
RUN rm -rf /var/lib/apt/lists/*
|
||||
WORKDIR /app
|
||||
COPY --from=builder /app/nitro .
|
@ -3,4 +3,6 @@
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
docker build -t cerc/go-nitro:local -f ${CERC_REPO_BASE_DIR}/go-nitro/docker/local/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/go-nitro:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
||||
|
@ -24,14 +24,18 @@ Deploy the stack:
|
||||
laconic-so --stack fixturenet-payments deploy --cluster payments up
|
||||
|
||||
# Exposed on host ports:
|
||||
# 4005: go-nitro node's RPC endpoint
|
||||
# 5005: go-nitro node's p2p endpoint
|
||||
# 32***: geth in statediffing mode and ipld-eth-server(s)
|
||||
# 4005: in-process go-nitro node's RPC endpoint
|
||||
# 3005: in-process go-nitro node's p2p TCP endpoint
|
||||
# 5005: in-process go-nitro node's p2p WS endpoin
|
||||
# 4006: out-of-process go-nitro node's RPC endpoint
|
||||
# 3006: out-of-process go-nitro node's p2p TCP endpoint
|
||||
# 5006: out-of-process go-nitro node's p2p WS endpoint
|
||||
# 15432: MobyMask v3 watcher's db endpoint
|
||||
# 3001: MobyMask v3 watcher endpoint
|
||||
# 9090: MobyMask v3 watcher relay node endpoint
|
||||
# 8080: MobyMask snap
|
||||
# 3004: MobyMask v3 app
|
||||
# 32***: geth in statediffing mode
|
||||
```
|
||||
|
||||
## Demo
|
||||
|
@ -3,15 +3,17 @@
|
||||
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`; also runs an in-process go-nitro node for payments required for configured RPC requests
|
||||
* A MobyMask v3 watcher that pays the `ipld-eth-server` for ETH RPC requests
|
||||
* `ipld-eth-server-1` and `ipld-eth-server-2` both of which run an ETH RPC API and a GQL server; they both serve data from `ipld-eth-db`
|
||||
* `ipld-eth-server-1` runs an in-process go-nitro node for payments required for configured RPC requests
|
||||
* A go-nitro deployment acting as the remote Nitro node for `ipld-eth-server-2`
|
||||
* A MobyMask v3 watcher that pays the `ipld-eth-server-1` for ETH RPC requests
|
||||
* A MobyMask v3 app that pays the watcher for reads (GQL queries) and writes
|
||||
* An example ERC20 Ponder indexer app that pays the `ipld-eth-server` for ETH RPC requests
|
||||
* An example ERC20 Ponder indexer app that pays the `ipld-eth-server-2` for ETH RPC requests
|
||||
* An example ERC20 Ponder watcher app that pays the Ponder indexer app for GQL queries
|
||||
|
||||
## Setup
|
||||
|
||||
* On starting the stack, MobyMask watcher creates a payment channel with the `ipld-eth-server`'s Nitro node. Check watcher logs and wait for the same:
|
||||
* On starting the stack, MobyMask watcher creates a payment channel with the `ipld-eth-server-1`'s (in-process) Nitro node. Check watcher logs and wait for the same:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||
@ -37,7 +39,7 @@ Stack components:
|
||||
* Check the payment channel status:
|
||||
|
||||
```bash
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -h ipld-eth-server -p 4005"
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -s false -h ipld-eth-server-1 -p 4005"
|
||||
|
||||
# Expected output:
|
||||
# {
|
||||
@ -53,10 +55,16 @@ Stack components:
|
||||
# }
|
||||
```
|
||||
|
||||
* In another terminal, check `ipld-eth-server`'s logs to keep track of incoming payments and RPC requests:
|
||||
* In another terminal, check `ipld-eth-server-1`'s logs to keep track of incoming payments and RPC requests from the MobyMask watcher:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="ipld-eth-server")
|
||||
docker logs -f $(docker ps -aq --filter name="ipld-eth-server-1")
|
||||
```
|
||||
|
||||
* In another terminal, check `ipld-eth-server-2`'s logs to keep track of incoming RPC requests from the Ponder app in indexer mode:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="ipld-eth-server-2")
|
||||
```
|
||||
|
||||
* MetaMask flask wallet setup for running the MobyMask app:
|
||||
@ -134,6 +142,7 @@ Stack components:
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# laconic:payments Received a payment voucher of 50 from 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# laconic:payments Serving a paid query for 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# vulcanize:resolver isPhisher 0x98ae4f9e9d01cc892adfe6871e1db0287039e0c183d3b5bb31d724228c114744 0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9 TWT:ash1
|
||||
# vulcanize:indexer isPhisher: db miss, fetching from upstream server
|
||||
@ -143,16 +152,15 @@ Stack components:
|
||||
# laconic:payments Making RPC call: eth_chainId
|
||||
# laconic:payments Making RPC call: eth_getStorageAt
|
||||
# 2023-10-13T06:34:00.483Z ts-nitro:engine {"msg":"Sent message","_msg":{"to":"0xAAA662","from":"0xBBB676",# "payloadSummaries":[],"proposalSummaries":[],"payments":[{"amount":300,"channelId":"0x9a4bdfe03c8e72f368aab07e6bd18f1cd6821170e1a93e59864aad6ee6a853a2"}],"rejectedObjectives":[]}}
|
||||
|
||||
```
|
||||
|
||||
* The watcher makes several ETH RPC requests to `ipld-eth-server` to fetch data required for satisfying the GQL request(s); check `ipld-eth-server` logs for charged RPC requests (`eth_getBlockByHash`, `eth_getBlockByNumber`, `eth_getStorageAt`):
|
||||
* The watcher makes several ETH RPC requests to `ipld-eth-server-1` to fetch data required for satisfying the GQL request(s); check `ipld-eth-server-1` logs for charged RPC requests (`eth_getBlockByHash`, `eth_getBlockByNumber`, `eth_getStorageAt`):
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# 2023/10/13 06:34:57 INFO Received a voucher payer=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 amount=100
|
||||
# 2023/10/13 06:34:59 INFO Serving a paid RPC request method=eth_getBlockByHash sender=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
# 2023/10/13 06:34:59 INFO Serving a paid RPC request method=eth_getBlockByHash cost=50 sender=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=START api_method=eth_getBlockByHash api_params="[0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d false]" api_reqid=52 conn="192.168.64.4:59644" user_id= uuid=a1893211-6992-11ee-a67a-0242c0a8400c
|
||||
# WARN [10-13|06:34:59.133] Attempting GerRPCCalls, but default PluginLoader has not been initialized
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=END api_method=eth_getBlockByHash api_params="[0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d false]" api_reqid=52 conn="192.168.64.4:59644" duration=5 user_id= uuid=a1893211-6992-11ee-a67a-0242c0a8400c
|
||||
@ -160,7 +168,7 @@ Stack components:
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=START api_method=eth_chainId api_params="[]" api_reqid=53 conn="192.168.64.4:59658" user_id= uuid=a18a96d9-6992-11ee-a67a-0242c0a8400c
|
||||
# time="2023-10-13T06:34:59Z" level=debug msg=END api_method=eth_chainId api_params="[]" api_reqid=53 conn="192.168.64.4:59658" duration=0 user_id= uuid=a18a96d9-6992-11ee-a67a-0242c0a8400c
|
||||
# 2023/10/13 06:34:59 INFO Received a voucher payer=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 amount=100
|
||||
# 2023/10/13 06:35:01 INFO Serving a paid RPC request method=eth_getStorageAt sender=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
# 2023/10/13 06:35:01 INFO Serving a paid RPC request method=eth_getStorageAt cost=50 sender=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
|
||||
# time="2023-10-13T06:35:01Z" level=debug msg=START api_method=eth_getStorageAt api_params="[0x2b6afbd4f479ce4101df722cf4e05f941523ead9 0xf76621c2cc1c1705fabbc22d30ffc5ded7f26e4995feb8d1c9812a2697ba1278 0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d]" api_reqid=54 conn="192.168.64.4:59660" user_id= uuid=a2bd75d2-6992-11ee-a67a-0242c0a8400c
|
||||
# time="2023-10-13T06:35:01Z" level=debug msg=END api_method=eth_getStorageAt api_params="[0x2b6afbd4f479ce4101df722cf4e05f941523ead9 0xf76621c2cc1c1705fabbc22d30ffc5ded7f26e4995feb8d1c9812a2697ba1278 0x46411a554f30e607bdd79cd157a60a7c8b314c0709557be3357ed2fef53d6c3d]" api_reqid=54 conn="192.168.64.4:59660" duration=7 user_id= uuid=a2bd75d2-6992-11ee-a67a-0242c0a8400c
|
||||
```
|
||||
@ -186,10 +194,10 @@ Stack components:
|
||||
# }
|
||||
```
|
||||
|
||||
* Check the watcher - ipld-eth-server payment channel status after a few requests:
|
||||
* Check the watcher - ipld-eth-server-1 payment channel status after a few requests:
|
||||
|
||||
```bash
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -h ipld-eth-server -p 4005"
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $WATCHER_UPSTREAM_PAYMENT_CHANNEL -s false -h ipld-eth-server-1 -p 4005"
|
||||
|
||||
# Expected output ('PaidSoFar' should be non zero):
|
||||
# {
|
||||
@ -216,9 +224,9 @@ Stack components:
|
||||
# 08:00:28.701 INFO payment Nitro node setup with address 0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# laconic:payments Starting voucher subscription... +0ms
|
||||
# ...
|
||||
# 09:58:54.288 INFO payment Creating ledger channel with nitro node 0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE
|
||||
# 09:58:54.288 INFO payment Creating ledger channel with nitro node 0x660a4bEF3fbC863Fcd8D3CDB39242aE513d7D92e
|
||||
# ...
|
||||
# 09:59:14.230 INFO payment Creating payment channel with nitro node 0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE
|
||||
# 09:59:14.230 INFO payment Creating payment channel with nitro node 0x660a4bEF3fbC863Fcd8D3CDB39242aE513d7D92e
|
||||
# ...
|
||||
# 09:59:14.329 INFO payment Using payment channel 0x10f049519bc3f862e2b26e974be8666886228f30ea54aab06e2f23718afffab0
|
||||
```
|
||||
@ -229,30 +237,29 @@ Stack components:
|
||||
export PONDER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||
```
|
||||
|
||||
* On starting the Ponder app in indexer mode, it creates a payment channel with the `ipld-eth-server`'s Nitro node and then starts the historical sync service
|
||||
* On starting the Ponder app in indexer mode, it creates a payment channel with the `ipld-eth-server-2`'s (external) 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 `ipld-eth-server` logs for charged RPC requests (`eth_getBlockByNumber`, `eth_getLogs`):
|
||||
* The sync service makes several ETH RPC requests to the `ipld-eth-server-2` to fetch required data; check the `ipld-eth-server-2` logs for charged RPC requests (`eth_getBlockByNumber`, `eth_getLogs`):
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# 2023/10/13 06:59:49 INFO Received a voucher payer=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d amount=100
|
||||
# time="2023-10-13T06:59:51Z" level=debug msg=START api_method=eth_getLogs api_params="[map[address:0x32353a6c91143bfd6c7d363b546e62a9a2489a20 fromBlock:0x5 toBlock:0x68]]" api_reqid=1 conn="192.168.64.2:55578" user_id= uuid=1aedde38-6996-11ee-a67a-0242c0a8400c
|
||||
# 2023/10/13 06:59:51 INFO Serving a paid RPC request method=eth_getLogs sender=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# WARN [10-13|06:59:51.287] Attempting GerRPCCalls, but default PluginLoader has not been initialized
|
||||
# time="2023-10-13T06:59:51Z" level=debug msg="retrieving log cids for receipt ids"
|
||||
# time="2023-10-13T06:59:51Z" level=debug msg=END api_method=eth_getLogs api_params="[map[address:0x32353a6c91143bfd6c7d363b546e62a9a2489a20 fromBlock:0x5 toBlock:0x68]]" api_reqid=1 conn="192.168.64.2:55578" duration=17 user_id= uuid=1aedde38-6996-11ee-a67a-0242c0a8400c
|
||||
# 2023/10/13 06:59:51 INFO Received a voucher payer=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d amount=100
|
||||
# 2023/10/13 06:59:53 INFO Serving a paid RPC request method=eth_getBlockByNumber sender=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# 2023/10/13 06:59:53 INFO Received a voucher payer=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d amount=100
|
||||
|
||||
# 2023/10/18 05:29:38 INFO Serving a paid RPC request method=eth_getBlockByNumber cost=50 sender=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# time="2023-10-18T05:29:38Z" level=debug msg=START api_method=eth_getBlockByNumber api_params="[latest true]" api_reqid=0 conn="172.26.0.19:42306" user_id= uuid=54992dc3-6d77-11ee-9ede-0242ac1a000f
|
||||
# WARN [10-18|05:29:38.292] Attempting GerRPCCalls, but default PluginLoader has not been initialized
|
||||
# time="2023-10-18T05:29:38Z" level=debug msg=END api_method=eth_getBlockByNumber api_params="[latest true]" api_reqid=0 conn="172.26.0.19:42306" duration=22 user_id= uuid=54992dc3-6d77-11ee-9ede-0242ac1a000f
|
||||
# time="2023-10-18T05:29:40Z" level=debug msg=START api_method=eth_getLogs api_params="[map[address:0x32353a6c91143bfd6c7d363b546e62a9a2489a20 fromBlock:0x5 toBlock:0x68]]" api_reqid=1 conn="172.26.0.19:42306" user_id= uuid=55d19200-6d77-11ee-9ede-0242ac1a000f
|
||||
# 2023/10/18 05:29:40 INFO Serving a paid RPC request method=eth_getLogs cost=50 sender=0x67D5b55604d1aF90074FcB69b8C51838FFF84f8d
|
||||
# WARN [10-18|05:29:40.340] Attempting GerRPCCalls, but default PluginLoader has not been initialized
|
||||
# time="2023-10-18T05:29:40Z" level=debug msg="retrieving log cids for receipt ids"
|
||||
# time="2023-10-18T05:29:40Z" level=debug msg=END api_method=eth_getLogs api_params="[map[address:0x32353a6c91143bfd6c7d363b546e62a9a2489a20 fromBlock:0x5 toBlock:0x68]]" api_reqid=1 conn="172.26.0.19:42306" duration=20 user_id= uuid=55d19200-6d77-11ee-9ede-0242ac1a000f
|
||||
# ...
|
||||
```
|
||||
|
||||
* Check the ponder - ipld-eth-server payment channel status:
|
||||
* Check the ponder - ipld-eth-server-2 payment channel status:
|
||||
|
||||
```bash
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $PONDER_UPSTREAM_PAYMENT_CHANNEL -h ipld-eth-server -p 4005"
|
||||
docker exec payments-nitro-rpc-client-1 npm exec -c "nitro-rpc-client get-payment-channel $PONDER_UPSTREAM_PAYMENT_CHANNEL -s false -h go-nitro -p 4006"
|
||||
|
||||
# Expected output ('PaidSoFar' is non zero):
|
||||
# {
|
||||
|
@ -9,15 +9,15 @@ repos:
|
||||
# ipld-eth-server with payments -- to be used by ipld-eth-server-payments pod
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@payments
|
||||
# nitro repo
|
||||
- github.com/cerc-io/ts-nitro@v0.1.13
|
||||
- github.com/cerc-io/go-nitro@v0.1.1-ts-port-0.1.7
|
||||
- github.com/cerc-io/ts-nitro@v0.1.15
|
||||
- github.com/cerc-io/go-nitro@ts-interop # TODO: Use release
|
||||
# mobymask watcher repos
|
||||
- github.com/cerc-io/watcher-ts@v0.2.65
|
||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.3
|
||||
- github.com/cerc-io/watcher-ts@v0.2.66
|
||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.4
|
||||
- github.com/cerc-io/MobyMask@v0.1.3
|
||||
# mobymask app repos
|
||||
- github.com/cerc-io/mobymask-snap
|
||||
- github.com/cerc-io/mobymask-ui@v0.2.1
|
||||
- github.com/cerc-io/mobymask-ui@v0.2.2
|
||||
# ponder repo
|
||||
- github.com/cerc-io/ponder@laconic-esm
|
||||
containers:
|
||||
@ -31,7 +31,7 @@ containers:
|
||||
- cerc/ipld-eth-db
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/nitro-contracts
|
||||
# - cerc/go-nitro
|
||||
- cerc/go-nitro
|
||||
- cerc/nitro-rpc-client
|
||||
# mobymask watcher images
|
||||
- cerc/watcher-ts
|
||||
@ -47,7 +47,7 @@ pods:
|
||||
- ipld-eth-server-payments
|
||||
- ipld-eth-db
|
||||
- nitro-contracts
|
||||
# - go-nitro
|
||||
- go-nitro
|
||||
- nitro-rpc-client
|
||||
- watcher-mobymask-v3
|
||||
- mobymask-snap
|
||||
|
Loading…
Reference in New Issue
Block a user