diff --git a/stack-orchestrator/stacks/testnet-laconicd/README.md b/stack-orchestrator/stacks/testnet-laconicd/README.md index f7a5fe5..7ab058f 100644 --- a/stack-orchestrator/stacks/testnet-laconicd/README.md +++ b/stack-orchestrator/stacks/testnet-laconicd/README.md @@ -26,10 +26,10 @@ 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 ``` * Build the container images: @@ -38,7 +38,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 ``` diff --git a/testnet-onboarding-demo.md b/testnet-onboarding-demo.md index f292f0b..01336e8 100644 --- a/testnet-onboarding-demo.md +++ b/testnet-onboarding-demo.md @@ -8,38 +8,38 @@ 2. Clone the repository - ``` + ```bash git clone git@git.vdb.to:cerc-io/laconic-wallet.git ``` 3. Enter the project directory - ``` + ```bash cd laconic-wallet ``` 4. 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... ``` 5. Install dependencies - ``` + ```bash yarn ``` 6. Exit project repo - ``` + ```bash cd ../ ``` @@ -47,38 +47,38 @@ 1. Clone the repository - ``` + ```bash git clone git@git.vdb.to:cerc-io/testnet-onboarding-app.git ``` 2. Enter the project directory - ``` + ```bash cd testnet-onboarding-app ``` 3. Setup .env - Copy and update `.env` - ``` + ```bash 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. - ``` + ```bash WALLET_CONNECT_PROJECT_ID=39bc93c... ``` 4. Install dependencies - ``` + ```bash yarn ``` 5. Exit project repo - ``` + ```bash cd ../ ``` @@ -243,6 +243,7 @@ - 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 ``` @@ -349,6 +350,266 @@ nitro-rpc-client --version ``` + - Replace `` with absolute path to the cloned go-nitro repo + +### Nitro-node Stack + +1. Clone the stack repos: + + ```bash + laconic-so fetch-stack git.vdb.to/cerc-io/nitro-stack --git-ssh --pull + ``` + +2. Clone required repositories: + + ```bash + # laconicd + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node setup-repositories --git-ssh --pull + ``` + +3. Build the container images: + + ```bash + # laconicd + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node build-containers --force-rebuild + ``` + +4. Create a deployment for Alice's L1 nitro-node: + - Create spec files for the deployment: + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output l1alice-nitro-spec.yml + ``` + + - Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + # l1alice-nitro-spec.yml + ... + network: + ports: + go-nitro: + - 3006:3006 + - 4006:4006 + - 5006:5006 + ``` + + - Create a 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 + ``` + + - In `l1alice-nitro-deployment/config.env` file, set the following env variable: + + ```bash + # URL endpoint of the chain + CERC_NITRO_CHAIN_URL=ws://host.docker.internal:8546 + + # Private key of account to be used by Nitro node (derived address is used as Nitro address) + # Note: Enter PKs without the leading `0x` + CERC_NITRO_PK="" + + # Private key of the account on chain that is used for funding channels in Nitro node + CERC_NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597 + + # Port to be used by P2P message service + CERC_NITRO_MSG_PORT=3007 + + # Port to be used by RPC server + CERC_NITRO_RPC_PORT=4007 + + # Optional + # Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp + # TODO: Contracts are deployed if addresses are not set + CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506 + CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7 + CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7 + + # Public IP of the nitro-node + CERC_PUBLIC_IP=/ip4/127.0.0.1/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + + USE_DURABLE_STORE=true + ``` + +5. Create a deployment for Charlie's L1 nitro-node: + - Create spec file for the deployment: + + ```bash + laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output l1charlie-nitro-spec.yml + ``` + + - Edit `network` in the spec file to map container ports to host ports as required: + + ```bash + # l1charlie-nitro-spec.yml + ... + network: + ports: + go-nitro: + - 3006:3006 + - 4006:4006 + - 5006:5006 + ``` + + - Create deployment from the spec files: + + ```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 + ``` + + - In `l1charlie-nitro-deployment/config.env` file, set the following env variable: + + ```bash + # URL endpoint of the chain + CERC_NITRO_CHAIN_URL=ws://host.docker.internal:8546 + + # Private key of account to be used by Nitro node (derived address is used as Nitro address) + # Note: Enter PKs without the leading `0x` + CERC_NITRO_PK="" + + # Private key of the account on chain that is used for funding channels in Nitro node + CERC_NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f + + # Port to be used by P2P message service + CERC_NITRO_MSG_PORT=3009 + # Port to be used by RPC server + CERC_NITRO_RPC_PORT=4009 + + # Optional + # Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp + # TODO: Contracts are deployed if addresses are not set + CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506 + CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7 + CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7 + + # Public IP of the nitro-node + CERC_PUBLIC_IP=/ip4/127.0.0.1/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + + USE_DURABLE_STORE=true + + DURABLE_STORE_FOLDER=./data/l2-nitro-store + ``` + +6. Create a deployment 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: + go-nitro: + - 3006:3006 + - 4006:4006 + - 5006:5006 + ``` + + - Create a 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 + ``` + + - In `l2alice-nitro-deployment/config.env` file, set the following env variable: + + ```bash + # URL endpoint of the chain + CERC_NITRO_CHAIN_URL=ws://host.docker.internal:9546 + + # Private key of account to be used by Nitro node (derived address is used as Nitro address) + # Note: Enter PKs without the leading `0x` + CERC_NITRO_PK="" + + # Private key of the account on chain that is used for funding channels in Nitro node + CERC_NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597 + + # Port to be used by P2P message service + CERC_NITRO_MSG_PORT=3008 + + # Port to be used by RPC server + CERC_NITRO_RPC_PORT=4008 + + # Optional + # Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp + # TODO: Contracts are deployed if addresses are not set + CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506 + CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7 + CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7 + + # Public IP of the nitro-node + CERC_PUBLIC_IP=/ip4/127.0.0.1/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + + USE_DURABLE_STORE=true + ``` + +7. Create a deployment 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: + go-nitro: + - 3006:3006 + - 4006:4006 + - 5006:5006 + ``` + + - Create 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 + ``` + + - In `l2charlie-nitro-deployment/config.env` file, set the following env variable: + + ```bash + # URL endpoint of the chain + CERC_NITRO_CHAIN_URL=ws://host.docker.internal:9546 + + # Private key of account to be used by Nitro node (derived address is used as Nitro address) + # Note: Enter PKs without the leading `0x` + CERC_NITRO_PK="" + + # Private key of the account on chain that is used for funding channels in Nitro node + CERC_NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f + + # Port to be used by P2P message service + CERC_NITRO_MSG_PORT=3010 + # Port to be used by RPC server + CERC_NITRO_RPC_PORT=4010 + + # Optional + # Contract addresses of NitroAdjudicator, VirtualPaymentApp and ConsensusApp + # TODO: Contracts are deployed if addresses are not set + CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506 + CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7 + CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7 + + # Public IP of the nitro-node + CERC_PUBLIC_IP=/ip4/127.0.0.1/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes + + USE_DURABLE_STORE=true + + L2=true + + DURABLE_STORE_FOLDER=./data/l2-nitro-store + ``` + ## Run - Start L1, L2 stacks: @@ -458,6 +719,7 @@ ``` - Export variables for token name, token symbol and initial supply + ```bash export TOKEN_NAME="LaconicNetworkToken" export TOKEN_SYMBOL="LNT" @@ -499,6 +761,7 @@ ``` - Deploy custom token on L2 + ```bash # Deploy token on Optimism yarn contracts:deploy-token-optimism @@ -569,7 +832,7 @@ - Setup port forwarding for your device using the following command: - ``` + ```bash # Get device id adb devices @@ -579,7 +842,7 @@ - Start the application: - ``` + ```bash # In laconic-wallet yarn start ``` @@ -838,7 +1101,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 @@ -992,7 +1254,7 @@ - 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 @@ -1001,7 +1263,7 @@ # {"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