Update nitro-node stack setup (#5)
* Rename service for nitro node * Update nitro node setup * Rename nitro-contracts image to nitro-client * Fix nitro node config setup * Add env variable for deterministic deployment * Keep nitro-contracts service running * Start nitro-bridge service after asset file is ready * Update environment variables for all services * Use quotes for bridge address * Update nitro-node and bridge stack readme * Fix nitro-node readme --------- Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-authored-by: IshaVenikar <ishavenikar7@gmail.com>
This commit is contained in:
parent
ce2258db07
commit
e3a8b25850
@ -1 +1,6 @@
|
||||
# nitro-stack
|
||||
|
||||
Stacks to run nitro-node and bridge
|
||||
|
||||
- [bridge stack documentation](stack-orchestrator/stacks/bridge/README.md)
|
||||
- [nitro-node stack documentation](stack-orchestrator/stacks/nitro-node/README.md)
|
||||
|
@ -1,27 +0,0 @@
|
||||
name: go-nitro
|
||||
|
||||
services:
|
||||
go-nitro:
|
||||
image: cerc/go-nitro:local
|
||||
hostname: go-nitro
|
||||
restart: on-failure
|
||||
environment:
|
||||
CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL}
|
||||
CERC_NITRO_PK: ${CERC_NITRO_PK}
|
||||
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK}
|
||||
CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT}
|
||||
CERC_NITRO_RPC_PORT: ${CERC_NITRO_RPC_PORT}
|
||||
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
|
||||
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
|
||||
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
|
||||
CERC_BOOT_PEERS: ${CERC_BOOT_PEERS}
|
||||
CERC_PUBLIC_IP: ${CERC_PUBLIC_IP:-127.0.0.1}
|
||||
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
|
||||
volumes:
|
||||
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
|
||||
ports:
|
||||
- 3006:3006
|
||||
- 4006:4006
|
||||
- 5006:5006
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
@ -1,4 +1,4 @@
|
||||
name: bridge
|
||||
name: nitro-bridge
|
||||
|
||||
services:
|
||||
nitro-bridge:
|
||||
@ -6,22 +6,21 @@ services:
|
||||
hostname: nitro-bridge
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
# Wait for Nitro contracts to be deployed
|
||||
nitro-contracts:
|
||||
condition: service_completed_successfully
|
||||
condition: service_started
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_GETH_CHAIN_ID: ${CERC_GETH_CHAIN_ID:-1212}
|
||||
CERC_OPTIMISM_CHAIN_ID: ${CERC_OPTIMISM_CHAIN_ID:-42069}
|
||||
CERC_NITRO_L1_CHAIN_URL: ${CERC_NITRO_L1_CHAIN_URL}
|
||||
CERC_NITRO_L2_CHAIN_URL: ${CERC_NITRO_L2_CHAIN_URL}
|
||||
CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK}
|
||||
CERC_NITRO_SC_PK: ${CERC_NITRO_SC_PK}
|
||||
CERC_NITRO_L1_MSG_PORT: ${CERC_NITRO_L1_MSG_PORT:-3005}
|
||||
CERC_NITRO_L2_MSG_PORT: ${CERC_NITRO_L2_MSG_PORT:-3006}
|
||||
CERC_NITRO_RPC_PORT: ${CERC_NITRO_RPC_PORT:-4006}
|
||||
CERC_NITRO_PUBLIC_P2P_HOST: ${CERC_NITRO_PUBLIC_P2P_HOST:-127.0.0.1}
|
||||
CERC_NITRO_PUBLIC_RPC_HOST: nitro-bridge
|
||||
GETH_CHAIN_ID: ${GETH_CHAIN_ID:-1212}
|
||||
OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID:-42069}
|
||||
NITRO_L1_CHAIN_URL: ${NITRO_L1_CHAIN_URL}
|
||||
NITRO_L2_CHAIN_URL: ${NITRO_L2_CHAIN_URL}
|
||||
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
|
||||
NITRO_SC_PK: ${NITRO_SC_PK}
|
||||
NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT:-3005}
|
||||
NITRO_L2_MSG_PORT: ${NITRO_L2_MSG_PORT:-3006}
|
||||
NITRO_RPC_PORT: ${NITRO_RPC_PORT:-4006}
|
||||
NITRO_PUBLIC_P2P_HOST: ${NITRO_PUBLIC_P2P_HOST:-127.0.0.1}
|
||||
NITRO_PUBLIC_RPC_HOST: nitro-bridge
|
||||
entrypoint: ["bash", "-c", "/app/run-bridge.sh"]
|
||||
volumes:
|
||||
- nitro_bridge_data:/app/data
|
@ -3,19 +3,20 @@ name: nitro-contracts
|
||||
services:
|
||||
# Optionally deploys the Nitro contracts
|
||||
nitro-contracts:
|
||||
image: cerc/nitro-contracts:local
|
||||
image: cerc/nitro-client:local
|
||||
restart: on-failure
|
||||
environment:
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
CERC_GETH_URL: ${CERC_GETH_URL}
|
||||
CERC_OPTIMISM_URL: ${CERC_OPTIMISM_URL}
|
||||
CERC_GETH_CHAIN_ID: ${CERC_GETH_CHAIN_ID:-1212}
|
||||
CERC_OPTIMISM_CHAIN_ID: ${CERC_OPTIMISM_CHAIN_ID:-42069}
|
||||
CERC_GETH_DEPLOYER_PK: ${CERC_GETH_DEPLOYER_PK}
|
||||
CERC_OPTIMISM_DEPLOYER_PK: ${CERC_GETH_DEPLOYER_PK}
|
||||
CERC_TOKEN_NAME: ${CERC_TOKEN_NAME}
|
||||
CERC_TOKEN_SYMBOL: ${CERC_TOKEN_SYMBOL}
|
||||
CERC_INITIAL_TOKEN_SUPPLY: ${CERC_INITIAL_TOKEN_SUPPLY}
|
||||
GETH_URL: ${GETH_URL}
|
||||
OPTIMISM_URL: ${OPTIMISM_URL}
|
||||
GETH_CHAIN_ID: ${GETH_CHAIN_ID:-1212}
|
||||
OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID:-42069}
|
||||
GETH_DEPLOYER_PK: ${GETH_DEPLOYER_PK}
|
||||
OPTIMISM_DEPLOYER_PK: ${GETH_DEPLOYER_PK}
|
||||
TOKEN_NAME: ${TOKEN_NAME}
|
||||
TOKEN_SYMBOL: ${TOKEN_SYMBOL}
|
||||
INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}
|
||||
DISABLE_DETERMINISTIC_DEPLOYMENT: ${DISABLE_DETERMINISTIC_DEPLOYMENT:-true}
|
||||
volumes:
|
||||
- nitro_deployment:/app/deployment
|
||||
- ../config/nitro-contracts/deploy.sh:/app/deploy.sh
|
||||
|
45
stack-orchestrator/compose/docker-compose-nitro-node.yml
Normal file
45
stack-orchestrator/compose/docker-compose-nitro-node.yml
Normal file
@ -0,0 +1,45 @@
|
||||
name: nitro-node
|
||||
|
||||
services:
|
||||
nitro-node:
|
||||
image: cerc/go-nitro:local
|
||||
hostname: nitro-node
|
||||
restart: on-failure
|
||||
environment:
|
||||
NITRO_USE_DURABLE_STORE: true
|
||||
NITRO_MSG_PORT: ${NITRO_MSG_PORT:-3005}
|
||||
NITRO_RPC_PORT: ${NITRO_RPC_PORT:-4005}
|
||||
NITRO_SC_PK: ${NITRO_SC_PK}
|
||||
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
|
||||
NITRO_CHAIN_URL: ${NITRO_CHAIN_URL}
|
||||
NITRO_BOOTPEERS: ${NITRO_BOOTPEERS}
|
||||
NITRO_PUBLIC_P2P_HOST: ${NITRO_PUBLIC_P2P_HOST:-127.0.0.1}
|
||||
NITRO_L2: ${NITRO_L2:-false}
|
||||
NA_ADDRESS: ${NA_ADDRESS}
|
||||
CA_ADDRESS: ${CA_ADDRESS}
|
||||
VPA_ADDRESS: ${VPA_ADDRESS}
|
||||
BRIDGE_ADDRESS: ${BRIDGE_ADDRESS}
|
||||
NITRO_PUBLIC_RPC_HOST: nitro-node
|
||||
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
|
||||
volumes:
|
||||
- nitro_node_data:/app/data
|
||||
- nitro_node_tls:/app/tls
|
||||
- nitro_node_caroot:/app/mkcert-caroot
|
||||
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
|
||||
- ../config/go-nitro/create-certs.sh:/app/create-certs.sh
|
||||
ports:
|
||||
- 3005
|
||||
- 4005
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-vz", "localhost", "4005"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
retries: 10
|
||||
start_period: 10s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
volumes:
|
||||
nitro_node_data:
|
||||
nitro_node_tls:
|
||||
nitro_node_caroot:
|
@ -2,7 +2,7 @@ name: nitro-rpc-client
|
||||
|
||||
services:
|
||||
nitro-rpc-client:
|
||||
image: cerc/nitro-contracts:local
|
||||
image: cerc/nitro-client:local
|
||||
hostname: nitro-rpc-client
|
||||
restart: on-failure
|
||||
environment:
|
||||
|
@ -13,7 +13,7 @@ if [ -f "$cert_file" ] ; then
|
||||
echo "Cert file ${cert_file} already exists"
|
||||
else
|
||||
echo "Creating certs"
|
||||
mkcert -cert-file $cert_file -key-file $key_file statechannels.org localhost 127.0.0.1 $CERC_NITRO_PUBLIC_RPC_HOST ::1
|
||||
mkcert -cert-file $cert_file -key-file $key_file statechannels.org localhost 127.0.0.1 $NITRO_PUBLIC_RPC_HOST ::1
|
||||
|
||||
# Copy over the rootCA cert so that it can be used by the client
|
||||
cp -r $(mkcert -CAROOT)/* /app/mkcert-caroot
|
||||
|
@ -10,36 +10,45 @@ bridge_assets_map_file="/app/deployment/bridge-assets-map.toml"
|
||||
bridge_config_file="/app/bridge.toml"
|
||||
|
||||
echo "Using the following environment variables:"
|
||||
echo "CERC_NITRO_L1_CHAIN_URL: ${CERC_NITRO_L1_CHAIN_URL}"
|
||||
echo "CERC_NITRO_L2_CHAIN_URL: ${CERC_NITRO_L2_CHAIN_URL}"
|
||||
echo "CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK}"
|
||||
echo "CERC_NITRO_SC_PK: ${CERC_NITRO_SC_PK}"
|
||||
echo "CERC_NITRO_L1_MSG_PORT: ${CERC_NITRO_L1_MSG_PORT}"
|
||||
echo "CERC_NITRO_L2_MSG_PORT: ${CERC_NITRO_L2_MSG_PORT}"
|
||||
echo "CERC_NITRO_RPC_PORT: ${CERC_NITRO_RPC_PORT}"
|
||||
echo "CERC_NITRO_PUBLIC_P2P_HOST: ${CERC_NITRO_PUBLIC_P2P_HOST}"
|
||||
echo "NITRO_L1_CHAIN_URL: ${NITRO_L1_CHAIN_URL}"
|
||||
echo "NITRO_L2_CHAIN_URL: ${NITRO_L2_CHAIN_URL}"
|
||||
echo "NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}"
|
||||
echo "NITRO_SC_PK: ${NITRO_SC_PK}"
|
||||
echo "NITRO_L1_MSG_PORT: ${NITRO_L1_MSG_PORT}"
|
||||
echo "NITRO_L2_MSG_PORT: ${NITRO_L2_MSG_PORT}"
|
||||
echo "NITRO_RPC_PORT: ${NITRO_RPC_PORT}"
|
||||
echo "NITRO_PUBLIC_P2P_HOST: ${NITRO_PUBLIC_P2P_HOST}"
|
||||
|
||||
echo "Waiting for $bridge_assets_map_file to be ready"
|
||||
|
||||
while [ ! -e "$bridge_assets_map_file" ]; do
|
||||
sleep 3
|
||||
done
|
||||
|
||||
echo "File $bridge_assets_map_file found"
|
||||
|
||||
# Create required certs
|
||||
./create-certs.sh
|
||||
|
||||
# Create the bridge config file
|
||||
cat <<EOF > "$bridge_config_file"
|
||||
chainpk = "$CERC_NITRO_CHAIN_PK"
|
||||
statechannelpk = "$CERC_NITRO_SC_PK"
|
||||
l1chainurl = "$CERC_NITRO_L1_CHAIN_URL"
|
||||
l2chainurl = "$CERC_NITRO_L2_CHAIN_URL"
|
||||
nodel1msgport = $CERC_NITRO_L1_MSG_PORT
|
||||
nodel2msgport = $CERC_NITRO_L2_MSG_PORT
|
||||
rpcport = $CERC_NITRO_RPC_PORT
|
||||
bridgepublicip = "$CERC_NITRO_PUBLIC_P2P_HOST"
|
||||
chainpk = "$NITRO_CHAIN_PK"
|
||||
statechannelpk = "$NITRO_SC_PK"
|
||||
l1chainurl = "$NITRO_L1_CHAIN_URL"
|
||||
l2chainurl = "$NITRO_L2_CHAIN_URL"
|
||||
nodel1msgport = $NITRO_L1_MSG_PORT
|
||||
nodel2msgport = $NITRO_L2_MSG_PORT
|
||||
rpcport = $NITRO_RPC_PORT
|
||||
bridgepublicip = "$NITRO_PUBLIC_P2P_HOST"
|
||||
assetmapfilepath = "$bridge_assets_map_file"
|
||||
EOF
|
||||
|
||||
# Export contract addresses
|
||||
export NA_ADDRESS=$(jq -r ".\"$CERC_GETH_CHAIN_ID\"[0].contracts.NitroAdjudicator.address" ${nitro_addresses_file})
|
||||
export CA_ADDRESS=$(jq -r ".\"$CERC_GETH_CHAIN_ID\"[0].contracts.ConsensusApp.address" ${nitro_addresses_file})
|
||||
export VPA_ADDRESS=$(jq -r ".\"$CERC_GETH_CHAIN_ID\"[0].contracts.VirtualPaymentApp.address" ${nitro_addresses_file})
|
||||
export BRIDGE_ADDRESS=$(jq -r ".\"$CERC_OPTIMISM_CHAIN_ID\"[0].contracts.Bridge.address" ${nitro_addresses_file})
|
||||
export NA_ADDRESS=$(jq -r ".\"$GETH_CHAIN_ID\"[0].contracts.NitroAdjudicator.address" ${nitro_addresses_file})
|
||||
export CA_ADDRESS=$(jq -r ".\"$GETH_CHAIN_ID\"[0].contracts.ConsensusApp.address" ${nitro_addresses_file})
|
||||
export VPA_ADDRESS=$(jq -r ".\"$GETH_CHAIN_ID\"[0].contracts.VirtualPaymentApp.address" ${nitro_addresses_file})
|
||||
export BRIDGE_ADDRESS=$(jq -r ".\"$OPTIMISM_CHAIN_ID\"[0].contracts.Bridge.address" ${nitro_addresses_file})
|
||||
|
||||
# Start bridge
|
||||
echo "Starting nitro-bridge"
|
||||
./nitro-bridge -config $bridge_config_file
|
||||
|
@ -1,30 +1,48 @@
|
||||
#!/bin/bash
|
||||
|
||||
# TODO: Support running node on L2
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
if [ -z "$CERC_NA_ADDRESS" ]; then
|
||||
echo "Error: NA_ADDRESS is not present"
|
||||
exit 1
|
||||
fi
|
||||
node_config_file="/app/config.toml"
|
||||
|
||||
if [ -z "$CERC_VPA_ADDRESS" ]; then
|
||||
echo "Error: VPA_ADDRESS is not present"
|
||||
exit 1
|
||||
fi
|
||||
echo "Using the following environment variables:"
|
||||
echo "NITRO_USE_DURABLE_STORE: ${NITRO_USE_DURABLE_STORE}"
|
||||
echo "NITRO_MSG_PORT: ${NITRO_MSG_PORT}"
|
||||
echo "NITRO_RPC_PORT: ${NITRO_RPC_PORT}"
|
||||
echo "NITRO_SC_PK: ${NITRO_SC_PK}"
|
||||
echo "NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}"
|
||||
echo "NITRO_CHAIN_URL: ${NITRO_CHAIN_URL}"
|
||||
echo "NITRO_BOOTPEERS: ${NITRO_BOOTPEERS}"
|
||||
echo "NITRO_PUBLIC_P2P_HOST: ${NITRO_PUBLIC_P2P_HOST}"
|
||||
echo "NITRO_L2: ${NITRO_L2}"
|
||||
|
||||
if [ -z "$CERC_CA_ADDRESS" ]; then
|
||||
echo "Error: CA_ADDRESS is not present"
|
||||
exit 1
|
||||
fi
|
||||
echo "Using Nitro contract addresses:"
|
||||
echo "NA_ADDRESS: ${NA_ADDRESS}"
|
||||
echo "CA_ADDRESS: ${CA_ADDRESS}"
|
||||
echo "VPA_ADDRESS: ${VPA_ADDRESS}"
|
||||
echo "BRIDGE_ADDRESS: ${BRIDGE_ADDRESS}"
|
||||
|
||||
echo "CERC_NITRO_CHAIN_URL: ${CERC_NITRO_CHAIN_URL}"
|
||||
echo "CERC_NITRO_MSG_PORT: ${CERC_NITRO_MSG_PORT}"
|
||||
echo "CERC_NITRO_RPC_PORT: ${CERC_NITRO_RPC_PORT}"
|
||||
echo "CERC_NITRO_PK: ${CERC_NITRO_PK}"
|
||||
echo "CERC_NITRO_CHAIN_PK: ${CERC_NITRO_CHAIN_PK}"
|
||||
echo "CERC_PUBLIC_IP: ${CERC_PUBLIC_IP}"
|
||||
# Create required certs
|
||||
./create-certs.sh
|
||||
|
||||
./nitro -chainurl ${CERC_NITRO_CHAIN_URL} -msgport ${CERC_NITRO_MSG_PORT} -rpcport ${CERC_NITRO_RPC_PORT} -pk ${CERC_NITRO_PK} -chainpk ${CERC_NITRO_CHAIN_PK} -naaddress ${CERC_NA_ADDRESS} -vpaaddress ${CERC_VPA_ADDRESS} -caaddress ${CERC_CA_ADDRESS} -publicip ${CERC_PUBLIC_IP}
|
||||
# Create the required config file
|
||||
cat <<EOF > "$node_config_file"
|
||||
usedurablestore = ${NITRO_USE_DURABLE_STORE}
|
||||
msgport = ${NITRO_MSG_PORT}
|
||||
rpcport = ${NITRO_RPC_PORT}
|
||||
pk = "${NITRO_SC_PK}"
|
||||
chainpk = "${NITRO_CHAIN_PK}"
|
||||
chainurl = "${NITRO_CHAIN_URL}"
|
||||
bootpeers = "${NITRO_BOOTPEERS}"
|
||||
bridgepublicip = "${NITRO_PUBLIC_P2P_HOST}"
|
||||
l2 = ${NITRO_L2}
|
||||
|
||||
naaddress = "${NA_ADDRESS}"
|
||||
vpaaddress = "${CA_ADDRESS}"
|
||||
caaddress = "${VPA_ADDRESS}"
|
||||
bridgeaddress = "${BRIDGE_ADDRESS}"
|
||||
EOF
|
||||
|
||||
# Start the node
|
||||
./nitro -config $node_config_file
|
||||
|
@ -10,27 +10,16 @@ nitro_addresses_file="/app/deployment/nitro-addresses.json"
|
||||
bridge_assets_map_file="/app/deployment/bridge-assets-map.toml"
|
||||
|
||||
echo "Using the following environment variables:"
|
||||
echo "CERC_GETH_URL: ${CERC_GETH_URL}"
|
||||
echo "CERC_OPTIMISM_URL: ${CERC_OPTIMISM_URL}"
|
||||
echo "CERC_GETH_CHAIN_ID: ${CERC_GETH_CHAIN_ID}"
|
||||
echo "CERC_OPTIMISM_CHAIN_ID: ${CERC_OPTIMISM_CHAIN_ID}"
|
||||
echo "CERC_GETH_DEPLOYER_PK: ${CERC_GETH_DEPLOYER_PK}"
|
||||
echo "CERC_OPTIMISM_DEPLOYER_PK: ${CERC_OPTIMISM_DEPLOYER_PK}"
|
||||
echo "CERC_TOKEN_NAME: ${CERC_TOKEN_NAME}"
|
||||
echo "CERC_TOKEN_SYMBOL: ${CERC_TOKEN_SYMBOL}"
|
||||
echo "CERC_INITIAL_TOKEN_SUPPLY: ${CERC_INITIAL_TOKEN_SUPPLY}"
|
||||
|
||||
export GETH_URL=$CERC_GETH_URL
|
||||
export GETH_CHAIN_ID=$CERC_GETH_CHAIN_ID
|
||||
export OPTIMISM_CHAIN_ID=$CERC_OPTIMISM_CHAIN_ID
|
||||
export OPTIMISM_URL=$CERC_OPTIMISM_URL
|
||||
export GETH_DEPLOYER_PK=$CERC_GETH_DEPLOYER_PK
|
||||
export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK
|
||||
export DISABLE_DETERMINISTIC_DEPLOYMENT=true
|
||||
|
||||
export TOKEN_NAME=$CERC_TOKEN_NAME
|
||||
export TOKEN_SYMBOL=$CERC_TOKEN_SYMBOL
|
||||
export INITIAL_TOKEN_SUPPLY=$CERC_INITIAL_TOKEN_SUPPLY
|
||||
echo "GETH_URL: ${GETH_URL}"
|
||||
echo "OPTIMISM_URL: ${OPTIMISM_URL}"
|
||||
echo "GETH_CHAIN_ID: ${GETH_CHAIN_ID}"
|
||||
echo "OPTIMISM_CHAIN_ID: ${OPTIMISM_CHAIN_ID}"
|
||||
echo "GETH_DEPLOYER_PK: ${GETH_DEPLOYER_PK}"
|
||||
echo "OPTIMISM_DEPLOYER_PK: ${OPTIMISM_DEPLOYER_PK}"
|
||||
echo "TOKEN_NAME: ${TOKEN_NAME}"
|
||||
echo "TOKEN_SYMBOL: ${TOKEN_SYMBOL}"
|
||||
echo "INITIAL_TOKEN_SUPPLY: ${INITIAL_TOKEN_SUPPLY}"
|
||||
echo "DISABLE_DETERMINISTIC_DEPLOYMENT: ${DISABLE_DETERMINISTIC_DEPLOYMENT}"
|
||||
|
||||
# Check if L1 chain id key is present for L1 deployment
|
||||
if [ -f "$nitro_addresses_file" ] && jq -e "has(\"$GETH_CHAIN_ID\")" ${nitro_addresses_file} > /dev/null; then
|
||||
@ -69,3 +58,6 @@ l2AssetAddress = "$L2_ASSET_ADDRESS"
|
||||
EOF
|
||||
|
||||
echo "Done"
|
||||
|
||||
# Keep the container running for future asset transfers
|
||||
tail -f /dev/null
|
||||
|
@ -15,7 +15,7 @@ RUN go mod tidy
|
||||
RUN go build -v -o nitro .
|
||||
RUN go build -o nitro-bridge cmd/start-bridge/main.go
|
||||
|
||||
# TODO: Update steps to build go-nitro image
|
||||
|
||||
# Reduce image size
|
||||
FROM debian:bullseye-slim
|
||||
RUN apt-get update
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/nitro-contracts
|
||||
# Build cerc/nitro-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-contracts:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
||||
docker build -t cerc/nitro-client:local -f ${SCRIPT_DIR}/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/go-nitro
|
@ -19,3 +19,68 @@
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge build-containers
|
||||
```
|
||||
|
||||
## Create a deployment
|
||||
|
||||
- Create a spec file
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --output bridge-spec.yml
|
||||
```
|
||||
|
||||
- TODO: Edit `network` in the spec file to map container ports to host ports as required:
|
||||
|
||||
```bash
|
||||
network:
|
||||
ports:
|
||||
go-nitro:
|
||||
- 3005:3005
|
||||
- 3006:3006
|
||||
- 4006:4006
|
||||
```
|
||||
|
||||
- Create deployment
|
||||
|
||||
```bash
|
||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-spec.yml --deployment-dir bridge-deployment
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
- Inside the `bridge-deployment` deployment directory, open `config.env` file and set following env variables:
|
||||
|
||||
```bash
|
||||
GETH_CHAIN_ID=1212
|
||||
|
||||
OPTIMISM_CHAIN_ID=42069
|
||||
|
||||
# URL endpoint of the L1 chain (Example: ws://host.docker.internal:8545)
|
||||
NITRO_L1_CHAIN_URL=
|
||||
|
||||
# URL endpoint of the L2 chain (Example: ws://host.docker.internal:8546)
|
||||
NITRO_L2_CHAIN_URL=
|
||||
|
||||
# Private key of the account on chain that is used for funding channels
|
||||
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK}
|
||||
|
||||
NITRO_SC_PK: ${NITRO_SC_PK}
|
||||
|
||||
# Port to be used by P2P message service for L1
|
||||
NITRO_L1_MSG_PORT=3005
|
||||
|
||||
# Port to be used by P2P message service for L2
|
||||
NITRO_L2_MSG_PORT=3006
|
||||
|
||||
# Port to be used by RPC server
|
||||
NITRO_RPC_PORT=4006
|
||||
|
||||
NITRO_PUBLIC_P2P_HOST=127.0.0.1
|
||||
|
||||
NITRO_PUBLIC_RPC_HOST=nitro-bridge
|
||||
```
|
||||
|
||||
## Start the deployment
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir bridge-deployment start
|
||||
```
|
||||
|
@ -1,12 +1,12 @@
|
||||
version: "1.0"
|
||||
name: bridge
|
||||
description: "Nitro bridge node"
|
||||
description: "Nitro bridge with contracts deployment and nitro-rpc-client"
|
||||
repos:
|
||||
- github.com/cerc-io/go-nitro
|
||||
containers:
|
||||
- cerc/nitro-contracts
|
||||
- cerc/nitro-client
|
||||
- cerc/go-nitro
|
||||
pods:
|
||||
- nitro-contracts
|
||||
- bridge
|
||||
- nitro-bridge
|
||||
- nitro-rpc-client
|
||||
|
@ -1,4 +1,4 @@
|
||||
# Go-nitro
|
||||
# nitro-node
|
||||
|
||||
## Setup
|
||||
|
||||
@ -36,9 +36,8 @@
|
||||
network:
|
||||
ports:
|
||||
go-nitro:
|
||||
- 3006:3006
|
||||
- 4006:4006
|
||||
- 5006:5006
|
||||
- 3005:3005
|
||||
- 4005:4005
|
||||
```
|
||||
|
||||
- Create deployment
|
||||
@ -53,26 +52,31 @@
|
||||
|
||||
```bash
|
||||
# URL endpoint of the chain (Example: ws://host.docker.internal:8545)
|
||||
CERC_NITRO_CHAIN_URL=
|
||||
NITRO_CHAIN_URL=
|
||||
|
||||
# Private key of account to be used by Nitro node (derived address is used as Nitro address)
|
||||
CERC_NITRO_PK=
|
||||
NITRO_PK=
|
||||
|
||||
# Private key of the account on chain that is used for funding channels in Nitro node
|
||||
CERC_NITRO_CHAIN_PK=
|
||||
NITRO_CHAIN_PK=
|
||||
|
||||
# Port to be used by P2P message service (Example: 3009)
|
||||
CERC_NITRO_MSG_PORT=
|
||||
NITRO_MSG_PORT=
|
||||
|
||||
# Port to be used by RPC server (Example: 4009)
|
||||
CERC_NITRO_RPC_PORT=4009
|
||||
NITRO_RPC_PORT=4009
|
||||
|
||||
# Optional
|
||||
# Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp
|
||||
# TODO: Contracts are deployed if addresses are not set
|
||||
CERC_NA_ADDRESS=
|
||||
CERC_VPA_ADDRESS=
|
||||
CERC_CA_ADDRESS=
|
||||
# Contract address of NitroAdjudicator
|
||||
NA_ADDRESS=
|
||||
|
||||
# Contract address of VirtualPaymentApp
|
||||
VPA_ADDRESS=
|
||||
|
||||
# Contract address of ConsensusApp
|
||||
CA_ADDRESS=
|
||||
|
||||
# Address of the bridge node
|
||||
BRIDGE_ADDRESS=
|
||||
```
|
||||
|
||||
## Start the deployment
|
||||
@ -80,3 +84,4 @@
|
||||
```bash
|
||||
laconic-so deployment --dir nitro-node-deployment start
|
||||
```
|
||||
<!-- TODO: Implement -->
|
||||
|
@ -1,11 +1,11 @@
|
||||
version: "1.0"
|
||||
name: go-nitro
|
||||
description: "Stack to demonstrate payments between various services"
|
||||
name: nitro-node
|
||||
description: "Nitro node with nitro-rpc-client"
|
||||
repos:
|
||||
- github.com/cerc-io/go-nitro
|
||||
containers:
|
||||
- cerc/go-nitro
|
||||
- cerc/nitro-contracts
|
||||
- cerc/nitro-client
|
||||
pods:
|
||||
- go-nitro
|
||||
- nitro-node
|
||||
- nitro-rpc-client
|
||||
|
Loading…
Reference in New Issue
Block a user