Gitea deployment #568
@ -62,6 +62,9 @@ services:
|
||||
- fixturenet-eth-bootnode-geth
|
||||
volumes:
|
||||
- fixturenet_eth_geth_2_data:/root/ethdata
|
||||
ports:
|
||||
- "8545"
|
||||
- "8546"
|
||||
|
||||
fixturenet-eth-bootnode-lighthouse:
|
||||
restart: always
|
||||
|
@ -38,6 +38,7 @@ services:
|
||||
- fixturenet-eth-bootnode-geth
|
||||
ports:
|
||||
- "8545"
|
||||
- "8546"
|
||||
- "40000"
|
||||
- "6060"
|
||||
|
||||
@ -59,6 +60,9 @@ services:
|
||||
- fixturenet-eth-bootnode-geth
|
||||
volumes:
|
||||
- fixturenet_plugeth_geth_2_data:/root/ethdata
|
||||
ports:
|
||||
- "8545"
|
||||
- "8546"
|
||||
|
||||
fixturenet-eth-bootnode-lighthouse:
|
||||
restart: always
|
||||
|
@ -10,11 +10,11 @@ services:
|
||||
nitro-contracts:
|
||||
condition: service_completed_successfully
|
||||
environment:
|
||||
NITRO_CHAIN_URL: ${NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
|
||||
NITRO_PK: ${NITRO_PK:-2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d}
|
||||
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597}
|
||||
NITRO_USE_DURABLE_STORE: ${NITRO_USE_DURABLE_STORE:-true}
|
||||
NITRO_DURABLE_STORE_FOLDER: ${NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
||||
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_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true}
|
||||
CERC_NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
||||
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
|
||||
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
||||
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
||||
@ -31,9 +31,19 @@ services:
|
||||
start_period: 10s
|
||||
ports:
|
||||
- "3005"
|
||||
- "4005"
|
||||
- "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"]
|
||||
|
||||
volumes:
|
||||
go_nitro_data:
|
||||
nitro_deployment:
|
||||
|
@ -10,10 +10,10 @@ services:
|
||||
go-nitro:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
PROXY_ADDRESS: 0.0.0.0:8081
|
||||
PROXY_NITRO_ENDPOINT: ${PROXY_NITRO_ENDPOINT:-go-nitro:4005/api/v1}
|
||||
PROXY_DESTINATION_URL: ${PROXY_DESTINATION_URL:-http://ipld-eth-server:8081}
|
||||
PROXY_COST_PER_BYTE: ${PROXY_COST_PER_BYTE:-1}
|
||||
CERC_PROXY_ADDRESS: 0.0.0.0:8081
|
||||
CERC_PROXY_NITRO_ENDPOINT: ${CERC_PROXY_NITRO_ENDPOINT:-go-nitro:4005/api/v1}
|
||||
CERC_PROXY_DESTINATION_URL: ${CERC_PROXY_DESTINATION_URL:-http://ipld-eth-server:8081}
|
||||
CERC_PROXY_COST_PER_BYTE: ${CERC_PROXY_COST_PER_BYTE:-1}
|
||||
entrypoint: ["bash", "-c", "/app/run-reverse-payment-proxy.sh"]
|
||||
volumes:
|
||||
- ../config/go-nitro/run-reverse-payment-proxy.sh:/app/run-reverse-payment-proxy.sh
|
||||
|
@ -6,11 +6,11 @@ services:
|
||||
image: cerc/ponder:local
|
||||
working_dir: /app/examples/token-erc20
|
||||
environment:
|
||||
PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99}
|
||||
PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://nitro-reverse-payment-proxy:8081}
|
||||
CERC_PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99}
|
||||
CERC_PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://nitro-reverse-payment-proxy:8081}
|
||||
CERC_PONDER_NITRO_PK: ${CERC_PONDER_NITRO_PK:-58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f}
|
||||
CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_NITRO_CHAIN_PK:-fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0}
|
||||
CERC_PONDER_NITRO_CHAIN_URL: ${CERC_PONDER_NITRO_CHAIN_URL:-http://fixturenet-eth-geth-1:8545}
|
||||
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/go-nitro/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv}
|
||||
|
@ -74,6 +74,7 @@ services:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_ETH_RPC_QUERY_ENDPOINT: ${CERC_ETH_RPC_QUERY_ENDPOINT}
|
||||
CERC_ETH_RPC_MUTATION_ENDPOINT: ${CERC_ETH_RPC_MUTATION_ENDPOINT}
|
||||
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL}
|
||||
CERC_RELAY_PEERS: ${CERC_RELAY_PEERS}
|
||||
CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS}
|
||||
CERC_PUBSUB: ${CERC_PUBSUB}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
@ -30,6 +29,21 @@ fi
|
||||
|
||||
echo "Running Nitro node"
|
||||
|
||||
# TODO Wait for RPC endpoint to come up
|
||||
# Wait till chain endpoint is available
|
||||
retry_interval=5
|
||||
while true; do
|
||||
# Assuming CERC_NITRO_CHAIN_URL is of format <ws|http>://host:port
|
||||
ws_host=$(echo "$CERC_NITRO_CHAIN_URL" | awk -F '://' '{print $2}' | cut -d ':' -f 1)
|
||||
ws_port=$(echo "$CERC_NITRO_CHAIN_URL" | awk -F '://' '{print $2}' | cut -d ':' -f 2)
|
||||
nc -z -w 1 "$ws_host" "$ws_port"
|
||||
|
||||
./nitro -chainurl ${NITRO_CHAIN_URL} -msgport 3005 -rpcport 4005 -wsmsgport 5005 -pk ${NITRO_PK} -chainpk ${NITRO_CHAIN_PK} -naaddress ${NA_ADDRESS} -vpaaddress ${VPA_ADDRESS} -caaddress ${CA_ADDRESS} -usedurablestore ${NITRO_USE_DURABLE_STORE} -durablestorefolder ${NITRO_DURABLE_STORE_FOLDER}
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Chain endpoint is available"
|
||||
break
|
||||
fi
|
||||
|
||||
echo "Chain endpoint not yet available, retrying in $retry_interval seconds..."
|
||||
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}
|
||||
|
@ -6,9 +6,9 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
fi
|
||||
|
||||
echo "Running Nitro reverse payment proxy"
|
||||
echo "Using PROXY_ADDRESS ${PROXY_ADDRESS}"
|
||||
echo "Using PROXY_NITRO_ENDPOINT ${PROXY_NITRO_ENDPOINT}"
|
||||
echo "Using PROXY_DESTINATION_URL ${PROXY_DESTINATION_URL}"
|
||||
echo "Using PROXY_COST_PER_BYTE ${PROXY_COST_PER_BYTE}"
|
||||
echo "Using CERC_PROXY_ADDRESS ${CERC_PROXY_ADDRESS}"
|
||||
echo "Using CERC_PROXY_NITRO_ENDPOINT ${CERC_PROXY_NITRO_ENDPOINT}"
|
||||
echo "Using CERC_PROXY_DESTINATION_URL ${CERC_PROXY_DESTINATION_URL}"
|
||||
echo "Using CERC_PROXY_COST_PER_BYTE ${CERC_PROXY_COST_PER_BYTE}"
|
||||
|
||||
./start-reverse-payment-proxy -proxyaddress ${PROXY_ADDRESS} -nitroendpoint=${PROXY_NITRO_ENDPOINT} -destinationurl=${PROXY_DESTINATION_URL} -costperbyte ${PROXY_COST_PER_BYTE} -enablepaidrpcmethods
|
||||
./proxy -proxyaddress ${CERC_PROXY_ADDRESS} -nitroendpoint=${CERC_PROXY_NITRO_ENDPOINT} -destinationurl=${CERC_PROXY_DESTINATION_URL} -costperbyte ${CERC_PROXY_COST_PER_BYTE} -enablepaidrpcmethods
|
||||
|
@ -53,5 +53,5 @@ done
|
||||
|
||||
echo "Using CERC_PRIVATE_KEY_DEPLOYER from env"
|
||||
|
||||
yarn test:deploy-contracts --chainurl ${CERC_ETH_RPC_ENDPOINT} --key ${CERC_PRIVATE_KEY_DEPLOYER} --addressesFilePath ${nitro_addresses_file}
|
||||
yarn test:deploy-contracts --chainUrl ${CERC_ETH_RPC_ENDPOINT} --key ${CERC_PRIVATE_KEY_DEPLOYER} --addressesFilePath ${nitro_addresses_file}
|
||||
cat ${nitro_addresses_file}
|
||||
|
@ -5,19 +5,6 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
# Wait till RPC endpoint is available
|
||||
retry_interval=5
|
||||
while true; do
|
||||
rpc_response=$(curl -s -o /dev/null -w '%{http_code}' ${PONDER_RPC_URL_1})
|
||||
if [ ${rpc_response} = 200 ]; then
|
||||
echo "RPC endpoint is available"
|
||||
break
|
||||
fi
|
||||
|
||||
echo "RPC endpoint not yet available, retrying in $retry_interval seconds..."
|
||||
sleep $retry_interval
|
||||
done
|
||||
|
||||
nitro_addresses_file="/nitro/nitro-addresses.json"
|
||||
nitro_addresses_destination_file="/app/examples/token-erc20/nitro-addresses.json"
|
||||
|
||||
@ -55,15 +42,19 @@ if [ -z "$CERC_RELAY_MULTIADDR" ]; then
|
||||
fi
|
||||
|
||||
env_file='.env.local'
|
||||
echo "PONDER_CHAIN_ID=\"$PONDER_CHAIN_ID\"" > "$env_file"
|
||||
echo "PONDER_RPC_URL_1=\"$PONDER_RPC_URL_1\"" >> "$env_file"
|
||||
echo "CERC_PONDER_NITRO_PK=\"$CERC_PONDER_NITRO_PK\"" >> "$env_file"
|
||||
echo "CERC_PONDER_NITRO_CHAIN_PK=\"$CERC_PONDER_NITRO_CHAIN_PK\"" >> "$env_file"
|
||||
echo "CERC_PONDER_NITRO_CHAIN_URL=\"$CERC_PONDER_NITRO_CHAIN_URL\"" >> "$env_file"
|
||||
echo "CERC_RELAY_MULTIADDR=\"$CERC_RELAY_MULTIADDR\"" >> "$env_file"
|
||||
echo "CERC_UPSTREAM_NITRO_ADDRESS=\"$CERC_UPSTREAM_NITRO_ADDRESS\"" >> "$env_file"
|
||||
echo "CERC_UPSTREAM_NITRO_MULTIADDR=\"$CERC_UPSTREAM_NITRO_MULTIADDR\"" >> "$env_file"
|
||||
echo "CERC_UPSTREAM_NITRO_PAY_AMOUNT=\"$CERC_UPSTREAM_NITRO_PAY_AMOUNT\"" >> "$env_file"
|
||||
echo "PONDER_TELEMETRY_DISABLED=true" > "$env_file"
|
||||
echo "PONDER_LOG_LEVEL=debug" >> "$env_file"
|
||||
echo "PONDER_CHAIN_ID=\"$CERC_PONDER_CHAIN_ID\"" >> "$env_file"
|
||||
echo "PONDER_RPC_URL_1=\"$CERC_PONDER_RPC_URL_1\"" >> "$env_file"
|
||||
echo "PONDER_NITRO_PK=\"$CERC_PONDER_NITRO_PK\"" >> "$env_file"
|
||||
echo "PONDER_NITRO_CHAIN_PK=\"$CERC_PONDER_NITRO_CHAIN_PK\"" >> "$env_file"
|
||||
echo "PONDER_NITRO_CHAIN_URL=\"$CERC_PONDER_NITRO_CHAIN_URL\"" >> "$env_file"
|
||||
echo "RELAY_MULTIADDR=\"$CERC_RELAY_MULTIADDR\"" >> "$env_file"
|
||||
echo "UPSTREAM_NITRO_ADDRESS=\"$CERC_UPSTREAM_NITRO_ADDRESS\"" >> "$env_file"
|
||||
echo "UPSTREAM_NITRO_MULTIADDR=\"$CERC_UPSTREAM_NITRO_MULTIADDR\"" >> "$env_file"
|
||||
echo "UPSTREAM_NITRO_PAY_AMOUNT=\"$CERC_UPSTREAM_NITRO_PAY_AMOUNT\"" >> "$env_file"
|
||||
|
||||
cat "$env_file"
|
||||
|
||||
# Keep the container running
|
||||
tail -f
|
||||
|
@ -9,6 +9,24 @@ export const config: Config = {
|
||||
chainId: Number(process.env.PONDER_CHAIN_ID),
|
||||
rpcUrl: process.env.PONDER_RPC_URL_1,
|
||||
maxRpcRequestConcurrency: 1,
|
||||
pollingInterval: 5000,
|
||||
payments: {
|
||||
nitro: {
|
||||
address: process.env.UPSTREAM_NITRO_ADDRESS!,
|
||||
multiAddr: process.env.UPSTREAM_NITRO_MULTIADDR!,
|
||||
fundingAmounts: {
|
||||
// TODO: Pass amounts from env
|
||||
directFund: "1000000000000",
|
||||
virtualFund: "1000000000",
|
||||
},
|
||||
},
|
||||
paidRPCMethods: [
|
||||
"eth_getLogs",
|
||||
"eth_getBlockByNumber",
|
||||
"eth_getBlockByHash",
|
||||
],
|
||||
amount: process.env.UPSTREAM_NITRO_PAY_AMOUNT!,
|
||||
},
|
||||
},
|
||||
],
|
||||
contracts: [
|
||||
@ -22,16 +40,11 @@ export const config: Config = {
|
||||
},
|
||||
],
|
||||
nitro: {
|
||||
privateKey: process.env.CERC_PONDER_NITRO_PK!,
|
||||
chainPrivateKey: process.env.CERC_PONDER_NITRO_CHAIN_PK!,
|
||||
chainURL: process.env.CERC_PONDER_NITRO_CHAIN_URL!,
|
||||
privateKey: process.env.PONDER_NITRO_PK!,
|
||||
chainPrivateKey: process.env.PONDER_NITRO_CHAIN_PK!,
|
||||
chainUrl: process.env.PONDER_NITRO_CHAIN_URL!,
|
||||
contractAddresses,
|
||||
relayMultiAddr: process.env.CERC_RELAY_MULTIADDR!,
|
||||
relayMultiAddr: process.env.RELAY_MULTIADDR!,
|
||||
store: "./.ponder/nitro-db",
|
||||
rpcNitroNode: {
|
||||
address: process.env.CERC_UPSTREAM_NITRO_ADDRESS!,
|
||||
multiAddr: process.env.CERC_UPSTREAM_NITRO_MULTIADDR!,
|
||||
},
|
||||
payAmount: process.env.CERC_UPSTREAM_NITRO_PAY_AMOUNT!,
|
||||
},
|
||||
};
|
||||
|
@ -9,6 +9,9 @@ DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT="http://nitro-reverse-payment-proxy:8081"
|
||||
# ETH RPC endpoint used for mutations in the watcher
|
||||
DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT="http://fixturenet-eth-geth-1:8545"
|
||||
|
||||
# ETH endpoint used by watcher's Nitro node
|
||||
DEFAULT_CERC_NITRO_CHAIN_URL="http://fixturenet-eth-geth-1:8546"
|
||||
|
||||
# Set of relay peers to connect to from the relay node
|
||||
DEFAULT_CERC_RELAY_PEERS=[]
|
||||
|
||||
|
@ -7,6 +7,7 @@ fi
|
||||
|
||||
CERC_ETH_RPC_QUERY_ENDPOINT="${CERC_ETH_RPC_QUERY_ENDPOINT:-${DEFAULT_CERC_ETH_RPC_QUERY_ENDPOINT}}"
|
||||
CERC_ETH_RPC_MUTATION_ENDPOINT="${CERC_ETH_RPC_MUTATION_ENDPOINT:-${DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT}}"
|
||||
CERC_NITRO_CHAIN_URL="${CERC_NITRO_CHAIN_URL:-${DEFAULT_CERC_NITRO_CHAIN_URL}}"
|
||||
CERC_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}"
|
||||
CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}"
|
||||
CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}"
|
||||
@ -19,6 +20,7 @@ watcher_keys_dir="./keys"
|
||||
|
||||
echo "Using RPC query endpoint ${CERC_ETH_RPC_QUERY_ENDPOINT}"
|
||||
echo "Using RPC mutation endpoint ${CERC_ETH_RPC_MUTATION_ENDPOINT}"
|
||||
echo "Using Nitro chain URL ${CERC_NITRO_CHAIN_URL}"
|
||||
|
||||
# Use public domain for relay multiaddr in peer config if specified
|
||||
# Otherwise, use the docker container's host IP
|
||||
@ -146,6 +148,7 @@ WATCHER_CONFIG=$(echo "$WATCHER_CONFIG_TEMPLATE" | \
|
||||
s/REPLACE_WITH_CERC_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \
|
||||
s/REPLACE_WITH_CERC_WATCHER_NITRO_PK/${CERC_WATCHER_NITRO_PK}/g; \
|
||||
s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/g; \
|
||||
s|REPLACE_WITH_CERC_NITRO_CHAIN_URL|${CERC_NITRO_CHAIN_URL}|g; \
|
||||
s/REPLACE_WITH_CONSENSUS_ENABLED/${CONSENSUS_ENABLED}/g; \
|
||||
s/REPLACE_WITH_CONSENSUS_PUBLIC_KEY/${CONSENSUS_PUBLIC_KEY}/g; \
|
||||
s/REPLACE_WITH_CONSENSUS_PRIVATE_KEY/${CONSENSUS_PRIVATE_KEY}/g; \
|
||||
|
@ -53,6 +53,7 @@
|
||||
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
||||
|
||||
[server.p2p.nitro]
|
||||
chainUrl = 'REPLACE_WITH_CERC_NITRO_CHAIN_URL'
|
||||
store = './out/nitro-db'
|
||||
privateKey = 'REPLACE_WITH_CERC_WATCHER_NITRO_PK'
|
||||
chainPrivateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER'
|
||||
@ -93,15 +94,22 @@
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = 'http://ipld-eth-server:8083/graphql'
|
||||
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
|
||||
rpcProviderEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_QUERY_ENDPOINT'
|
||||
rpcProviderMutationEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_MUTATION_ENDPOINT'
|
||||
|
||||
[upstream.ethServer.rpcProviderNitroNode]
|
||||
address = 'REPLACE_WITH_UPSTREAM_NITRO_ADDRESS'
|
||||
multiAddr = 'REPLACE_WITH_UPSTREAM_NITRO_MULTIADDR'
|
||||
[upstream.ethServer.payments]
|
||||
paidRPCMethods = ["eth_getBlockByHash", "eth_getBlockByNumber", "eth_getStorageAt"]
|
||||
amount = 'REPLACE_WITH_UPSTREAM_NITRO_PAY_AMOUNT'
|
||||
|
||||
[upstream.ethServer.payments.nitro]
|
||||
address = 'REPLACE_WITH_UPSTREAM_NITRO_ADDRESS'
|
||||
multiAddr = 'REPLACE_WITH_UPSTREAM_NITRO_MULTIADDR'
|
||||
|
||||
[upstream.ethServer.payments.nitro.fundingAmounts]
|
||||
directFund = "1000000000000"
|
||||
virtualFund = "1000000000"
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
|
@ -13,6 +13,7 @@ NOW=${1:-`date +%s`}
|
||||
|
||||
lcli \
|
||||
change-genesis-time \
|
||||
--testnet-dir $TESTNET_DIR \
|
||||
$TESTNET_DIR/genesis.ssz \
|
||||
$NOW
|
||||
|
||||
|
@ -7,6 +7,6 @@ WORKDIR /app
|
||||
COPY . .
|
||||
|
||||
RUN echo "Installing dependencies" && \
|
||||
yarn
|
||||
yarn && yarn build:node
|
||||
|
||||
WORKDIR /app/packages/nitro-util
|
||||
WORKDIR /app/packages/nitro-node
|
||||
|
12
app/data/container-build/cerc-nitro-rpc-client/Dockerfile
Normal file
12
app/data/container-build/cerc-nitro-rpc-client/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
FROM node:18.17.1-alpine3.18
|
||||
|
||||
RUN apk --update --no-cache add python3 alpine-sdk bash curl jq
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN echo "Installing dependencies" && \
|
||||
yarn
|
||||
|
||||
RUN cd packages/nitro-rpc-client
|
9
app/data/container-build/cerc-nitro-rpc-client/build.sh
Executable file
9
app/data/container-build/cerc-nitro-rpc-client/build.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/nitro-rpc-client
|
||||
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
docker build -t cerc/nitro-rpc-client:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
@ -1,4 +1,4 @@
|
||||
FROM node:16.17.1-alpine3.16
|
||||
FROM node:18.17.1-alpine3.18
|
||||
|
||||
RUN apk --update --no-cache add git python3 alpine-sdk jq
|
||||
|
||||
|
@ -55,3 +55,4 @@ cerc/go-nitro
|
||||
cerc/nitro-contracts
|
||||
cerc/mobymask-snap
|
||||
cerc/ponder
|
||||
cerc/nitro-rpc-client
|
||||
|
@ -1,7 +1,7 @@
|
||||
github.com/cerc-io/ipld-eth-db
|
||||
github.com/cerc-io/go-ethereum
|
||||
github.com/cerc-io/ipld-eth-server
|
||||
github.com/cerc-io/eth-statediff-service
|
||||
git.vdb.to/cerc-io/ipld-eth-db
|
||||
git.vdb.to/cerc-io/go-ethereum
|
||||
git.vdb.to/cerc-io/ipld-eth-server
|
||||
git.vdb.to/cerc-io/eth-statediff-service
|
||||
github.com/cerc-io/eth-statediff-fill-service
|
||||
github.com/cerc-io/ipld-eth-db-validator
|
||||
github.com/cerc-io/ipld-eth-beacon-indexer
|
||||
@ -18,7 +18,7 @@ github.com/vulcanize/uniswap-watcher-ts
|
||||
github.com/vulcanize/uniswap-v3-info
|
||||
github.com/vulcanize/assemblyscript
|
||||
github.com/cerc-io/eth-probe
|
||||
github.com/cerc-io/tx-spammer
|
||||
git.vdb.to/cerc-io/tx-spammer
|
||||
github.com/dboreham/foundry
|
||||
github.com/lirewine/gem
|
||||
github.com/lirewine/debug
|
||||
@ -30,7 +30,7 @@ github.com/ethereum-optimism/optimism
|
||||
github.com/pokt-network/pocket-core
|
||||
github.com/pokt-network/pocket-core-deployments
|
||||
github.com/cerc-io/azimuth-watcher-ts
|
||||
github.com/cerc-io/ipld-eth-state-snapshot
|
||||
git.vdb.to/cerc-io/ipld-eth-state-snapshot
|
||||
github.com/cerc-io/gelato-watcher-ts
|
||||
github.com/filecoin-project/lotus
|
||||
git.vdb.to/cerc-io/test-project
|
||||
|
@ -2,10 +2,10 @@ version: "1.0"
|
||||
name: chain-chunker
|
||||
description: "Stack to build containers for chain-chunker"
|
||||
repos:
|
||||
- github.com/cerc-io/ipld-eth-state-snapshot@v5
|
||||
- github.com/cerc-io/eth-statediff-service@v5
|
||||
- github.com/cerc-io/ipld-eth-db@v5
|
||||
- github.com/cerc-io/ipld-eth-server@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-state-snapshot@v5
|
||||
- git.vdb.to/cerc-io/eth-statediff-service@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v5
|
||||
containers:
|
||||
- cerc/ipld-eth-state-snapshot
|
||||
- cerc/eth-statediff-service
|
||||
|
@ -1,9 +1,9 @@
|
||||
version: "1.0"
|
||||
name: erc20-watcher
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/ipld-eth-db
|
||||
- github.com/cerc-io/ipld-eth-server
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||
- github.com/cerc-io/watcher-ts
|
||||
- github.com/dboreham/foundry
|
||||
containers:
|
||||
|
@ -1,9 +1,9 @@
|
||||
version: "1.0"
|
||||
name: erc721-watcher
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/ipld-eth-db
|
||||
- github.com/cerc-io/ipld-eth-server
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||
- github.com/cerc-io/watcher-ts
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
|
@ -2,11 +2,11 @@ version: "1.0"
|
||||
name: fixturenet-eth-loaded
|
||||
description: "Loaded Ethereum Fixturenet"
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/tx-spammer
|
||||
- github.com/cerc-io/ipld-eth-server
|
||||
- github.com/cerc-io/ipld-eth-db
|
||||
- github.com/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/tx-spammer
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
|
@ -2,10 +2,10 @@ version: "1.2"
|
||||
name: fixturenet-eth-tx
|
||||
description: "Ethereum Fixturenet w/ tx-spammer"
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/tx-spammer
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/tx-spammer
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- github.com/cerc-io/lighthouse
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
- cerc/lighthouse
|
||||
|
@ -66,7 +66,7 @@ It is not necessary to use them all at once, but a complete example follows:
|
||||
|
||||
```
|
||||
# Setup
|
||||
$ laconic-so setup-repositories --include github.com/cerc-io/go-ethereum,github.com/cerc-io/ipld-eth-db,github.com/cerc-io/ipld-eth-server,github.com/cerc-io/ipld-eth-beacon-db,github.com/cerc-io/ipld-eth-beacon-indexer,github.com/cerc-io/eth-probe,github.com/cerc-io/tx-spammer
|
||||
$ laconic-so setup-repositories --include git.vdb.to/cerc-io/go-ethereum,git.vdb.to/cerc-io/ipld-eth-db,git.vdb.to/cerc-io/ipld-eth-server,github.com/cerc-io/ipld-eth-beacon-db,github.com/cerc-io/ipld-eth-beacon-indexer,github.com/cerc-io/eth-probe,git.vdb.to/cerc-io/tx-spammer
|
||||
|
||||
# Build
|
||||
$ laconic-so build-containers --include cerc/go-ethereum,cerc/lighthouse,cerc/fixturenet-eth-geth,cerc/fixturenet-eth-lighthouse,cerc/ipld-eth-db,cerc/ipld-eth-server,cerc/ipld-eth-beacon-db,cerc/ipld-eth-beacon-indexer,cerc/eth-probe,cerc/keycloak,cerc/tx-spammer
|
||||
|
@ -2,8 +2,8 @@ version: "1.1"
|
||||
name: fixturenet-eth
|
||||
description: "Ethereum Fixturenet"
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
containers:
|
||||
- cerc/go-ethereum
|
||||
|
@ -9,7 +9,7 @@ Prerequisite: An L1 Ethereum RPC endpoint
|
||||
Clone required repositories:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-optimism setup-repositories --exclude github.com/cerc-io/go-ethereum
|
||||
laconic-so --stack fixturenet-optimism setup-repositories --exclude git.vdb.to/cerc-io/go-ethereum
|
||||
|
||||
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
||||
```
|
||||
|
@ -2,8 +2,8 @@ version: "1.0"
|
||||
name: fixturenet-optimism
|
||||
description: "Optimism Fixturenet"
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- github.com/ethereum-optimism/optimism@v1.0.4
|
||||
- github.com/ethereum-optimism/op-geth@v1.101105.2
|
||||
|
@ -1,25 +0,0 @@
|
||||
# Required for:
|
||||
# Nitro contracts deployment
|
||||
# MobyMask contract deployment
|
||||
CERC_PRIVATE_KEY_DEPLOYER="0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218"
|
||||
|
||||
# ipld-eth-server's go-nitro node credentials
|
||||
NITRO_PK=2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d
|
||||
NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
|
||||
|
||||
# Watcher's nitro node credentials
|
||||
CERC_WATCHER_NITRO_PK="0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4"
|
||||
|
||||
# Used for sending MobyMask chain txs; also serves as chain pk for watcher's nitro node
|
||||
CERC_PRIVATE_KEY_PEER="111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f"
|
||||
|
||||
# Ponder app's nitro node credentials
|
||||
CERC_PONDER_NITRO_PK=58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f
|
||||
CERC_PONDER_NITRO_CHAIN_PK=fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0
|
||||
|
||||
# Used by watcher and ponder app for sending upstream payments
|
||||
CERC_UPSTREAM_NITRO_ADDRESS="0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE" # corresponds to NITRO_PK
|
||||
CERC_UPSTREAM_NITRO_MULTIADDR="/dns4/go-nitro/tcp/5005/ws/p2p/16Uiu2HAmSjXJqsyBJgcBUU2HQmykxGseafSatbpq5471XmuaUqyv"
|
||||
|
||||
# Used by the the MobyMask app to make payments to watcher
|
||||
CERC_PAYMENT_NITRO_ADDRESS="0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94" # corresponds to CERC_WATCHER_NITRO_PK
|
@ -1,5 +1,7 @@
|
||||
# fixturenet-payments
|
||||
|
||||
Instructions to setup and deploy an end-to-end fixturenet-payments stack
|
||||
|
||||
## Setup
|
||||
|
||||
Clone required repositories:
|
||||
@ -16,15 +18,14 @@ laconic-so --stack fixturenet-payments build-containers
|
||||
|
||||
## Deploy
|
||||
|
||||
### Configuration
|
||||
|
||||
Deploy the stack:
|
||||
|
||||
```bash
|
||||
laconic-so --stack fixturenet-payments deploy --cluster payments up
|
||||
|
||||
# Exposed on host ports:
|
||||
# 5005: go-nitro node's p2p msg port
|
||||
# 4005: go-nitro node's RPC endpoint
|
||||
# 5005: go-nitro node's p2p endpoint
|
||||
# 8081: reverse payment proxy's RPC endpoint
|
||||
# 15432: MobyMask v3 watcher's db endpoint
|
||||
# 3001: MobyMask v3 watcher endpoint
|
||||
@ -33,23 +34,9 @@ laconic-so --stack fixturenet-payments deploy --cluster payments up
|
||||
# 3004: MobyMask v3 app
|
||||
```
|
||||
|
||||
Check the logs of the MobyMask contract deployment container to get the deployed contract's address and generated root invite link:
|
||||
## Demo
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
```
|
||||
|
||||
Check the reverse payment proxy container logs:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="nitro-reverse-payment-proxy")
|
||||
```
|
||||
|
||||
Run the ponder app:
|
||||
|
||||
```bash
|
||||
docker exec -it payments-ponder-app-1 bash -c "pnpm start"
|
||||
```
|
||||
Follow the [demo](./demo.md) to try out end-to-end payments
|
||||
|
||||
## Clean up
|
||||
|
||||
|
275
app/data/stacks/fixturenet-payments/demo.md
Normal file
275
app/data/stacks/fixturenet-payments/demo.md
Normal file
@ -0,0 +1,275 @@
|
||||
# Demo
|
||||
|
||||
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 deployment acting as the Nitro node for `ipld-eth-server`
|
||||
* A modified reverse payment proxy server (based on the one from go-nitro) that proxies requests to `ipld-eth-server`'s RPC endpoint; it talks to `ipld-eth-server`'s Nitro node to accept and 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 reads (GQL queries) and writes
|
||||
* An example ERC20 Ponder app that pays the `ipld-eth-server` for ETH RPC requests
|
||||
|
||||
## 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:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-watcher-server")
|
||||
|
||||
# Expected output:
|
||||
# vulcanize:server Peer ID: 12D3KooWKLqLWU82VU7jmsmQMruRvZWhoBoVsf1UHchM5Nuq9ymY
|
||||
# vulcanize:server Using chain URL http://fixturenet-eth-geth-1:8546 for Nitro node
|
||||
# ...
|
||||
# ts-nitro:util:nitro Ledger channel created with id 0x65703ccdfacab09ac35367bdbe6c5a337e7a6651aad526807607b1c59b28bc1e
|
||||
# ...
|
||||
# ts-nitro:util:nitro Virtual payment channel created with id 0x29ff1335d73391a50e8fde3e9b34f00c3d81c39ddc7f89187f44dd51df96140e
|
||||
# vulcanize:server Starting server... +0ms
|
||||
```
|
||||
|
||||
* 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
|
||||
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||
```
|
||||
|
||||
* 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 go-nitro -p 4005"
|
||||
|
||||
# Expected output:
|
||||
# {
|
||||
# ID: '0x8c0d17639bd2ba07dbcd248304a8f3c6c7276bfe25c2b87fe41f461e20f33f01',
|
||||
# Status: 'Open',
|
||||
# Balance: {
|
||||
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||
# Payer: '0xbbb676f9cff8d242e9eac39d063848807d3d1d94',
|
||||
# PaidSoFar: 0n,
|
||||
# RemainingFunds: 1000000000n
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
* In another terminal, check the reverse payment proxy server's logs to keep track of incoming payments and RPC requests:
|
||||
|
||||
```bash
|
||||
docker logs -f $(docker ps -aq --filter name="nitro-reverse-payment-proxy")
|
||||
```
|
||||
|
||||
* MetaMask flask wallet setup for running the MobyMask app:
|
||||
|
||||
* Get the geth node’s port mapped to host:
|
||||
|
||||
```bash
|
||||
docker port payments-fixturenet-eth-geth-1-1 8545
|
||||
```
|
||||
|
||||
* In MetaMask, add a custom network with the following settings:
|
||||
|
||||
```bash
|
||||
# Network name
|
||||
Local fixturenet
|
||||
|
||||
# New RPC URL
|
||||
http://127.0.0.1:<GETH_PORT>
|
||||
|
||||
# Chain ID
|
||||
1212
|
||||
|
||||
# Currency symbol
|
||||
ETH
|
||||
```
|
||||
|
||||
* Import a faucet account with the following private key:
|
||||
|
||||
```bash
|
||||
# Faucet PK
|
||||
# 0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
|
||||
```
|
||||
|
||||
* 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
|
||||
docker logs -f $(docker ps -aq --filter name="mobymask-1")
|
||||
|
||||
# Expected output:
|
||||
# ...
|
||||
# "key": "0x60e706fda4639fe0a8eb102cb0ce81231cf6e819f41cb4eadf72d865ea4c11ad"
|
||||
# }
|
||||
# http://127.0.0.1:3004/#/members?invitation=<INVITATION>
|
||||
```
|
||||
|
||||
## Run
|
||||
|
||||
### 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
|
||||
localStorage.debug = 'ts-nitro:*'
|
||||
# Refresh the tab for taking effect
|
||||
```
|
||||
|
||||
* In the app’s debug panel, check that the peer gets connected to relay node and watcher peer
|
||||
|
||||
* Open the `NITRO` tab in debug panel
|
||||
* 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
|
||||
|
||||
* Perform `DIRECT FUND` with the preset amount and wait for the MetaMask confirmation prompt to appear; confirm the transaction and wait for a ledger channel to be created with the watcher
|
||||
|
||||
* 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:
|
||||
|
||||
* Check the watcher logs for received payments along with the GQL queries:
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# laconic:payments Serving a paid query for 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# vulcanize:resolver isPhisher 0x98ae4f9e9d01cc892adfe6871e1db0287039e0c183d3b5bb31d724228c114744 0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9 TWT:ash1
|
||||
# vulcanize:indexer isPhisher: db miss, fetching from upstream server
|
||||
# laconic:payments Making RPC call: eth_chainId
|
||||
# laconic:payments Making RPC call: eth_getBlockByHash
|
||||
# laconic:payments Making RPC call: eth_chainId
|
||||
# laconic:payments Making RPC call: eth_getStorageAt
|
||||
```
|
||||
|
||||
* 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`):
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# {"time":"2023-10-06T06:46:52.769009314Z","level":"DEBUG","msg":"Serving RPC request","method":"eth_chainId"}
|
||||
# {"time":"2023-10-06T06:46:52.773006426Z","level":"DEBUG","msg":"Serving RPC request","method":"eth_getBlockByNumber"}
|
||||
# {"time":"2023-10-06T06:46:52.811142054Z","level":"DEBUG","msg":"Request cost","cost-per-byte":1,"response-length":1480,"cost":1480,"method":"eth_getBlockByNumber"}
|
||||
# {"time":"2023-10-06T06:46:52.811418494Z","level":"DEBUG","msg":"sent message","address":"0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE","method":"receive_voucher"}
|
||||
# {"time":"2023-10-06T06:46:52.812557482Z","level":"DEBUG","msg":"Received voucher","delta":5000}
|
||||
# ...
|
||||
# {"time":"2023-10-06T06:46:52.87525215Z","level":"DEBUG","msg":"Serving RPC request","method":"eth_getStorageAt"}
|
||||
# {"time":"2023-10-06T06:46:52.882859654Z","level":"DEBUG","msg":"Request cost","cost-per-byte":1,"response-length":104,"cost":104,"method":"eth_getStorageAt"}
|
||||
# {"time":"2023-10-06T06:46:52.882946485Z","level":"DEBUG","msg":"sent message","address":"0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE","method":"receive_voucher"}
|
||||
# {"time":"2023-10-06T06:46:52.884012641Z","level":"DEBUG","msg":"Received voucher","delta":5000}
|
||||
# {"time":"2023-10-06T06:46:52.884032961Z","level":"DEBUG","msg":"Destination request","url":"http://ipld-eth-server:8081/"}
|
||||
```
|
||||
|
||||
* Change the amount besides `PAY` button in debug panel to `>=100` for phisher reports next
|
||||
|
||||
* Perform a phisher report and check the watcher logs for received payments:
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# vulcanize:libp2p-utils [6:50:2] Received a message on mobymask P2P network from peer: 12D3KooWRkxV9SX8uTUZYkbRjai4Fsn7yavB61J5TMnksixsabsP
|
||||
# ts-nitro:engine {"msg":"Received message","_msg":{"to":"0xBBB676","from":"0x868042","payloadSummaries":[],"proposalSummaries":[],"payments":[{"amount":200,"channelId":"0x557153d729cf3323c0bdb40a36b245f98c2d4562933ba2182c9d61c5cfeda948"}],"rejectedObjectives":[]}}
|
||||
# laconic:payments Received a payment voucher of 100 from 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# vulcanize:libp2p-utils Payment received for a mutation request from 0x86804299822212c070178B5135Ba6DdAcFC357D3
|
||||
# vulcanize:libp2p-utils Transaction receipt for invoke message {
|
||||
# to: '0x2B6AFbd4F479cE4101Df722cF4E05F941523EaD9',
|
||||
# blockNumber: 232,
|
||||
# blockHash: '0x6a188722c102662ea48af3786fe9db0d4b6c7ab7b27473eb0e628cf95746a244',
|
||||
# transactionHash: '0x6521205db8a905b3222adc2b6855f9b2abc72580624d299bec2a35bcba173efa',
|
||||
# effectiveGasPrice: '1500000007',
|
||||
# gasUsed: '113355'
|
||||
# }
|
||||
```
|
||||
|
||||
* Check the watcher - ipld-eth-server 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 go-nitro -p 4005"
|
||||
|
||||
# Expected output ('PaidSoFar' should be non zero):
|
||||
# {
|
||||
# ID: '0x8c0d17639bd2ba07dbcd248304a8f3c6c7276bfe25c2b87fe41f461e20f33f01',
|
||||
# Status: 'Open',
|
||||
# Balance: {
|
||||
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||
# Payer: '0xbbb676f9cff8d242e9eac39d063848807d3d1d94',
|
||||
# PaidSoFar: 30000n,
|
||||
# RemainingFunds: 999970000n
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
### ERC20 Ponder App
|
||||
|
||||
* Run the ponder app in it's container:
|
||||
|
||||
```bash
|
||||
docker exec -it payments-ponder-app-1 bash -c "pnpm start"
|
||||
|
||||
# Expected output:
|
||||
# 09:58:54.288 INFO payment Creating ledger channel with nitro node 0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE
|
||||
# ...
|
||||
# 09:59:14.230 INFO payment Creating payment channel with nitro node 0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE
|
||||
# ...
|
||||
# 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 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`)
|
||||
|
||||
```bash
|
||||
# Expected output:
|
||||
# ...
|
||||
# {"time":"2023-10-06T06:51:45.214478402Z","level":"DEBUG","msg":"Serving RPC request","method":"eth_getBlockByNumber"}
|
||||
# {"time":"2023-10-06T06:51:45.22251171Z","level":"DEBUG","msg":"Request cost","cost-per-byte":1,"response-length":576,"cost":576,"method":"eth_getBlockByNumber"}
|
||||
# {"time":"2023-10-06T06:51:45.222641963Z","level":"DEBUG","msg":"sent message","address":"0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE","method":"receive_voucher"}
|
||||
# {"time":"2023-10-06T06:51:45.224042391Z","level":"DEBUG","msg":"Received voucher","delta":5000}
|
||||
# {"time":"2023-10-06T06:51:45.224061411Z","level":"DEBUG","msg":"Destination request","url":"http://ipld-eth-server:8081/"}
|
||||
# {"time":"2023-10-06T06:51:45.242064953Z","level":"DEBUG","msg":"Serving RPC request","method":"eth_getLogs"}
|
||||
# {"time":"2023-10-06T06:51:45.249118517Z","level":"DEBUG","msg":"Request cost","cost-per-byte":1,"response-length":61,"cost":61,"method":"eth_getLogs"}
|
||||
# {"time":"2023-10-06T06:51:45.249189892Z","level":"DEBUG","msg":"sent message","address":"0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE","method":"receive_voucher"}
|
||||
# {"time":"2023-10-06T06:51:45.249743149Z","level":"DEBUG","msg":"Received voucher","delta":5000}
|
||||
# {"time":"2023-10-06T06:51:45.249760631Z","level":"DEBUG","msg":"Destination request","url":"http://ipld-eth-server:8081/"}
|
||||
# ...
|
||||
```
|
||||
|
||||
* Export the payment channel id to a variable:
|
||||
|
||||
```bash
|
||||
export PONDER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||
```
|
||||
|
||||
* Check the ponder - ipld-eth-server 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 go-nitro -p 4005"
|
||||
|
||||
# Expected output ('PaidSoFar' is non zero):
|
||||
# {
|
||||
# ID: '0x1178ac0f2a43e54a122216fa6afdd30333b590e49e50317a1f9274a591da0f96',
|
||||
# Status: 'Open',
|
||||
# Balance: {
|
||||
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||
# Payer: '0x67d5b55604d1af90074fcb69b8c51838fff84f8d',
|
||||
# PaidSoFar: 215000n,
|
||||
# RemainingFunds: 999785000n
|
||||
# }
|
||||
# }
|
||||
```
|
||||
|
||||
## Clean Up
|
||||
|
||||
* 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:
|
||||
|
||||
```bash
|
||||
await clearNodeStorage()
|
||||
```
|
||||
|
||||
* On a fresh restart, clear activity tab data in MetaMask for concerned accounts
|
@ -3,20 +3,20 @@ name: fixturenet-payments
|
||||
description: "Stack to demonstrate payments between various services"
|
||||
repos:
|
||||
# fixturenet repos
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/lighthouse
|
||||
- github.com/cerc-io/ipld-eth-db
|
||||
- github.com/cerc-io/ipld-eth-server
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||
# nitro repos
|
||||
- github.com/cerc-io/ts-nitro@v0.1.12
|
||||
- github.com/cerc-io/go-nitro@v0.1.0-ts-port-0.1.4 # TODO: Update after fixes
|
||||
- github.com/cerc-io/ts-nitro@v0.1.13
|
||||
- github.com/cerc-io/go-nitro@v0.1.1-ts-port-0.1.5
|
||||
# mobymask watcher repos
|
||||
- github.com/cerc-io/watcher-ts@v0.2.61
|
||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v3 # TODO: Update after fixes
|
||||
- github.com/cerc-io/watcher-ts@v0.2.63
|
||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.2
|
||||
- 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.0
|
||||
- github.com/cerc-io/mobymask-ui@v0.2.1
|
||||
# ponder repo
|
||||
- github.com/cerc-io/ponder@laconic
|
||||
containers:
|
||||
@ -31,6 +31,7 @@ containers:
|
||||
- cerc/ipld-eth-server
|
||||
- cerc/nitro-contracts
|
||||
- cerc/go-nitro
|
||||
- cerc/nitro-rpc-client
|
||||
# mobymask watcher images
|
||||
- cerc/watcher-ts
|
||||
- cerc/watcher-mobymask-v3
|
||||
|
@ -4,10 +4,10 @@ description: "plugeth Ethereum Fixturenet w/ tx-spammer"
|
||||
repos:
|
||||
- git.vdb.to/cerc-io/plugeth@statediff
|
||||
- git.vdb.to/cerc-io/plugeth-statediff
|
||||
- github.com/cerc-io/lighthouse
|
||||
- github.com/cerc-io/ipld-eth-db@v5
|
||||
- github.com/cerc-io/ipld-eth-server@v5
|
||||
- github.com/cerc-io/tx-spammer
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||
- git.vdb.to/cerc-io/ipld-eth-server@v5
|
||||
- git.vdb.to/cerc-io/tx-spammer
|
||||
- github.com/dboreham/foundry
|
||||
containers:
|
||||
- cerc/plugeth-statediff
|
||||
|
@ -2,8 +2,8 @@ version: "1.0"
|
||||
name: fixturenet-pocket
|
||||
description: "A single node pocket chain that can serve relays from the geth-1 node in eth-fixturenet"
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/pokt-network/pocket-core
|
||||
- github.com/pokt-network/pocket-core-deployments # contains the dockerfile
|
||||
containers:
|
||||
|
@ -2,8 +2,8 @@ version: "1.2"
|
||||
name: mainnet-eth
|
||||
description: "Ethereum Mainnet"
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- git.vdb.to/cerc-io/keycloak-reg-api
|
||||
- git.vdb.to/cerc-io/keycloak-reg-ui
|
||||
|
@ -1,8 +1,8 @@
|
||||
version: "1.0"
|
||||
name: mobymask-v2
|
||||
repos:
|
||||
- github.com/cerc-io/go-ethereum
|
||||
- github.com/cerc-io/lighthouse
|
||||
- git.vdb.to/cerc-io/go-ethereum@v1.11.6-statediff-v5
|
||||
- git.vdb.to/cerc-io/lighthouse
|
||||
- github.com/dboreham/foundry
|
||||
- github.com/ethereum-optimism/optimism@v1.0.4
|
||||
- github.com/ethereum-optimism/op-geth@v1.101105.2
|
||||
|
Loading…
Reference in New Issue
Block a user