diff --git a/stack-orchestrator/stacks/testnet-laconicd/README.md b/stack-orchestrator/stacks/testnet-laconicd/README.md index f7a5fe5..c7b32ff 100644 --- a/stack-orchestrator/stacks/testnet-laconicd/README.md +++ b/stack-orchestrator/stacks/testnet-laconicd/README.md @@ -26,10 +26,12 @@ Instructions for running a laconicd testnet full node and joining as a validator ```bash # laconicd - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories --pull # laconic cli and console - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console setup-repositories --pull + + # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command ``` * Build the container images: @@ -38,7 +40,7 @@ Instructions for running a laconicd testnet full node and joining as a validator # laconicd laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd build-containers - # laocnic cli and console + # laconic cli and console laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-console build-containers ``` @@ -216,7 +218,10 @@ laconic-so deployment --dir laconic-console-deployment start * Create required validator configuration: ```bash + # Note: # Edit the staking amount and other fields as required + # Replace with your node's moniker in command below + laconic-so deployment --dir testnet-laconicd-deployment exec laconicd 'cat < -validator.json { "pubkey": $(laconicd cometbft show-validator), @@ -256,6 +261,12 @@ laconic-so deployment --dir laconic-console-deployment start # Set your PK as 'userKey' in the config file laconic-so deployment --dir laconic-console-deployment exec cli "nano config.yml" + # services: + # registry: + # ... + # userKey: + # ... + # Note: any changes made to the config will be lost when the cli Docker container is brought down # So set / update the values in 'laconic-console-deployment/config.env' accordingly before restarting ``` diff --git a/testnet-onboarding-demo.md b/testnet-onboarding-demo.md index f292f0b..8699493 100644 --- a/testnet-onboarding-demo.md +++ b/testnet-onboarding-demo.md @@ -4,349 +4,404 @@ ### Laconic Wallet -1. Follow the [Install](https://git.vdb.to/cerc-io/laconic-wallet#install) steps from the laconic-wallet README to setup Android Studio +- Install laconic wallet using [latest APK release](https://git.vdb.to/cerc-io/laconic-wallet/releases) -2. Clone the repository + - Download the APK file in latest release `laconic-wallet-debug.apk` - ``` - git clone git@git.vdb.to:cerc-io/laconic-wallet.git - ``` + - Install the APK on your device -3. Enter the project directory + - It will need third party installation permission to install the APK - ``` - cd laconic-wallet - ``` +- (Optional) Build laconic wallet from source by following the steps below -4. Setup .env - - Copy and update [`.env`](./.env) + - Follow the [Install](https://git.vdb.to/cerc-io/laconic-wallet#install) steps from the laconic-wallet README to setup Android Studio - ``` - cp .env.example .env - ``` - - - In the `.env` file add your WalletConnect project id. You can generate your own ProjectId at (use `gmail` address) - - ``` - WALLET_CONNECT_PROJECT_ID=39bc93c... - ``` - -5. Install dependencies - - ``` - yarn - ``` - -6. Exit project repo + - Clone the repository + ```bash + git clone git@git.vdb.to:cerc-io/laconic-wallet.git ``` + + - Enter the project directory + + ```bash + cd laconic-wallet + ``` + + - Setup .env + - Copy and update [`.env`](./.env) + + ```bash + cp .env.example .env + ``` + + - In the `.env` file add your WalletConnect project id. You can generate your own ProjectId at (use `gmail` address) + + ```bash + WALLET_CONNECT_PROJECT_ID=39bc93c... + ``` + + - Install dependencies + + ```bash + yarn + ``` + + - Exit project repo + + ```bash cd ../ ``` ### Testnet Onboarding App -1. Clone the repository +- Clone the repository - ``` - git clone git@git.vdb.to:cerc-io/testnet-onboarding-app.git - ``` + ```bash + git clone git@git.vdb.to:cerc-io/testnet-onboarding-app.git + ``` -2. Enter the project directory +- Enter the project directory - ``` - cd testnet-onboarding-app - ``` + ```bash + cd testnet-onboarding-app + ``` -3. Setup .env - - Copy and update `.env` - - ``` - cp .env.example .env - ``` - - - In the `.env` file, add the WalletConnect project ID used in your [laconic-wallet](https://git.vdb.to/cerc-io/laconic-wallet) setup. - - ``` - WALLET_CONNECT_PROJECT_ID=39bc93c... - ``` - -4. Install dependencies - - ``` - yarn - ``` - -5. Exit project repo +- Setup .env + - Copy and update `.env` + ```bash + cp .env.example .env ``` - cd ../ + + - In the `.env` file, add the WalletConnect project ID used in your [laconic-wallet](https://git.vdb.to/cerc-io/laconic-wallet) setup. + + ```bash + WALLET_CONNECT_PROJECT_ID=39bc93c... ``` +- Install dependencies + + ```bash + yarn + ``` + +- Exit project repo + + ```bash + cd ../ + ``` + ### Stack Orchestrator - Follow these steps to install laconic-so: -### Fixturenet laconicd Stack and laconic-faucet +### fixturenet-laconicd and laconic-faucet Stacks -1. Clone the stack repos: +- Clone the stack repos: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-laconicd-stack --git-ssh --pull + laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --git-ssh --pull + ``` + +- Clone required repositories: + + ```bash + # laconicd + laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd setup-repositories --git-ssh --pull + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet setup-repositories --git-ssh --pull + ``` + +- Build the container images: + + ```bash + # laconicd + laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet build-containers --force-rebuild + ``` + +- Create a deployment for stage 0: + - Create spec files for the deployment: ```bash - laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-laconicd-stack --git-ssh --pull - laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --git-ssh --pull + laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output stage0-spec.yml ``` -2. Clone required repositories: + - Edit `network` in the spec file to map container ports to host ports as required: ```bash - # laconicd - laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd setup-repositories --git-ssh --pull - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet setup-repositories --git-ssh --pull + # stage0-spec.yml + ... + network: + ports: + laconicd: + - '6060' + - '26657:26657' + - '26656:26656' + - '9473:9473' + - '9090:9090' + - '1317:1317' ``` -3. Build the container images: + - Create a deployment from the spec file: ```bash - # laconicd - laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet build-containers --force-rebuild + laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file stage0-spec.yml --deployment-dir stage0-deployment ``` -4. Create a deployment for stage 0: - - Create spec files for the deployment: - - ```bash - laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output stage0-spec.yml - ``` - - - Edit `network` in the spec file to map container ports to host ports as required: - - ```bash - # stage0-spec.yml - ... - network: - ports: - laconicd: - - '6060' - - '26657:26657' - - '26656:26656' - - '9473:9473' - - '9090:9090' - - '1317:1317' - ``` - - - Create a deployment from the spec file: - - ```bash - laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file stage0-spec.yml --deployment-dir stage0-deployment - ``` - - - In `stage0-deployment/config.env` file, set the following env variable: - - ```bash - # Set to true to enable adding participants functionality of the onboarding module - ONBOARDING_ENABLED=true - ``` - -5. Create a deployment for stage 1: - - Create spec file for the deployment: - - ```bash - laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output stage1-spec.yml - ``` - - - Edit `network` in the spec file to map container ports to host ports as required: - - ```bash - # stage1-spec.yml - ... - network: - ports: - laconicd: - - '6060' - - '26657:26657' - - '26656:26656' - - '9473:9473' - - '9090:9090' - - '1317:1317' - ``` - - - Create a deployment from the spec file: - - ```bash - laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file stage1-spec.yml --deployment-dir stage1-deployment - ``` - -6. Create a deployment for laconic-faucet: - - Create spec file for the deployment: - - ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy init --output laconic-faucet-spec.yml - ``` - - - Edit `network` in the spec file to map container port to host port as required: - - ```bash - # laconic-faucet-spec.yml - ... - network: - ports: - laconic-faucet: - - '4000:3000' - ``` - - - Create a deployment from the spec file: - - ```bash - laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy create --spec-file laconic-faucet-spec.yml --deployment-dir laconic-faucet-deployment - - # Place in the same namespace as stage0 - cp stage0-deployment/deployment.yml laconic-faucet-deployment/deployment.yml - ``` - -### L1 eth and L2 optimism stacks - -1. Clone the stack repo: + - In `stage0-deployment/config.env` file, set the following env variable: ```bash - laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-eth-stacks --pull - laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull + # Set to true to enable adding participants functionality of the onboarding module + ONBOARDING_ENABLED=true ``` -2. Clone required repositories: +- Create a deployment for stage 1: + - Create spec file for the deployment: ```bash - # L1 (fixturenet-eth) - laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth setup-repositories --pull - - # L2 (optimism) - laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories --pull - - # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove all repositories from that stack and re-run the command - # The repositories are located in $HOME/cerc by default + laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy init --output stage1-spec.yml ``` -3. Build the container images: + - Copy the contents of `stage0-spec.yml` to `stage1-spec.yml`: ```bash - # Remove any older foundry image with `latest` tag - docker rmi ghcr.io/foundry-rs/foundry:latest - - # L1 (fixturenet-eth) - laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth build-containers --force-rebuild - - # L2 (optimism) - laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers --force-rebuild - - # If errors are thrown during build, old images used by this stack would have to be deleted + cp stage0-spec.yml stage1-spec.yml ``` - - NOTE: this will take >10 mins depending on the specs of your machine, and **requires** 16GB of memory or greater. - - - Remove any dangling Docker images (to clear up space): - ```bash - docker image prune - ``` - -4. Create spec files for deployments, which will map the stack's ports and volumes to the host: + - Create a deployment from the spec file: ```bash - laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth deploy init --output fixturenet-eth-spec.yml - - laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy init --output fixturenet-optimism-spec.yml + laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file stage1-spec.yml --deployment-dir stage1-deployment ``` -5. Configure ports: - - `fixturenet-eth-spec.yml` - - ```yml - ... - network: - ports: - fixturenet-eth-bootnode-geth: - - '9898:9898' - - '30303' - fixturenet-eth-geth-1: - - '8545:8545' - - '8546:8546' - - '40000' - - '6060' - fixturenet-eth-lighthouse-1: - - '8001' - ... - ``` - - - `fixturenet-optimism-spec.yml` - - ```yml - ... - network: - ports: - op-geth: - - '9545:8545' - - '9546:8546' - ... - ``` - -6. Create deployments: - Once you've made any needed changes to the spec files, create deployments from them: +- Create a deployment for laconic-faucet: + - Create spec file for the deployment: ```bash - laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth deploy create --spec-file fixturenet-eth-spec.yml --deployment-dir fixturenet-eth-deployment - - laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file fixturenet-optimism-spec.yml --deployment-dir fixturenet-optimism-deployment - - # Place them both in the same namespace (cluster) - cp fixturenet-eth-deployment/deployment.yml fixturenet-optimism-deployment/deployment.yml + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy init --output laconic-faucet-spec.yml ``` -7. Env configuration: - In `fixturenet-eth-deployment/config.env` file add the following env variables: + - Edit `network` in the spec file to map container port to host port as required: ```bash - # Allow unprotected txs for Optimism contracts deployment - CERC_ALLOW_UNPROTECTED_TXS=true + # laconic-faucet-spec.yml + ... + network: + ports: + laconic-faucet: + - '4000:3000' ``` + - Create a deployment from the spec file: + + ```bash + laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/laconic-faucet deploy create --spec-file laconic-faucet-spec.yml --deployment-dir laconic-faucet-deployment + + # Place in the same namespace as stage0 + cp stage0-deployment/deployment.yml laconic-faucet-deployment/deployment.yml + ``` + +### L1 eth and L2 Optimism Stacks + +- Clone the stack repo: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-eth-stacks --pull + laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack --pull + ``` + +- Clone required repositories: + + ```bash + # L1 (fixturenet-eth) + laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth setup-repositories --pull + + # L2 (optimism) + laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories --pull + + # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove all repositories from that stack and re-run the command + # The repositories are located in $HOME/cerc by default + ``` + +- Build the container images: + + ```bash + # Remove any older foundry image with `latest` tag + docker rmi ghcr.io/foundry-rs/foundry:latest + + # L1 (fixturenet-eth) + laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth build-containers --force-rebuild + + # L2 (optimism) + laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers --force-rebuild + + # If errors are thrown during build, old images used by this stack would have to be deleted + ``` + + - NOTE: this will take >10 mins depending on the specs of your machine, and **requires** 16GB of memory or greater. + + - Remove any dangling Docker images (to clear up space): + + ```bash + docker image prune + ``` + +- Create spec files for deployments, which will map the stack's ports and volumes to the host: + + ```bash + laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth deploy init --output fixturenet-eth-spec.yml + + laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy init --output fixturenet-optimism-spec.yml + ``` + +- Configure ports: + - `fixturenet-eth-spec.yml` + + ```yml + ... + network: + ports: + fixturenet-eth-bootnode-geth: + - '9898:9898' + - '30303' + fixturenet-eth-geth-1: + - '8545:8545' + - '8546:8546' + - '40000' + - '6060' + fixturenet-eth-lighthouse-1: + - '8001' + ... + ``` + + - `fixturenet-optimism-spec.yml` + + ```yml + ... + network: + ports: + op-geth: + - '9545:8545' + - '9546:8546' + ... + ``` + +- Create deployments: + Once you've made any needed changes to the spec files, create deployments from them: + + ```bash + laconic-so --stack ~/cerc/fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-eth deploy create --spec-file fixturenet-eth-spec.yml --deployment-dir fixturenet-eth-deployment + + laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file fixturenet-optimism-spec.yml --deployment-dir fixturenet-optimism-deployment + + # Place them both in the same namespace (cluster) + cp fixturenet-eth-deployment/deployment.yml fixturenet-optimism-deployment/deployment.yml + ``` + +- Env configuration: + + ```bash + cat < fixturenet-eth-deployment/config.env + CERC_ALLOW_UNPROTECTED_TXS=true + EOF + ``` + ### Go Nitro -1. Clone go-nitro repository +- Clone the stack repo: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull + ``` + +- Clone required repositories: + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories --git-ssh --pull + ``` + +- Build the container images: ```bash - git clone git@github.com:cerc-io/go-nitro.git - cd go-nitro - - # Install Node.js dependencies and build the repo - yarn && yarn build - - # Install go dependencies - go mod tidy + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild ``` -2. Build go-nitro and bridge binaries +- Create a deployment spec-file for Alice's L1 nitro-node: + - Create spec files for the deployment: ```bash - go build - go build -o nitro-bridge cmd/start-bridge/main.go + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output l1alice-nitro-spec.yml ``` -3. Generate TLS certificate (prerequisite: [mkcert](https://github.com/cerc-io/go-nitro/tree/main/tls#tls)) + - Edit `network` in the spec file to map container ports to host ports as required: ```bash - cd tls - make create-cert - - # Go back to go-nitro - cd ../ + # l1alice-nitro-spec.yml + ... + network: + ports: + nitro-node: + - 3007:3005 + - 4007:4005 ``` -4. Install `nitro-rpc-client` package globally: +- Create a deployment spec-file for Charlie's L1 nitro-node: + - Create spec file for the deployment: ```bash - # In go-nitro - npm install -g ./packages/nitro-rpc-client + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output l1charlie-nitro-spec.yml + ``` - # Confirm global installation by running - nitro-rpc-client --version + - Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + # l1charlie-nitro-spec.yml + ... + network: + ports: + nitro-node: + - 3008:3005 + - 4008:4005 + ``` + +- Create a deployment spec-file for Alice's L2 nitro-node: + - Create spec files for the deployment: + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output l2alice-nitro-spec.yml + ``` + + - Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + # l2alice-nitro-spec.yml + ... + network: + ports: + nitro-node: + - 3009:3005 + - 4009:4005 + ``` + +- Create a deployment spec-file for Charlie's L2 nitro-node: + - Create spec file for the deployment: + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output l2charlie-nitro-spec.yml + ``` + + - Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + # l2charlie-nitro-spec.yml + ... + network: + ports: + nitro-node: + - 3010:3005 + - 4010:4005 ``` ## Run @@ -362,7 +417,7 @@ - Check status of L1 - - Run command in intervals of 3 seconds to check new blocks are created + - Run command in intervals of 3 seconds to check if new blocks are created ```bash laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast block-number" @@ -436,89 +491,35 @@ # 100000000000000000 ``` -- Deploy go-nitro contracts on L1 and L2 (run steps in go-nitro repo) - - Go to `packages/nitro-protocol` - - ```bash - # In go-nitro - cd packages/nitro-protocol - ``` - - - Export variables for geth and optimism urls and the deployer private key (Private key used by bridge nodes as well) - - ```bash - export GETH_URL="http://127.0.0.1:8545" - export GETH_CHAIN_ID=1212 - export OPTIMISM_URL="http://127.0.0.1:9545" - - export GETH_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218 - - # Use same account on both Geth and Optimism - export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK - ``` - - - Export variables for token name, token symbol and initial supply - ```bash - export TOKEN_NAME="LaconicNetworkToken" - export TOKEN_SYMBOL="LNT" - - # Note: Token supply denotes actual number of tokens and not the supply in Wei - export INITIAL_TOKEN_SUPPLY="10000000" - ``` - - - Disable deterministic deployment to make sure bridge node and address associated to it is the owner of contracts - - ```bash - export DISABLE_DETERMINISTIC_DEPLOYMENT=true - ``` - - - Reference: - - Deploy contracts on L1 and L2 - - ```bash - # Deploy contracts on geth - yarn contracts:deploy-geth - - # Deploy contracts on Optimism - yarn contracts:deploy-optimism - ``` - - - Deploy custom token on L1 - - ```bash - # Deploy token on geth - yarn contracts:deploy-token-geth - ``` - - - Note address of the deployed token on L1 and update `~/go-nitro/cmd/test-configs/bridge-assets-map.toml` config file +- Run the bridge: + - Create a spec-file for the deployment, map container ports to host ports and set env variables: ```bash - [[assets]] - l1AssetAddress = "" - ... + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy init --map-ports-to-host any-same --output bridge-nitro-spec.yml --config "NITRO_L1_CHAIN_URL=ws://host.docker.internal:8546,NITRO_L2_CHAIN_URL=ws://host.docker.internal:9546,NITRO_CHAIN_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218,NITRO_SC_PK=0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4,GETH_URL=http://host.docker.internal:8545,OPTIMISM_URL=http://host.docker.internal:9545,GETH_DEPLOYER_PK=$ACCOUNT_PK,OPTIMISM_DEPLOYER_PK=$ACCOUNT_PK,TOKEN_NAME=LaconicNetworkToken,TOKEN_SYMBOL=LNT,INITIAL_TOKEN_SUPPLY=129600" ``` - - Deploy custom token on L2 - ```bash - # Deploy token on Optimism - yarn contracts:deploy-token-optimism - ``` - - - Note address of the deployed token on L2 and update `~/go-nitro/cmd/test-configs/bridge-assets-map.toml` config file + - Create a deployment from the spec file: ```bash - [[assets]] - l1AssetAddress = "" - l2AssetAddress = "" + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/bridge deploy create --spec-file bridge-nitro-spec.yml --deployment-dir bridge-deployment + ``` + + - Start the nitro bridge + + ```bash + laconic-so deployment --dir bridge-deployment start + + # Check the logs, ensure that the node is running + laconic-so deployment --dir bridge-deployment logs nitro-bridge -f ``` - Send custom tokens to Alice and Charlie on L1 - Export variables for L1 token address - ```bash - export L1_ASSET_ADDRESS="" + export L1_ASSET_ADDRESS="$(laconic-so deployment --dir bridge-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")" + export A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a" export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293" ``` @@ -527,31 +528,12 @@ ```bash # Send tokens to Alice - yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth + laconic-so deployment --dir bridge-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth" #Send tokens to Charlie - yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth + laconic-so deployment --dir bridge-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $L1_ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth" ``` -- Go to go-nitro repo root - - ```bash - cd ../../ - ``` - -- Update `cmd/test-configs/bridge.toml` config file - - ```bash - chainpk = "888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218" - statechannelpk = "0279651921cd800ac560c21ceea27aab0107b67daf436cdd25ce84cad30159b4" - l1chainurl = "ws://127.0.0.1:8546" - l2chainurl = "ws://127.0.0.1:9546" - nodel1msgport = 3005 - nodel2msgport = 3006 - rpcport = 4006 - assetmapfilepath = "bridge-assets-map.toml" - ``` - - Start testnet-onboarding-app (run command in testnet-onboarding-app repo) ```bash @@ -561,15 +543,13 @@ NOTE: Ignore source map warnings in the terminal -- Start `laconic-wallet` android app (run steps in laconic-wallet repo) +- Run Laconic Wallet - - Set up the Android device - - For a physical device, refer to the [React Native documentation for running on a physical device](https://reactnative.dev/docs/running-on-device) - - For a virtual device, continue with the steps + - Connect your phone with the PC (Make sure that USB debugging is enabled on your phone) - Setup port forwarding for your device using the following command: - ``` + ```bash # Get device id adb devices @@ -577,14 +557,22 @@ adb -s reverse tcp:26657 tcp:26657 ``` - - Start the application: + - Open Laconic Wallet app that was installed from the APK - ``` - # In laconic-wallet - yarn start - ``` + - (Optional) Start `laconic-wallet` android app (run steps in laconic-wallet repo) - - Press `a` to run the application on android and wait till the wallet app opens up on your phone + - Set up the Android device + - For a physical device, refer to the [React Native documentation for running on a physical device](https://reactnative.dev/docs/running-on-device) + - For a virtual device, continue with the steps + + - Start the application: + + ```bash + # In laconic-wallet + yarn start + ``` + + - Press `a` to run the application on android and wait till the wallet app opens up on your phone - In laconic-wallet app, click on `Create wallet` and add laconicd chain using `Add network` button: @@ -596,7 +584,7 @@ Coin Type - `118` Native Denom - `photon` Address Prefix - `laconic` - Gas Price - `200000` + Gas Price - `0.01` ``` ## Demo @@ -612,170 +600,205 @@ - Run laconic-faucet: - - Get private key of funded faucet account from laconicd + - Get private key of funded faucet account from stage 0 laconicd chain: ```bash - laconic-so deployment --dir stage0-deployment exec laconicd "laconicd keys export alice --keyring-backend test --unarmored-hex --unsafe" + export FAUCET_ACCOUNT_PK=$(laconic-so deployment --dir stage0-deployment exec laconicd "echo y | laconicd keys export alice --keyring-backend test --unarmored-hex --unsafe") ``` - - In `laconic-faucet-deployment/config.env` file, set the following env variables: + - Set the env config for faucet deployment: ```bash - # Private key of a funded faucet account - CERC_FAUCET_KEY= + cat < laconic-faucet-deployment/config.env + CERC_FAUCET_KEY=$FAUCET_ACCOUNT_PK + EOF ``` - - Start the stack for laconic-faucet + - Start the stack for laconic-faucet: ```bash laconic-so deployment --dir laconic-faucet-deployment start ``` +- Get the deployed nitro contract addresses (run in the directory where the deployments were created): + + ```bash + # Nitro contract addresses + export NA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json") + export CA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json") + export VPA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json") + + # Contract address of bridge + export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"42069\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json") + ``` + - In the wallet, add 2 accounts (Alice and Charlie) for both the networks (ethereum and laconicd) by selecting the network and clicking on `Add account` -- Go to go-nitro repo root and start the nitro bridge using CLI: +- Get Ethereum private keys for accounts Alice and Charlie from wallet using the `Show private key` link (to be used as statechannel PKs) ```bash - # Export contract addresses stored in output files - source ./packages/nitro-protocol/hardhat-deployments/geth/.contracts.env - source ./packages/nitro-protocol/hardhat-deployments/optimism/.contracts.env - - # Start bridge CLI - ./nitro-bridge -config cmd/test-configs/bridge.toml + export A_PRIVATE_KEY= + export C_PRIVATE_KEY= ``` -- Get Ethereum private keys for accounts Alice and Charlie from `laconic-wallet` (to be used as statechannel PKs) +- Prepare deployments for the nodes + + - Create a deployment `l1alice-nitro-deployment` from the spec file + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l1alice-nitro-spec.yml --deployment-dir l1alice-nitro-deployment + ``` + + - Set the env variables for L1 Alice's nitro-node: + + ```bash + cat < l1alice-nitro-deployment/config.env + NITRO_CHAIN_URL=ws://host.docker.internal:8546 + NITRO_SC_PK=$A_PRIVATE_KEY + NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597 + NA_ADDRESS=$NA_ADDRESS + VPA_ADDRESS=$VPA_ADDRESS + CA_ADDRESS=$CA_ADDRESS + BRIDGE_ADDRESS=$BRIDGE_ADDRESS + NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3007 + EOF + ``` + + - Create a deployment `l1charlie-nitro-deployment` from the spec file + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l1charlie-nitro-spec.yml --deployment-dir l1charlie-nitro-deployment + ``` + + - Set the env variables for L1 Charlie's nitro-node: + + ```bash + cat < l1charlie-nitro-deployment/config.env + NITRO_CHAIN_URL=ws://host.docker.internal:8546 + NITRO_SC_PK=$C_PRIVATE_KEY + NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f + NA_ADDRESS=$NA_ADDRESS + VPA_ADDRESS=$VPA_ADDRESS + CA_ADDRESS=$CA_ADDRESS + BRIDGE_ADDRESS=$BRIDGE_ADDRESS + NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3008 + EOF + ``` + + - Create a deployment `l2alice-nitro-deployment` from the spec file: + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l2alice-nitro-spec.yml --deployment-dir l2alice-nitro-deployment + ``` + + - Set the env variables for L2 Alice's nitro-node: + + ```bash + cat < l2alice-nitro-deployment/config.env + NITRO_CHAIN_URL=ws://host.docker.internal:9546 + NITRO_SC_PK=$A_PRIVATE_KEY + NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597 + NA_ADDRESS=$NA_ADDRESS + VPA_ADDRESS=$VPA_ADDRESS + CA_ADDRESS=$CA_ADDRESS + BRIDGE_ADDRESS=$BRIDGE_ADDRESS + NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3009 + NITRO_L2=true + EOF + ``` + + - Create deployment `l2charlie-nitro-deployment` from the spec files: + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file l2charlie-nitro-spec.yml --deployment-dir l2charlie-nitro-deployment + ``` + + - Set the env variables for L2 Charlie's nitro-node: + + ```bash + cat < l2charlie-nitro-deployment/config.env + NITRO_CHAIN_URL=ws://host.docker.internal:9546 + NITRO_SC_PK=$C_PRIVATE_KEY + NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f + NA_ADDRESS=$NA_ADDRESS + VPA_ADDRESS=$VPA_ADDRESS + CA_ADDRESS=$CA_ADDRESS + BRIDGE_ADDRESS=$BRIDGE_ADDRESS + NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3010 + NITRO_L2=true + EOF + ``` - Start nitro nodes for Alice and Charlie on L1 and L2: - - Prepare config files in go-nitro repo `cmd/test-configs` - - **Note**: Enter PKs without the leading `0x` - - `cmd/test-configs/l1alice.toml` - ```bash - usedurablestore = true - msgport = 3007 - rpcport = 4007 - pk = "" - chainpk = "570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597" - chainurl = "ws://127.0.0.1:8546" - bootpeers = "/ip4/127.0.0.1/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes" - ``` - - - `cmd/test-configs/l2alice.toml` - - ```bash - usedurablestore = true - msgport = 3008 - rpcport = 4008 - pk = "" - chainpk = "570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597" - chainurl = "ws://127.0.0.1:9546" - bootpeers = "/ip4/127.0.0.1/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes" - durablestorefolder = "./data/l2-nitro-store" - l2 = true - ``` - - - `cmd/test-configs/l1charlie.toml` - - ```bash - usedurablestore = true - msgport = 3009 - rpcport = 4009 - pk = "" - chainpk = "111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f" - chainurl = "ws://127.0.0.1:8546" - bootpeers = "/ip4/127.0.0.1/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes" - ``` - - - `cmd/test-configs/l2charlie.toml` - - ```bash - usedurablestore = true - msgport = 3010 - rpcport = 4010 - pk = "" - chainpk = "111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f" - chainurl = "ws://127.0.0.1:9546" - bootpeers = "/ip4/127.0.0.1/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes" - durablestorefolder = "./data/l2-nitro-store" - l2 = true - ``` - - - In a new terminal, go to go-nitro repo root and initialize node A on L1 + - Start the deployment for Alice's L1 node ```bash - # Export L1 contract addresses - source ./packages/nitro-protocol/hardhat-deployments/geth/.contracts.env + laconic-so deployment --dir l1alice-nitro-deployment start - ./go-nitro -config cmd/test-configs/l1alice.toml -naaddress $NA_ADDRESS -vpaaddress $VPA_ADDRESS -caaddress $CA_ADDRESS + # Check the logs, ensure that the node is running + laconic-so deployment --dir l1alice-nitro-deployment logs nitro-node -f ``` - - In another terminal, initialize node A' on L2 + - Start the deployment for Charlie's L1 node ```bash - # Export contract addresses stored in output files - source ./packages/nitro-protocol/hardhat-deployments/geth/.contracts.env - source ./packages/nitro-protocol/hardhat-deployments/optimism/.contracts.env + laconic-so deployment --dir l1charlie-nitro-deployment start - ./go-nitro -config cmd/test-configs/l2alice.toml -bridgeaddress $BRIDGE_ADDRESS -vpaaddress $VPA_ADDRESS -caaddress $CA_ADDRESS + # Check the logs, ensure that the node is running + laconic-so deployment --dir l1charlie-nitro-deployment logs nitro-node -f ``` - - In another terminal, initialize node C on L1: + - Start the deployment for Alice's L2 node ```bash - # Export L1 contract addresses - source ./packages/nitro-protocol/hardhat-deployments/geth/.contracts.env + laconic-so deployment --dir l2alice-nitro-deployment start - ./go-nitro -config cmd/test-configs/l1charlie.toml -naaddress $NA_ADDRESS -vpaaddress $VPA_ADDRESS -caaddress $CA_ADDRESS + # Check the logs, ensure that the node is running + laconic-so deployment --dir l2alice-nitro-deployment logs nitro-node -f ``` - - In another terminal, initialize node C' on L2 + - Start the deployment for Charlie's L2 node ```bash - # Export contract addresses stored in output files - source ./packages/nitro-protocol/hardhat-deployments/geth/.contracts.env - source ./packages/nitro-protocol/hardhat-deployments/optimism/.contracts.env + laconic-so deployment --dir l2charlie-nitro-deployment start - ./go-nitro -config cmd/test-configs/l2charlie.toml -bridgeaddress $BRIDGE_ADDRESS -vpaaddress $VPA_ADDRESS -caaddress $CA_ADDRESS + # Check the logs, ensure that the node is running + laconic-so deployment --dir l2charlie-nitro-deployment logs nitro-node -f ``` -- Create ledger channels on L1 and mirrored channel on L2s - - Open new terminal - - - Set the `NODE_EXTRA_CA_CERTS` environment variable to the path of mkcert's root CA certificate. This allows Node.js to trust locally-trusted development certificates created by mkcert +- Create ledger channels on L1 and mirrored channels on L2 + - Open new terminal, check that no channels exist on L2 ```bash - export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" - ``` - - - Check that no channels exist on L2 - - ```bash - nitro-rpc-client get-all-l2-channels -p 4006 + laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge" ``` - Set address of bridge and address of custom token on L1 in the current terminal - ```bash - export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 - export L1_ASSET_ADDRESS="" + export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 + export L1_ASSET_ADDRESS="$(laconic-so deployment --dir bridge-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")" ``` - NOTE: Replace `` with LNT token address deployed previously on L1 in [Run](#run) section - - Create ledger channel between A and Bridge with custom token ```bash - nitro-rpc-client direct-fund $BRIDGE_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4007 + laconic-so deployment --dir l1alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4005 -h nitro-node" ``` - Once direct-fund objective is complete, bridge will create mirrored channel on L2 - Check node A' logs to see bridged-fund objective completed + - Check the [Troubleshooting](#troubleshooting) section if command to create a ledger channel fails or gets stuck + - Check status of L1 ledger channel between A and Bridge ```bash - nitro-rpc-client get-ledger-channel -p 4007 + laconic-so deployment --dir l1alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel -p 4005 -h nitro-node" # Expected output: # { @@ -795,15 +818,17 @@ - Create ledger channel between C and Bridge with custom token ```bash - nitro-rpc-client direct-fund $BRIDGE_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4009 + laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund $BRIDGE_NITRO_ADDRESS --assetAddress $L1_ASSET_ADDRESS -p 4005 -h nitro-node" ``` - Once direct fund objective is complete, bridge will create mirrored channel on L2 - Check node C' logs to see bridged-fund objective completed + - Check the [Troubleshooting](#troubleshooting) section if command to create a ledger channel fails or gets stuck + - Check status of L1 ledger channel between C and Bridge ```bash - nitro-rpc-client get-ledger-channel -p 4009 + laconic-so deployment --dir l1charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel -p 4005 -h nitro-node" # Expected output: # { @@ -823,7 +848,7 @@ - Check status of all L2 mirrored ledger channels ```bash - nitro-rpc-client get-all-l2-channels -p 4006 + laconic-so deployment --dir bridge-deployment exec nitro-rpc-client "nitro-rpc-client get-all-l2-channels -p 4006 -h nitro-bridge" # Expected output: # {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"","Me":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","Them":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","MyBalance":1000000,"TheirBalance":1000000},"ChannelMode":"Open"} @@ -838,7 +863,6 @@ - Charlie is participant since `Them` address is `0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce` - Charlie amount is `1000000` since `TheirBalance` corresponds to his amount - - Onboard participants - Open the `testnet-onboarding-app` at - Connect to the testnet-onboarding app by clicking on the WalletConnect icon on the top right corner in the wallet and scanning QR code of the app @@ -871,20 +895,20 @@ - Use the scripts in fixturenet-laconicd stack to generate genesis file for stage 1 with token allocations: - ```bash - cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd + ```bash + cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd - ./scripts/generate-stage1-genesis.sh + ./scripts/generate-stage1-genesis.sh - # Expected output: - # Genesis file for stage1 written to output/genesis.json + # Expected output: + # Genesis file for stage1 written to output/genesis.json - # Remove the temporary data directory - sudo rm -rf stage1-genesis + # Remove the temporary data directory + sudo rm -rf stage1-genesis - # Go back to the directory where deployments are created - cd - - ``` + # Go back to the directory where deployments are created + cd - + ``` - Copy over the generated genesis file (`.json`) containing the onboarding module state with funded participants to data directory in stage1 deployment (`stage1-deployment/data/genesis-config`): @@ -930,56 +954,57 @@ ### Payments Demo in L2 -- Ensure the NODE_EXTRA_CA_CERTS environment variable in the current terminal is set to the path of mkcert's root CA certificate. - - ```bash - echo $NODE_EXTRA_CA_CERTS - # ~/.local/share/mkcert/rootCA.pem - - # If not present, set the environment variable - export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem" - ``` - - Create virtual channel on L2 from A' to C' via Bridge' as intermediary - ```bash - export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 - export A_ADDRESS= - export C_ADDRESS= + - Get Nitro (Ethereum) addresses for Alice and Charlie from the wallet: - # Starts virtual fund objective on L2 to create virtual channel from A' to C' - nitro-rpc-client virtual-fund $C_ADDRESS $BRIDGE_ADDRESS -p 4008 - ``` + ```bash + export A_ADDRESS= + export C_ADDRESS= + + # Bridge's Nitro address + export BRIDGE_NITRO_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 + ``` + + - Create a virtual channel: + + ```bash + # Starts virtual fund objective on L2 to create virtual channel from A' to C' + laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-fund $C_ADDRESS $BRIDGE_NITRO_ADDRESS --amount 1000 -p 4005 -h nitro-node" + + # Set the payment channel id in a variable + PAYMENT_CHANNEL_ID= + ``` - Check payment channel between A' and C' ```bash - nitro-rpc-client get-payment-channel -p 4008 + laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-payment-channel $PAYMENT_CHANNEL_ID -p 4005 -h nitro-node" - # Expected output: - # { - # ID: '0xb29aeb32c9495a793ebf7bd116232075d1e7bfe89fc82281c7d498e3ffd3e3bf', - # Status: 'Open', - # Balance: { - # AssetAddress: '', - # Payee: '0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0', - # Payer: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce', - # PaidSoFar: 0n, - # RemainingFunds: 1000n - # } - # } + # Expected output: + # { + # ID: '0xb29aeb32c9495a793ebf7bd116232075d1e7bfe89fc82281c7d498e3ffd3e3bf', + # Status: 'Open', + # Balance: { + # AssetAddress: '', + # Payee: '0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0', + # Payer: '0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce', + # PaidSoFar: 0n, + # RemainingFunds: 1000n + # } + # } ``` - After virtual fund objective is complete, make payments ```bash - nitro-rpc-client pay -p 4008 + laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client pay $PAYMENT_CHANNEL_ID 200 -p 4005 -h nitro-node" - # Expected output: - # { - # Amount: 200, - # Channel: '0xb29aeb32c9495a793ebf7bd116232075d1e7bfe89fc82281c7d498e3ffd3e3bf' - # } + # Expected output: + # { + # Amount: 200, + # Channel: '0xb29aeb32c9495a793ebf7bd116232075d1e7bfe89fc82281c7d498e3ffd3e3bf' + # } ``` - Check payment channel status again to view updated channel state @@ -987,39 +1012,56 @@ - Close payment channel after payments ```bash - nitro-rpc-client virtual-defund -p 4008 + laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-defund $PAYMENT_CHANNEL_ID -p 4005 -h nitro-node" ``` - Check L2 mirrored channels status after virtual-defund is complete: - - Note balance change in A' node: + - Note balance change in A' node: - ```bash - nitro-rpc-client get-all-ledger-channels -p 4008 + ```bash + laconic-so deployment --dir l2alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4005 -h nitro-node" - # Expected output: - # {"ID":"0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179","Status":"Open","Balance":{"AssetAddress":"","Me":"0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":999800,"TheirBalance":1000200},"ChannelMode":"Open"} - ``` + # Expected output: + # {"ID":"0x6a9f5ccf1fa802525d794f4a899897f947615f6acc7141e61e056a8bfca29179","Status":"Open","Balance":{"AssetAddress":"","Me":"0xaaa6628ec44a8a742987ef3a114ddfe2d4f7adce","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":999800,"TheirBalance":1000200},"ChannelMode":"Open"} + ``` - - Note balance change in C' node: + - Note balance change in C' node: - ```bash - nitro-rpc-client get-all-ledger-channels -p 4010 + ```bash + laconic-so deployment --dir l2charlie-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-all-ledger-channels -p 4005 -h nitro-node" - # Expected output: - # {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"","Me":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":1000200,"TheirBalance":999800},"ChannelMode":"Open"} - ``` + # Expected output: + # {"ID":"0x15dbe6b996e4e46fdd6ea3e2074cbca58014dbb07368e3e7ba286df5c7b9da0d","Status":"Open","Balance":{"AssetAddress":"","Me":"0xa8d2d06ace9c7ffc24ee785c2695678aecdfd7a0","Them":"0xbbb676f9cff8d242e9eac39d063848807d3d1d94","MyBalance":1000200,"TheirBalance":999800},"ChannelMode":"Open"} + ``` ## Demo cleanup -- Stop the bridge, A, A', C and C' terminals - - Change directory to go-nitro repo root - - Clear the durable store +- Reset nitro-node deployments: + + - Stop nitro-node deployments and remove volumes: ```bash - rm -rf ./data/ + # Run where deployments are created + laconic-so deployment --dir l1alice-nitro-deployment stop --delete-volumes + laconic-so deployment --dir l1charlie-nitro-deployment stop --delete-volumes + laconic-so deployment --dir l2alice-nitro-deployment stop --delete-volumes + laconic-so deployment --dir l2charlie-nitro-deployment stop --delete-volumes ``` + - Clear nitro-node deployments: + + ```bash + # Run where deployments are created + sudo rm -rf l1alice-nitro-deployment + sudo rm -rf l1charlie-nitro-deployment + sudo rm -rf l2alice-nitro-deployment + sudo rm -rf l2charlie-nitro-deployment + ``` + +- Reset wallet: + - In laconic-wallet, click on the `Reset Wallet` button to disconnect all apps and clear the accounts + - Reset stage 0 and stage 1 laconicd deployments: - Stop deployment and remove volumes: @@ -1060,18 +1102,29 @@ ## Cleanup -- Stop Nitro nodes: - - Stop (`Ctrl+C`) the bridge, A, A', C and C' nitro nodes +- Reset nitro-node deployments: - - Clear out nitro nodes data and configurations: - - Change directory to go-nitro repo root + - Stop nitro-node deployments and remove volumes: - - Cleanup: + ```bash + # Run where deployments are created + laconic-so deployment --dir l1alice-nitro-deployment stop --delete-volumes + laconic-so deployment --dir l1charlie-nitro-deployment stop --delete-volumes + laconic-so deployment --dir l2alice-nitro-deployment stop --delete-volumes + laconic-so deployment --dir l2charlie-nitro-deployment stop --delete-volumes + laconic-so deployment --dir bridge-deployment stop --delete-volumes + ``` - ```bash - # In go-nitro - git clean -xdf - ``` + - Clear nitro-node and bridge deployments: + + ```bash + # Run where deployments are created + sudo rm -rf l1alice-nitro-deployment + sudo rm -rf l1charlie-nitro-deployment + sudo rm -rf l2alice-nitro-deployment + sudo rm -rf l2charlie-nitro-deployment + sudo rm -rf bridge-deployment + ``` - Reset wallet and stop the app: - In laconic-wallet, click on the `Reset Wallet` button to disconnect all apps and clear the accounts @@ -1095,6 +1148,20 @@ sudo rm -rf stage1-deployment ``` +- Clean up faucet deployment: + - Stop deployment and remove volumes: + + ```bash + laconic-so deployment --dir laconic-faucet-deployment stop --delete-volumes + ``` + + - Clear deployment + + ```bash + # Run where deployment is created + sudo rm -rf laconic-faucet-deployment + ``` + - Clean up L1 and L2 deployments: - Stop deployment and remove volumes: @@ -1112,24 +1179,46 @@ sudo rm -rf fixturenet-eth-deployment ``` -- Clean up faucet deployment: - - Stop deployment and remove volumes: +## Troubleshooting + +- If the ledger channel creation fails, follow these steps: + + - Check whether the status of `cerc/fixturenet-eth-geth` is `unhealthy`. ```bash - laconic-so deployment --dir laconic-faucet-deployment stop --delete-volumes + docker ps ``` - - Clear deployment + - If the chain is not producing new blocks, restart the chain. - ```bash - # Run where deployments are created - sudo rm -rf laconic-faucet-deployment - ``` + ```bash + laconic-so deployment --dir fixturenet-eth-deployment stop -## Future enhancements + laconic-so deployment --dir fixturenet-eth-deployment start + ``` -- Use latest optimism releases (e.g. v1.7.7) in fixturenet-optimism -- Implement external stack for go-nitro - - Add stack for bridge - - Add stack for nitro node -- LATER: Implement flow for registered participants with balance to join as validators in stage 1 laconicd chain + - Stop the nitro-rpc-client direct-fund command if it is stuck + + - Restart the failed node (for example: to restart Charlie's node) + + - Stop the failed nitro node + + ```bash + laconic-so deployment --dir l1charlie-nitro-deployment stop + ``` + + - Remove the node's durable store and create it again + + ```bash + sudo rm -rf l1charlie-nitro-deployment/data/nitro_node_data + + mkdir l1charlie-nitro-deployment/data/nitro_node_data + ``` + + - Restart the node and create ledger channel again + + ```bash + laconic-so deployment --dir l1charlie-nitro-deployment start + ``` + + - Retry the ledger channel creation command