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

@ -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:
@ -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
@ -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