Add demo steps for running nitro nodes with payment and defund #5
@ -153,7 +153,27 @@
|
||||
export NA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json")
|
||||
export CA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json")
|
||||
export VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json")
|
||||
export ASSET_ADDRESS="$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")"
|
||||
```
|
||||
|
||||
- Send custom tokens to Alice and Charlie
|
||||
|
||||
- Export variables for token address
|
||||
|
||||
```bash
|
||||
export ASSET_ADDRESS="$(laconic-so deployment --dir nitro-contracts-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"
|
||||
```
|
||||
|
||||
- Send tokens to Alice and Charlie
|
||||
|
||||
```bash
|
||||
# Send tokens to Alice
|
||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $A_CHAIN_ADDRESS --amount 1000 --network geth"
|
||||
|
||||
#Send tokens to Charlie
|
||||
laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "cd packages/nitro-protocol && yarn hardhat transfer --contract $ASSET_ADDRESS --to $C_CHAIN_ADDRESS --amount 1000 --network geth"
|
||||
```
|
||||
|
||||
- Create deployment for Alice:
|
||||
@ -257,6 +277,67 @@
|
||||
laconic-so deployment --dir charlie-nitro-deployment logs nitro-node -f
|
||||
```
|
||||
|
||||
- Create ledger channels
|
||||
|
||||
- Set address of custom token in the current terminal
|
||||
|
||||
```bash
|
||||
export ASSET_ADDRESS="$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.Token.address' /app/deployment/nitro-addresses.json")"
|
||||
```
|
||||
|
||||
- Create ledger channel between Alice and Charlie with custom token
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-fund 0x03Eb7a84E286c671836b9897AaE24b31D36f9cA8 --assetAddress $ASSET_ADDRESS --alphaAmount 1000000 --betaAmount 1000000 -p 4005 -h nitro-node"
|
||||
|
||||
LEDGER_CHANNEL_ID=<ledger channel id>
|
||||
```
|
||||
|
||||
- Check status of ledger channel between Alice and Charlie
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel $LEDGER_CHANNEL_ID -p 4005 -h nitro-node"
|
||||
```
|
||||
|
||||
- Create virtual channel from Alice to Charlie
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-fund 0x03Eb7a84E286c671836b9897AaE24b31D36f9cA8 --amount 1000 -p 4005 -h nitro-node"
|
||||
|
||||
# Set the payment channel id in a variable
|
||||
PAYMENT_CHANNEL_ID=<payment channel id>
|
||||
```
|
||||
|
||||
- Check payment channel between Alice and Charlie
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-payment-channel $PAYMENT_CHANNEL_ID -p 4005 -h nitro-node"
|
||||
```
|
||||
|
||||
- After virtual fund objective is complete, make payments
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client pay $PAYMENT_CHANNEL_ID 200 -p 4005 -h nitro-node"
|
||||
```
|
||||
|
||||
- Close payment channel after payments
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client virtual-defund $PAYMENT_CHANNEL_ID -p 4005 -h nitro-node"
|
||||
```
|
||||
|
||||
- Close ledger channel between Alice and Charlie
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client direct-defund $LEDGER_CHANNEL_ID -p 4005 -h nitro-node"
|
||||
```
|
||||
|
||||
- Check status of ledger channel between Alice and Charlie
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client get-ledger-channel $LEDGER_CHANNEL_ID -p 4005 -h nitro-node"
|
||||
```
|
||||
|
||||
## Cleanup
|
||||
|
||||
- Reset nitro-node deployments:
|
||||
|
Loading…
Reference in New Issue
Block a user