Add expected output for commands in nitro-node readme
This commit is contained in:
parent
428e40a39c
commit
5610385b14
@ -132,7 +132,7 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Create a deployment `nitro-contracts` from the spec file
|
- Create a deployment `nitro-contracts` from the spec file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-contracts deploy create --spec-file nitro-contracts-spec.yml --deployment-dir nitro-contracts-deployment
|
||||||
```
|
```
|
||||||
@ -141,11 +141,11 @@
|
|||||||
|
|
||||||
```
|
```
|
||||||
laconic-so deployment --dir nitro-contracts-deployment start
|
laconic-so deployment --dir nitro-contracts-deployment start
|
||||||
|
|
||||||
# Check the logs
|
# Check the logs
|
||||||
laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f
|
laconic-so deployment --dir nitro-contracts-deployment logs nitro-contracts -f
|
||||||
```
|
```
|
||||||
|
|
||||||
- Get the deployed nitro contract addresses
|
- Get the deployed nitro contract addresses
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -153,28 +153,28 @@
|
|||||||
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 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 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 VPA_ADDRESS=$(laconic-so deployment --dir nitro-contracts-deployment exec nitro-contracts "jq -r '.\"1212\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json")
|
||||||
```
|
```
|
||||||
|
|
||||||
- Send custom tokens to Alice and Charlie
|
- Send custom tokens to Alice and Charlie
|
||||||
|
|
||||||
- Export variables for token address
|
- Export variables for token address
|
||||||
|
|
||||||
```bash
|
```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 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 A_CHAIN_ADDRESS="0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a"
|
||||||
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
|
export C_CHAIN_ADDRESS="0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Send tokens to Alice and Charlie
|
- Send tokens to Alice and Charlie
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Send tokens to Alice
|
# 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"
|
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
|
#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"
|
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:
|
- Create deployment for Alice:
|
||||||
- Create a deployment spec-file for Alice node:
|
- Create a deployment spec-file for Alice node:
|
||||||
@ -196,11 +196,11 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Create a deployment `alice-nitro-deployment` from the spec file
|
- Create a deployment `alice-nitro-deployment` from the spec file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file alice-nitro-spec.yml --deployment-dir alice-nitro-deployment
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file alice-nitro-spec.yml --deployment-dir alice-nitro-deployment
|
||||||
```
|
```
|
||||||
|
|
||||||
- Set the env variables for Alice's nitro-node:
|
- Set the env variables for Alice's nitro-node:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -213,7 +213,7 @@
|
|||||||
CA_ADDRESS=$CA_ADDRESS
|
CA_ADDRESS=$CA_ADDRESS
|
||||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3007
|
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3007
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create deployment for Charlie:
|
- Create deployment for Charlie:
|
||||||
|
|
||||||
@ -222,7 +222,7 @@
|
|||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output charlie-nitro-spec.yml
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy init --output charlie-nitro-spec.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
- Edit `network` in the spec file to map container ports to host ports as required:
|
- Edit `network` in the spec file to map container ports to host ports as required:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -236,11 +236,11 @@
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Create a deployment `charlie-nitro-deployment` from the spec file
|
- Create a deployment `charlie-nitro-deployment` from the spec file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file charlie-nitro-spec.yml --deployment-dir charlie-nitro-deployment
|
laconic-so --stack ~/cerc/nitro-stack/stack-orchestrator/stacks/nitro-node deploy create --spec-file charlie-nitro-spec.yml --deployment-dir charlie-nitro-deployment
|
||||||
```
|
```
|
||||||
|
|
||||||
- Set the env variables for Charlie's nitro-node:
|
- Set the env variables for Charlie's nitro-node:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -254,7 +254,7 @@
|
|||||||
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3007/p2p/16Uiu2HAmVbAtvDW1xrq4gDwRtdTjT1bqVdFJX6eWZbfn174wEENL
|
NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3007/p2p/16Uiu2HAmVbAtvDW1xrq4gDwRtdTjT1bqVdFJX6eWZbfn174wEENL
|
||||||
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3008
|
NITRO_EXT_MULTIADDR=/dns4/host.docker.internal/tcp/3008
|
||||||
EOF
|
EOF
|
||||||
```
|
```
|
||||||
|
|
||||||
## Demo
|
## Demo
|
||||||
|
|
||||||
@ -267,36 +267,50 @@
|
|||||||
# Check the logs
|
# Check the logs
|
||||||
laconic-so deployment --dir alice-nitro-deployment logs nitro-node -f
|
laconic-so deployment --dir alice-nitro-deployment logs nitro-node -f
|
||||||
```
|
```
|
||||||
|
|
||||||
- Start `charlie-nitro-deployment` deployment:
|
- Start `charlie-nitro-deployment` deployment:
|
||||||
|
|
||||||
```
|
```
|
||||||
laconic-so deployment --dir charlie-nitro-deployment start
|
laconic-so deployment --dir charlie-nitro-deployment start
|
||||||
|
|
||||||
# Check the logs
|
# Check the logs
|
||||||
laconic-so deployment --dir charlie-nitro-deployment logs nitro-node -f
|
laconic-so deployment --dir charlie-nitro-deployment logs nitro-node -f
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create ledger channels
|
- Create ledger channels
|
||||||
|
|
||||||
- Set address of custom token in the current terminal
|
- Set address of custom token in the current terminal
|
||||||
|
|
||||||
```bash
|
```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 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
|
- Create ledger channel between Alice and Charlie with custom token
|
||||||
|
|
||||||
```bash
|
```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"
|
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>
|
LEDGER_CHANNEL_ID=<ledger channel id>
|
||||||
```
|
```
|
||||||
|
|
||||||
- Check status of ledger channel between Alice and Charlie
|
- Check status of ledger channel between Alice and Charlie
|
||||||
|
|
||||||
```bash
|
```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"
|
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"
|
||||||
|
|
||||||
|
# Expected output:
|
||||||
|
# {
|
||||||
|
# ID: '0x72e631943d8b89d9c70af7d3daa75a169fc84c84034ab77c850ceaf4a530a650',
|
||||||
|
# Status: 'Open',
|
||||||
|
# Balance: {
|
||||||
|
# AssetAddress: '0x2b79f4a92c177b4e61f5c4ac37b1b8a623c665a4',
|
||||||
|
# Me: '0x4b64e26da8279ab12bcd4ca9974ec2b4741e175e',
|
||||||
|
# Them: '0x03eb7a84e286c671836b9897aae24b31d36f9ca8',
|
||||||
|
# MyBalance: 1000000n,
|
||||||
|
# TheirBalance: 1000000n
|
||||||
|
# },
|
||||||
|
# ChannelMode: 'Open'
|
||||||
|
# }
|
||||||
```
|
```
|
||||||
|
|
||||||
- Create virtual channel from Alice to Charlie
|
- Create virtual channel from Alice to Charlie
|
||||||
@ -304,7 +318,23 @@
|
|||||||
```bash
|
```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"
|
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
|
# Expected output:
|
||||||
|
# {
|
||||||
|
# ID: '0xf982de03e17fd8ff30b138f142bc17c3deb24a48ec38b41c13e621fa65172f3c',
|
||||||
|
# Status: 'Open',
|
||||||
|
# Balance: {
|
||||||
|
# AssetAddress: '0x0000000000000000000000000000000000000000',
|
||||||
|
# Payee: '0x03eb7a84e286c671836b9897aae24b31d36f9ca8',
|
||||||
|
# Payer: '0x4b64e26da8279ab12bcd4ca9974ec2b4741e175e',
|
||||||
|
# PaidSoFar: 0n,
|
||||||
|
# RemainingFunds: 1000n
|
||||||
|
# }
|
||||||
|
# }
|
||||||
|
```
|
||||||
|
|
||||||
|
- Set the payment channel id in a variable
|
||||||
|
|
||||||
|
```bash
|
||||||
PAYMENT_CHANNEL_ID=<payment channel id>
|
PAYMENT_CHANNEL_ID=<payment channel id>
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -317,7 +347,13 @@
|
|||||||
- After virtual fund objective is complete, make payments
|
- After virtual fund objective is complete, make payments
|
||||||
|
|
||||||
```bash
|
```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"
|
laconic-so deployment --dir alice-nitro-deployment exec nitro-rpc-client "nitro-rpc-client pay $PAYMENT_CHANNEL_ID 200 -p 4005 -h nitro-node"
|
||||||
|
|
||||||
|
# Expected output:
|
||||||
|
# {
|
||||||
|
# Amount: 200,
|
||||||
|
# Channel: '0xf982de03e17fd8ff30b138f142bc17c3deb24a48ec38b41c13e621fa65172f3c'
|
||||||
|
# }
|
||||||
```
|
```
|
||||||
|
|
||||||
- Close payment channel after payments
|
- Close payment channel after payments
|
||||||
@ -336,6 +372,21 @@
|
|||||||
|
|
||||||
```bash
|
```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"
|
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"
|
||||||
|
|
||||||
|
# Expected output:
|
||||||
|
# {
|
||||||
|
# ID: '0x72e631943d8b89d9c70af7d3daa75a169fc84c84034ab77c850ceaf4a530a650',
|
||||||
|
# Status: 'Complete',
|
||||||
|
# Balance: {
|
||||||
|
# AssetAddress: '0x2b79f4a92c177b4e61f5c4ac37b1b8a623c665a4',
|
||||||
|
# Me: '0x4b64e26da8279ab12bcd4ca9974ec2b4741e175e',
|
||||||
|
# Them: '0x03eb7a84e286c671836b9897aae24b31d36f9ca8',
|
||||||
|
# MyBalance: 999800n,
|
||||||
|
# TheirBalance: 1000200n
|
||||||
|
# },
|
||||||
|
# ChannelMode: 'Open'
|
||||||
|
# }
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Cleanup
|
## Cleanup
|
||||||
|
Loading…
Reference in New Issue
Block a user