Update testnet onboarding demo to run faucet

This commit is contained in:
Adw8 2024-07-17 18:30:16 +05:30
parent fa9458f510
commit 2d9dad96d8

View File

@ -38,7 +38,7 @@
``` ```
6. Exit project repo 6. Exit project repo
``` ```
cd ../ cd ../
``` ```
@ -77,7 +77,7 @@
``` ```
5. Exit project repo 5. Exit project repo
``` ```
cd ../ cd ../
``` ```
@ -86,12 +86,13 @@
- Follow these steps to install laconic-so: <https://git.vdb.to/cerc-io/stack-orchestrator#install> - Follow these steps to install laconic-so: <https://git.vdb.to/cerc-io/stack-orchestrator#install>
### Fixturenet laconicd Stack ### Fixturenet laconicd Stack and laconic-faucet
1. Clone the stack repos: 1. Clone the stack repos:
```bash ```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/fixturenet-laconicd-stack --git-ssh --pull
laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --git-ssh --pull
``` ```
2. Clone required repositories: 2. Clone required repositories:
@ -99,6 +100,7 @@
```bash ```bash
# laconicd # laconicd
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd setup-repositories --git-ssh --pull 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
``` ```
3. Build the container images: 3. Build the container images:
@ -106,6 +108,7 @@
```bash ```bash
# laconicd # laconicd
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild 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
``` ```
4. Create a deployment for stage 0: 4. Create a deployment for stage 0:
@ -167,12 +170,36 @@
- '1317:1317' - '1317:1317'
``` ```
- Create deployment from the spec files: - Create a deployment from the spec files:
```bash ```bash
laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd deploy create --spec-file stage1-spec.yml --deployment-dir stage1-deployment 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
```
### L1 eth and L2 optimism stacks ### L1 eth and L2 optimism stacks
1. Clone the stack repo: 1. Clone the stack repo:
@ -331,13 +358,13 @@
- Check status of L1 - 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 new blocks are created
```bash ```bash
laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast block-number" laconic-so deployment --dir fixturenet-eth-deployment exec foundry "cast block-number"
``` ```
- Check geth logs to ensure that new blocks are getting created - Check geth logs to ensure that new blocks are getting created
```bash ```bash
laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1 laconic-so deployment --dir fixturenet-eth-deployment logs -f fixturenet-eth-geth-1
``` ```
@ -424,7 +451,7 @@
# Use same account on both Geth and Optimism # Use same account on both Geth and Optimism
export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK
``` ```
- Export variables for token name, token symbol and initial supply - Export variables for token name, token symbol and initial supply
```bash ```bash
export TOKEN_NAME="LaconicNetworkToken" export TOKEN_NAME="LaconicNetworkToken"
@ -530,11 +557,11 @@
NOTE: Ignore source map warnings in the terminal NOTE: Ignore source map warnings in the terminal
- Start `laconic-wallet` android app (run steps in laconic-wallet repo) - Start `laconic-wallet` android app (run steps in laconic-wallet repo)
- Set up the Android device - 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 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 - For a virtual device, continue with the steps
- Setup port forwarding for your device using the following command: - Setup port forwarding for your device using the following command:
``` ```
@ -579,28 +606,29 @@
laconic-so deployment --dir stage0-deployment logs laconicd -f laconic-so deployment --dir stage0-deployment logs laconicd -f
``` ```
- Run laconic-faucet:
- Get private key of funded faucet account from laconicd
```bash
laconic-so deployment --dir stage0-deployment exec laconicd "laconicd keys export alice --keyring-backend test --unarmored-hex --unsafe"
```
- In `laconic-faucet-deployment/config.env` file, set the following env variables:
```bash
# Private key of a funded faucet account
CERC_FAUCET_KEY=<faucet-account-pk>
```
- Start the stack for laconic-faucet
```bash
laconic-so deployment --dir laconic-faucet-deployment start
```
- 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` - 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`
- Fund accounts on laconicd:
- Export laconic addresses of Alice and Charlie (take the addresses from laconic wallet):
```bash
export A_LACONIC_ADDRESS=<Alice Laconic address>
export C_LACONIC_ADDRESS=<Charlie Laconic address>
```
- Send photons from funded account to Alice and Charlie:
```bash
# Send funds from funded account to Alice
laconic-so deployment --dir stage0-deployment exec laconicd "laconicd tx bank send alice $A_LACONIC_ADDRESS 100000000000photon --fees 100photon --keyring-backend test"
# Send funds from funded account to Charlie
laconic-so deployment --dir stage0-deployment exec laconicd "laconicd tx bank send alice $C_LACONIC_ADDRESS 100000000000photon --fees 100photon --keyring-backend test"
```
TODO: Use a faucet for funding accounts
- Go to go-nitro repo root and start the nitro bridge using CLI: - Go to go-nitro repo root and start the nitro bridge using CLI:
```bash ```bash
@ -723,14 +751,14 @@
``` ```
- Set address of bridge and address of custom token on L1 in the current terminal - Set address of bridge and address of custom token on L1 in the current terminal
<!-- TODO: Get token address from go-nitro deployments env --> <!-- TODO: Get token address from go-nitro deployments env -->
```bash ```bash
export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94 export BRIDGE_ADDRESS=0xBBB676f9cFF8D242e9eaC39D063848807d3D1D94
export L1_ASSET_ADDRESS="<Token Address on L1>" export L1_ASSET_ADDRESS="<Token Address on L1>"
``` ```
NOTE: Replace `<Token Address on L1>` with LNT token address deployed previously on L1 in [Run](#run) section NOTE: Replace `<Token Address on L1>` with LNT token address deployed previously on L1 in [Run](#run) section
- Create ledger channel between A and Bridge with custom token - Create ledger channel between A and Bridge with custom token
@ -810,10 +838,11 @@
- Onboard participants - Onboard participants
- Open the `testnet-onboarding-app` at <http://localhost:3000> - Open the `testnet-onboarding-app` at <http://localhost:3000>
- 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 - 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
- Choose Alice's ethereum and laconicd account to onboard - Choose Alice's nitro and laconicd account to onboard
- Use ethereum accounts for which ledger channels have been created on L2 - Use nitro accounts for which ledger channels have been created on L2
- Sign using the ethereum key - Sign using the nitro key
- Approve sign request on Wallet - Approve sign request on Wallet
- Fund the laconic account by clicking on the `REQUEST TOKENS FROM FAUCET` button
- Send transaction request to the Wallet - Send transaction request to the Wallet
- Approve and send transaction to laconicd chain - Approve and send transaction to laconicd chain
- Repeat onboarding for other (Charlies's) account - Repeat onboarding for other (Charlies's) account
@ -1010,6 +1039,20 @@
sudo rm -rf stage1-deployment/data/genesis-config/* sudo rm -rf stage1-deployment/data/genesis-config/*
``` ```
- Reset faucet deployment:
- Stop deployment and remove volumes:
```bash
laconic-so deployment --dir laconic-faucet-deployment stop --delete-volumes
```
- Remove data from the deployment
```bash
# Run where deployments are created
sudo rm -rf laconic-faucet-deployment/data/faucet-data/*
```
## Re-run ## Re-run
- After running demo cleanup, follow the steps from [Demo](#demo) to re-run the demo - After running demo cleanup, follow the steps from [Demo](#demo) to re-run the demo
@ -1068,9 +1111,22 @@
sudo rm -rf fixturenet-eth-deployment sudo rm -rf fixturenet-eth-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 deployments are created
sudo rm -rf laconic-faucet-deployment
```
## Future enhancements ## Future enhancements
- Implement faucet in stage 0 laconicd chain for participants to send onboarding tx
- Use latest optimism releases (e.g. v1.7.7) in fixturenet-optimism - Use latest optimism releases (e.g. v1.7.7) in fixturenet-optimism
- Implement external stack for go-nitro - Implement external stack for go-nitro
- Add stack for bridge - Add stack for bridge