forked from cerc-io/stack-orchestrator
Upgrade Nitro version in stack and add nitro-rpc-client
CLI (#557)
* Changes required for ponder container and upgrade ts-nitro version * Fix empty CERC_RELAY_MULTIADDR env variable * Add curl output for ponder payment channel * Add `nitro-rpc-client` container in payments stack (#1) * Add container for nitro-rpc-client * Add nitro-rpc-client service * Update nitro-rpc-client container * Update demo.md in payments stack --------- Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> * Update env variables used for go-nitro container * Pass Nitro chain URL in watcher config * Update ponder config chainUrl * Remove curl check in ponder start script * Upgrade node version to 18 in watcher-ts Dockerfile * Update ponder section in the demo instructions --------- Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
This commit is contained in:
parent
d57efe87b8
commit
5d19c56b0c
@ -10,11 +10,11 @@ services:
|
|||||||
nitro-contracts:
|
nitro-contracts:
|
||||||
condition: service_completed_successfully
|
condition: service_completed_successfully
|
||||||
environment:
|
environment:
|
||||||
NITRO_CHAIN_URL: ${NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
|
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
|
||||||
NITRO_PK: ${NITRO_PK:-2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d}
|
CERC_NITRO_PK: ${CERC_NITRO_PK:-2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d}
|
||||||
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597}
|
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597}
|
||||||
NITRO_USE_DURABLE_STORE: ${NITRO_USE_DURABLE_STORE:-true}
|
CERC_NITRO_USE_DURABLE_STORE: ${CERC_NITRO_USE_DURABLE_STORE:-true}
|
||||||
NITRO_DURABLE_STORE_FOLDER: ${NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
CERC_NITRO_DURABLE_STORE_FOLDER: ${CERC_NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
|
||||||
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
|
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
|
||||||
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
||||||
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
||||||
@ -34,6 +34,17 @@ services:
|
|||||||
- "4005:4005"
|
- "4005:4005"
|
||||||
- "5005:5005"
|
- "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:
|
volumes:
|
||||||
go_nitro_data:
|
go_nitro_data:
|
||||||
nitro_deployment:
|
nitro_deployment:
|
||||||
|
@ -10,10 +10,10 @@ services:
|
|||||||
go-nitro:
|
go-nitro:
|
||||||
condition: service_healthy
|
condition: service_healthy
|
||||||
environment:
|
environment:
|
||||||
PROXY_ADDRESS: 0.0.0.0:8081
|
CERC_PROXY_ADDRESS: 0.0.0.0:8081
|
||||||
PROXY_NITRO_ENDPOINT: ${PROXY_NITRO_ENDPOINT:-go-nitro:4005/api/v1}
|
CERC_PROXY_NITRO_ENDPOINT: ${CERC_PROXY_NITRO_ENDPOINT:-go-nitro:4005/api/v1}
|
||||||
PROXY_DESTINATION_URL: ${PROXY_DESTINATION_URL:-http://ipld-eth-server:8081}
|
CERC_PROXY_DESTINATION_URL: ${CERC_PROXY_DESTINATION_URL:-http://ipld-eth-server:8081}
|
||||||
PROXY_COST_PER_BYTE: ${PROXY_COST_PER_BYTE:-1}
|
CERC_PROXY_COST_PER_BYTE: ${CERC_PROXY_COST_PER_BYTE:-1}
|
||||||
entrypoint: ["bash", "-c", "/app/run-reverse-payment-proxy.sh"]
|
entrypoint: ["bash", "-c", "/app/run-reverse-payment-proxy.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
- ../config/go-nitro/run-reverse-payment-proxy.sh:/app/run-reverse-payment-proxy.sh
|
- ../config/go-nitro/run-reverse-payment-proxy.sh:/app/run-reverse-payment-proxy.sh
|
||||||
|
@ -6,11 +6,11 @@ services:
|
|||||||
image: cerc/ponder:local
|
image: cerc/ponder:local
|
||||||
working_dir: /app/examples/token-erc20
|
working_dir: /app/examples/token-erc20
|
||||||
environment:
|
environment:
|
||||||
PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99}
|
CERC_PONDER_CHAIN_ID: ${PONDER_CHAIN_ID:-99}
|
||||||
PONDER_RPC_URL_1: ${PONDER_RPC_URL_1:-http://nitro-reverse-payment-proxy:8081}
|
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_PK: ${CERC_PONDER_NITRO_PK:-58368d20ff12f17669c06158c21d885897aa56f9be430edc789614bf9851d53f}
|
||||||
CERC_PONDER_NITRO_CHAIN_PK: ${CERC_PONDER_NITRO_CHAIN_PK:-fb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0}
|
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_RELAY_MULTIADDR: ${CERC_RELAY_MULTIADDR}
|
||||||
CERC_UPSTREAM_NITRO_ADDRESS: ${CERC_UPSTREAM_NITRO_ADDRESS:-0xAAA6628Ec44A8a742987EF3A114dDFE2D4F7aDCE}
|
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}
|
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_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||||
CERC_ETH_RPC_QUERY_ENDPOINT: ${CERC_ETH_RPC_QUERY_ENDPOINT}
|
CERC_ETH_RPC_QUERY_ENDPOINT: ${CERC_ETH_RPC_QUERY_ENDPOINT}
|
||||||
CERC_ETH_RPC_MUTATION_ENDPOINT: ${CERC_ETH_RPC_MUTATION_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_RELAY_PEERS: ${CERC_RELAY_PEERS}
|
||||||
CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS}
|
CERC_DENY_MULTIADDRS: ${CERC_DENY_MULTIADDRS}
|
||||||
CERC_PUBSUB: ${CERC_PUBSUB}
|
CERC_PUBSUB: ${CERC_PUBSUB}
|
||||||
|
@ -30,6 +30,6 @@ fi
|
|||||||
|
|
||||||
echo "Running Nitro node"
|
echo "Running Nitro node"
|
||||||
|
|
||||||
# TODO Wait for RPC endpoint to come up
|
# TODO Wait for chain endpoint to come up
|
||||||
|
|
||||||
./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}
|
./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
|
fi
|
||||||
|
|
||||||
echo "Running Nitro reverse payment proxy"
|
echo "Running Nitro reverse payment proxy"
|
||||||
echo "Using PROXY_ADDRESS ${PROXY_ADDRESS}"
|
echo "Using CERC_PROXY_ADDRESS ${CERC_PROXY_ADDRESS}"
|
||||||
echo "Using PROXY_NITRO_ENDPOINT ${PROXY_NITRO_ENDPOINT}"
|
echo "Using CERC_PROXY_NITRO_ENDPOINT ${CERC_PROXY_NITRO_ENDPOINT}"
|
||||||
echo "Using PROXY_DESTINATION_URL ${PROXY_DESTINATION_URL}"
|
echo "Using CERC_PROXY_DESTINATION_URL ${CERC_PROXY_DESTINATION_URL}"
|
||||||
echo "Using PROXY_COST_PER_BYTE ${PROXY_COST_PER_BYTE}"
|
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"
|
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}
|
cat ${nitro_addresses_file}
|
||||||
|
@ -5,19 +5,6 @@ if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|||||||
set -x
|
set -x
|
||||||
fi
|
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_file="/nitro/nitro-addresses.json"
|
||||||
nitro_addresses_destination_file="/app/examples/token-erc20/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
|
fi
|
||||||
|
|
||||||
env_file='.env.local'
|
env_file='.env.local'
|
||||||
echo "PONDER_CHAIN_ID=\"$PONDER_CHAIN_ID\"" > "$env_file"
|
echo "PONDER_TELEMETRY_DISABLED=true" > "$env_file"
|
||||||
echo "PONDER_RPC_URL_1=\"$PONDER_RPC_URL_1\"" >> "$env_file"
|
echo "PONDER_LOG_LEVEL=debug" >> "$env_file"
|
||||||
echo "CERC_PONDER_NITRO_PK=\"$CERC_PONDER_NITRO_PK\"" >> "$env_file"
|
echo "PONDER_CHAIN_ID=\"$CERC_PONDER_CHAIN_ID\"" >> "$env_file"
|
||||||
echo "CERC_PONDER_NITRO_CHAIN_PK=\"$CERC_PONDER_NITRO_CHAIN_PK\"" >> "$env_file"
|
echo "PONDER_RPC_URL_1=\"$CERC_PONDER_RPC_URL_1\"" >> "$env_file"
|
||||||
echo "CERC_PONDER_NITRO_CHAIN_URL=\"$CERC_PONDER_NITRO_CHAIN_URL\"" >> "$env_file"
|
echo "PONDER_NITRO_PK=\"$CERC_PONDER_NITRO_PK\"" >> "$env_file"
|
||||||
echo "CERC_RELAY_MULTIADDR=\"$CERC_RELAY_MULTIADDR\"" >> "$env_file"
|
echo "PONDER_NITRO_CHAIN_PK=\"$CERC_PONDER_NITRO_CHAIN_PK\"" >> "$env_file"
|
||||||
echo "CERC_UPSTREAM_NITRO_ADDRESS=\"$CERC_UPSTREAM_NITRO_ADDRESS\"" >> "$env_file"
|
echo "PONDER_NITRO_CHAIN_URL=\"$CERC_PONDER_NITRO_CHAIN_URL\"" >> "$env_file"
|
||||||
echo "CERC_UPSTREAM_NITRO_MULTIADDR=\"$CERC_UPSTREAM_NITRO_MULTIADDR\"" >> "$env_file"
|
echo "RELAY_MULTIADDR=\"$CERC_RELAY_MULTIADDR\"" >> "$env_file"
|
||||||
echo "CERC_UPSTREAM_NITRO_PAY_AMOUNT=\"$CERC_UPSTREAM_NITRO_PAY_AMOUNT\"" >> "$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
|
# Keep the container running
|
||||||
tail -f
|
tail -f
|
||||||
|
@ -9,6 +9,24 @@ export const config: Config = {
|
|||||||
chainId: Number(process.env.PONDER_CHAIN_ID),
|
chainId: Number(process.env.PONDER_CHAIN_ID),
|
||||||
rpcUrl: process.env.PONDER_RPC_URL_1,
|
rpcUrl: process.env.PONDER_RPC_URL_1,
|
||||||
maxRpcRequestConcurrency: 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: [
|
contracts: [
|
||||||
@ -22,16 +40,11 @@ export const config: Config = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
nitro: {
|
nitro: {
|
||||||
privateKey: process.env.CERC_PONDER_NITRO_PK!,
|
privateKey: process.env.PONDER_NITRO_PK!,
|
||||||
chainPrivateKey: process.env.CERC_PONDER_NITRO_CHAIN_PK!,
|
chainPrivateKey: process.env.PONDER_NITRO_CHAIN_PK!,
|
||||||
chainURL: process.env.CERC_PONDER_NITRO_CHAIN_URL!,
|
chainUrl: process.env.PONDER_NITRO_CHAIN_URL!,
|
||||||
contractAddresses,
|
contractAddresses,
|
||||||
relayMultiAddr: process.env.CERC_RELAY_MULTIADDR!,
|
relayMultiAddr: process.env.RELAY_MULTIADDR!,
|
||||||
store: "./.ponder/nitro-db",
|
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
|
# ETH RPC endpoint used for mutations in the watcher
|
||||||
DEFAULT_CERC_ETH_RPC_MUTATION_ENDPOINT="http://fixturenet-eth-geth-1:8545"
|
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
|
# Set of relay peers to connect to from the relay node
|
||||||
DEFAULT_CERC_RELAY_PEERS=[]
|
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_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_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_RELAY_PEERS="${CERC_RELAY_PEERS:-${DEFAULT_CERC_RELAY_PEERS}}"
|
||||||
CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}"
|
CERC_DENY_MULTIADDRS="${CERC_DENY_MULTIADDRS:-${DEFAULT_CERC_DENY_MULTIADDRS}}"
|
||||||
CERC_PUBSUB="${CERC_PUBSUB:-${DEFAULT_CERC_PUBSUB}}"
|
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 query endpoint ${CERC_ETH_RPC_QUERY_ENDPOINT}"
|
||||||
echo "Using RPC mutation endpoint ${CERC_ETH_RPC_MUTATION_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
|
# Use public domain for relay multiaddr in peer config if specified
|
||||||
# Otherwise, use the docker container's host IP
|
# 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_PRIVATE_KEY_PEER/${CERC_PRIVATE_KEY_PEER}/g; \
|
||||||
s/REPLACE_WITH_CERC_WATCHER_NITRO_PK/${CERC_WATCHER_NITRO_PK}/g; \
|
s/REPLACE_WITH_CERC_WATCHER_NITRO_PK/${CERC_WATCHER_NITRO_PK}/g; \
|
||||||
s/REPLACE_WITH_CONTRACT_ADDRESS/${CONTRACT_ADDRESS}/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_ENABLED/${CONSENSUS_ENABLED}/g; \
|
||||||
s/REPLACE_WITH_CONSENSUS_PUBLIC_KEY/${CONSENSUS_PUBLIC_KEY}/g; \
|
s/REPLACE_WITH_CONSENSUS_PUBLIC_KEY/${CONSENSUS_PUBLIC_KEY}/g; \
|
||||||
s/REPLACE_WITH_CONSENSUS_PRIVATE_KEY/${CONSENSUS_PRIVATE_KEY}/g; \
|
s/REPLACE_WITH_CONSENSUS_PRIVATE_KEY/${CONSENSUS_PRIVATE_KEY}/g; \
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
contractAddress = 'REPLACE_WITH_CONTRACT_ADDRESS'
|
||||||
|
|
||||||
[server.p2p.nitro]
|
[server.p2p.nitro]
|
||||||
|
chainUrl = 'REPLACE_WITH_CERC_NITRO_CHAIN_URL'
|
||||||
store = './out/nitro-db'
|
store = './out/nitro-db'
|
||||||
privateKey = 'REPLACE_WITH_CERC_WATCHER_NITRO_PK'
|
privateKey = 'REPLACE_WITH_CERC_WATCHER_NITRO_PK'
|
||||||
chainPrivateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER'
|
chainPrivateKey = 'REPLACE_WITH_CERC_PRIVATE_KEY_PEER'
|
||||||
@ -93,14 +94,21 @@
|
|||||||
|
|
||||||
[upstream]
|
[upstream]
|
||||||
[upstream.ethServer]
|
[upstream.ethServer]
|
||||||
gqlApiEndpoint = 'http://ipld-eth-server:8083/graphql'
|
gqlApiEndpoint = "http://ipld-eth-server:8083/graphql"
|
||||||
rpcProviderEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_QUERY_ENDPOINT'
|
rpcProviderEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_QUERY_ENDPOINT'
|
||||||
rpcProviderMutationEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_MUTATION_ENDPOINT'
|
rpcProviderMutationEndpoint = 'REPLACE_WITH_CERC_ETH_RPC_MUTATION_ENDPOINT'
|
||||||
|
|
||||||
[upstream.ethServer.rpcProviderNitroNode]
|
[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'
|
address = 'REPLACE_WITH_UPSTREAM_NITRO_ADDRESS'
|
||||||
multiAddr = 'REPLACE_WITH_UPSTREAM_NITRO_MULTIADDR'
|
multiAddr = 'REPLACE_WITH_UPSTREAM_NITRO_MULTIADDR'
|
||||||
amount = 'REPLACE_WITH_UPSTREAM_NITRO_PAY_AMOUNT'
|
|
||||||
|
[upstream.ethServer.payments.nitro.fundingAmounts]
|
||||||
|
directFund = "1000000000000"
|
||||||
|
virtualFund = "1000000000"
|
||||||
|
|
||||||
[upstream.cache]
|
[upstream.cache]
|
||||||
name = "requests"
|
name = "requests"
|
||||||
|
@ -7,6 +7,6 @@ WORKDIR /app
|
|||||||
COPY . .
|
COPY . .
|
||||||
|
|
||||||
RUN echo "Installing dependencies" && \
|
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
|
RUN apk --update --no-cache add git python3 alpine-sdk jq
|
||||||
|
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# ts-nitro:util:nitro Ledger channel created with id 0x65703ccdfacab09ac35367bdbe6c5a337e7a6651aad526807607b1c59b28bc1e
|
# ts-nitro:util:nitro Ledger channel created with id 0x65703ccdfacab09ac35367bdbe6c5a337e7a6651aad526807607b1c59b28bc1e
|
||||||
# ...
|
# ...
|
||||||
# ts-nitro:util:nitro Virtual payment channel created with id 0x29ff1335d73391a50e8fde3e9b34f00c3d81c39ddc7f89187f44dd51df96140e
|
# ts-nitro:util:nitro Virtual payment channel created with id 0x29ff1335d73391a50e8fde3e9b34f00c3d81c39ddc7f89187f44dd51df96140e
|
||||||
|
# vulcanize:server Starting server... +0ms
|
||||||
```
|
```
|
||||||
|
|
||||||
* Export the payment channel id to a variable:
|
* Export the payment channel id to a variable:
|
||||||
@ -21,39 +22,21 @@
|
|||||||
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
export WATCHER_UPSTREAM_PAYMENT_CHANNEL=<PAYMENT_CHANNEL_ID>
|
||||||
```
|
```
|
||||||
|
|
||||||
* Generate an auth token required to query the go-nitro node's RPC endpoint:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
export AUTH_TOKEN=$(curl -s -X POST -H "Content-Type: application/json" --data '{
|
|
||||||
"jsonrpc": "2.0", "id": 1,
|
|
||||||
"method": "get_auth_token",
|
|
||||||
"params": {}
|
|
||||||
}' http://127.0.0.1:4005/api/v1 | jq -r '.result')
|
|
||||||
```
|
|
||||||
|
|
||||||
* Check the payment channel status:
|
* Check the payment channel status:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST -H "Content-Type: application/json" --data "{
|
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"
|
||||||
\"jsonrpc\": \"2.0\", \"id\": 1,
|
|
||||||
\"method\": \"get_payment_channel\",
|
|
||||||
\"params\": { \"authtoken\": \"$AUTH_TOKEN\", \"payload\": { \"Id\": \"$WATCHER_UPSTREAM_PAYMENT_CHANNEL\" } }
|
|
||||||
}" http://127.0.0.1:4005/api/v1 | jq
|
|
||||||
|
|
||||||
# Expected output:
|
# Expected output:
|
||||||
# {
|
# {
|
||||||
# "jsonrpc": "2.0",
|
# ID: '0x8c0d17639bd2ba07dbcd248304a8f3c6c7276bfe25c2b87fe41f461e20f33f01',
|
||||||
# "id": 1,
|
# Status: 'Open',
|
||||||
# "result": {
|
# Balance: {
|
||||||
# "ID": "0xfe1231722d6c2cd7af8606afe039582ebc438ee5ca2b956f8284cb497597583f",
|
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||||
# "Status": "Open",
|
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||||
# "Balance": {
|
# Payer: '0xbbb676f9cff8d242e9eac39d063848807d3d1d94',
|
||||||
# "AssetAddress": "0x0000000000000000000000000000000000000000",
|
# PaidSoFar: 0n,
|
||||||
# "Payee": "0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce",
|
# RemainingFunds: 1000000000n
|
||||||
# "Payer": "0xbbb676f9cff8d242e9eac39d063848807d3d1d94",
|
|
||||||
# "PaidSoFar": "0x0",
|
|
||||||
# "RemainingFunds": "0x3b9aca00"
|
|
||||||
# }
|
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
```
|
```
|
||||||
@ -127,7 +110,7 @@
|
|||||||
|
|
||||||
* 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
|
||||||
* Check the payment proxy server logs for charged RPC requests (`eth_getBlockByHash`, `eth_getStorageAt`) made from watcher to upstream ETH server
|
* Check the payment proxy server logs for charged RPC requests (`eth_getBlockByHash`, `eth_getBlockByNumber`, `eth_getStorageAt`) made from watcher to upstream ETH server
|
||||||
|
|
||||||
* Change the amount besides `PAY` button to `>=100` for phisher reports next
|
* Change the amount besides `PAY` button to `>=100` for phisher reports next
|
||||||
|
|
||||||
@ -136,26 +119,18 @@
|
|||||||
* Check the watcher - eth-server payment channel status after a few requests:
|
* Check the watcher - eth-server payment channel status after a few requests:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST -H "Content-Type: application/json" --data "{
|
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"
|
||||||
\"jsonrpc\": \"2.0\", \"id\": 1,
|
|
||||||
\"method\": \"get_payment_channel\",
|
|
||||||
\"params\": { \"authtoken\": \"$AUTH_TOKEN\", \"payload\": { \"Id\": \"$WATCHER_UPSTREAM_PAYMENT_CHANNEL\" } }
|
|
||||||
}" http://127.0.0.1:4005/api/v1 | jq
|
|
||||||
|
|
||||||
# Expected output ('PaidSoFar' should be non zero):
|
# Expected output ('PaidSoFar' should be non zero):
|
||||||
# {
|
# {
|
||||||
# "jsonrpc": "2.0",
|
# ID: '0x8c0d17639bd2ba07dbcd248304a8f3c6c7276bfe25c2b87fe41f461e20f33f01',
|
||||||
# "id": 1,
|
# Status: 'Open',
|
||||||
# "result": {
|
# Balance: {
|
||||||
# "ID": "0xfe1231722d6c2cd7af8606afe039582ebc438ee5ca2b956f8284cb497597583f",
|
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||||
# "Status": "Open",
|
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||||
# "Balance": {
|
# Payer: '0xbbb676f9cff8d242e9eac39d063848807d3d1d94',
|
||||||
# "AssetAddress": "0x0000000000000000000000000000000000000000",
|
# PaidSoFar: 30000n,
|
||||||
# "Payee": "0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce",
|
# RemainingFunds: 999970000n
|
||||||
# "Payer": "0xbbb676f9cff8d242e9eac39d063848807d3d1d94",
|
|
||||||
# "PaidSoFar": "0x2710",
|
|
||||||
# "RemainingFunds": "0x3b9aa2f0"
|
|
||||||
# }
|
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
```
|
```
|
||||||
@ -184,14 +159,20 @@
|
|||||||
* Check the ponder - eth-server payment channel status:
|
* Check the ponder - eth-server payment channel status:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
curl -X POST -H "Content-Type: application/json" --data "{
|
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"
|
||||||
\"jsonrpc\": \"2.0\", \"id\": 1,
|
|
||||||
\"method\": \"get_payment_channel\",
|
|
||||||
\"params\": { \"authtoken\": \"$AUTH_TOKEN\", \"payload\": { \"Id\": \"$PONDER_UPSTREAM_PAYMENT_CHANNEL\" } }
|
|
||||||
}" http://127.0.0.1:4005/api/v1 | jq
|
|
||||||
|
|
||||||
# Expected output:
|
# Expected output ('PaidSoFar' is non zero):
|
||||||
# TODO
|
# {
|
||||||
|
# ID: '0x1178ac0f2a43e54a122216fa6afdd30333b590e49e50317a1f9274a591da0f96',
|
||||||
|
# Status: 'Open',
|
||||||
|
# Balance: {
|
||||||
|
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||||
|
# Payee: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce',
|
||||||
|
# Payer: '0x67d5b55604d1af90074fcb69b8c51838fff84f8d',
|
||||||
|
# PaidSoFar: 215000n,
|
||||||
|
# RemainingFunds: 999785000n
|
||||||
|
# }
|
||||||
|
# }
|
||||||
```
|
```
|
||||||
|
|
||||||
* Check reverse payment proxy server logs for charged RPC requests made from ponder app to upstream ETH server:
|
* Check reverse payment proxy server logs for charged RPC requests made from ponder app to upstream ETH server:
|
||||||
|
@ -8,11 +8,11 @@ repos:
|
|||||||
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
- git.vdb.to/cerc-io/ipld-eth-db@v5
|
||||||
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
- git.vdb.to/cerc-io/ipld-eth-server@v1.11.6-statediff-v5
|
||||||
# nitro repos
|
# nitro repos
|
||||||
- github.com/cerc-io/ts-nitro@v0.1.12
|
- github.com/cerc-io/ts-nitro@v0.1.13
|
||||||
- github.com/cerc-io/go-nitro@v0.1.0-ts-port-0.1.4 # TODO: Update after fixes
|
- github.com/cerc-io/go-nitro@ts-interop # TODO: Update after fixes
|
||||||
# mobymask watcher repos
|
# mobymask watcher repos
|
||||||
- github.com/cerc-io/watcher-ts@v0.2.61
|
- github.com/cerc-io/watcher-ts@v0.2.63
|
||||||
- github.com/cerc-io/mobymask-v2-watcher-ts@v3 # TODO: Update after fixes
|
- github.com/cerc-io/mobymask-v2-watcher-ts@v0.2.2
|
||||||
- github.com/cerc-io/MobyMask@v0.1.3
|
- github.com/cerc-io/MobyMask@v0.1.3
|
||||||
# mobymask app repos
|
# mobymask app repos
|
||||||
- github.com/cerc-io/mobymask-snap
|
- github.com/cerc-io/mobymask-snap
|
||||||
@ -31,6 +31,7 @@ containers:
|
|||||||
- cerc/ipld-eth-server
|
- cerc/ipld-eth-server
|
||||||
- cerc/nitro-contracts
|
- cerc/nitro-contracts
|
||||||
- cerc/go-nitro
|
- cerc/go-nitro
|
||||||
|
- cerc/nitro-rpc-client
|
||||||
# mobymask watcher images
|
# mobymask watcher images
|
||||||
- cerc/watcher-ts
|
- cerc/watcher-ts
|
||||||
- cerc/watcher-mobymask-v3
|
- cerc/watcher-mobymask-v3
|
||||||
|
Loading…
Reference in New Issue
Block a user