Add instructions for running a testnet Nitro node

This commit is contained in:
Prathamesh Musale 2024-09-03 14:47:18 +05:30
parent aa656e828d
commit 21bafbfd4b
3 changed files with 106 additions and 88 deletions

View File

@ -37,7 +37,9 @@
### Prerequisites
* Ansible: see [installation](https://git.vdb.to/cerc-io/ops#installation)
* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install)
* Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation)
### Setup
@ -89,13 +91,13 @@
* Setup and run L2 by executing the `run-optimism.yml` Ansible playbook:
```bash
LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{ "target_host": "localhost"}' --user $USER
```
* For skipping container build, run with `"skip_container_build" : true`:
```bash
LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-optimism.yml --extra-vars='{"target_host" : "localhost", "skip_container_build": true}' -kK --user $USER
```
</details>

View File

@ -1,85 +0,0 @@
# Run nitro-nodes
## Setup
- Follow the [installation guide](https://github.com/deep-stack/ops/blob/ag-run-l2/README.md#installation) to setup ansible on your machine
- Ensure laconic-so is installed
```bash
laconic-so version
```
- Clone the ops repo
```bash
git clone git@github.com:deep-stack/ops.git
cd ops
git checkout ag-run-l2
```
## Run l1, l2 nitro nodes
- Navigate to the `vulcanize/nitro-node-setup` directory
```bash
cd vulcanize/nitro-node-setup
```
- Copy the `nitro-vars-example.yml` vars file
```bash
cp nitro-vars-example.yml nitro-vars.yml
```
<!-- TODO: Provide nitro environment variables to user -->
- Edit [`nitro-vars.yml`](./nitro-vars.yml) and fill in the following values
```bash
# URL endpoint of the L1 chain
l1_nitro_chain_url: ""
# URL endpoint of the L2 chain
l2_nitro_chain_url: ""
# Private key for your nitro address
nitro_sc_pk: ""
# Private key of the account on chain that is used for funding channels in Nitro node
nitro_chain_pk: ""
# Contract address of NitroAdjudicator
na_address: ""
# Contract address of VirtualPaymentApp
vpa_address: ""
# Contract address of ConsensusApp
ca_address: ""
# Contract address of bridge
bridge_address: ""
# IP address of the bridge node
nitro_bridge_ip: ""
# Publically accessible IP address of your nitro node
nitro_node_ip: ""
```
- To run nitro nodes, execute the `run-nitro-node.yml` Ansible playbook by running the following command.
NOTE: By default, deployments are created in the `nitro-node-setup/out` directory. If you need to change this location, you can update the `nitro_directory` variable in the [setup-vars.yml](./setup-vars.yml) file.
```bash
LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost"}' --user $USER
```
- If you want to skip building the containers, set `"skip_container_build" : true` in the `--extra-vars` parameter:
```bash
LANG=en_IN.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER
```
- Follow steps from [Demo](https://git.vdb.to/cerc-io/nitro-stack/src/branch/main/nitro-bridge-demo.md#demo) to create mirror channels on L2, create virtual channel and make payments

101
testnet-nitro-node.md Normal file
View File

@ -0,0 +1,101 @@
# testnet-nitro-node
## Prerequisites
* laconic-so: see [installation](https://git.vdb.to/cerc-io/stack-orchestrator#install)
* Ansible: see [installation](https://git.vdb.to/cerc-io/testnet-ops#installation)
* Check versions to verify installation:
```bash
laconic-so version
ansible --version
```
## Setup
* Clone the `cerc-io/testnet-ops` repository:
```bash
git clone git@git.vdb.to:cerc-io/testnet-ops.git
cd testnet-ops/nitro-node-setup
```
* Fetch the required Nitro node config:
```bash
wget -O nitro-vars.yml https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/stage2/nitro-node-config.yml
```
* TODO: Get Laconic tokens on your address
* Edit `nitro-vars.yml` and fill in the following values:
```bash
# L1 RPC endpoint
l1_nitro_chain_url: ""
# Private key for your Nitro address
nitro_sc_pk: ""
# Private key for a funded account on L1
# This account should have Laconic tokens for funding your Nitro channels
nitro_chain_pk: ""
# Multiaddr with publically accessible IP address / DNS for your nitro node
# Example: "/ip4/192.168.x.y/tcp/3009"
# Example: "/dns4/example.com/tcp/3009"
nitro_node_multiaddr: ""
```
* Update the target dir in `setup-vars.yml`:
```bash
DEPLOYMENTS_DIR=<path-to-deployments-dir>
sed -i "s|^nitro_directory:.*|nitro_directory: $DEPLOYMENTS_DIR/nitro-node|" setup-vars.yml
# Will create deployments at $DEPLOYMENTS_DIR/nitro-node/l1-nitro-deployment and $DEPLOYMENTS_DIR/nitro-node/l2-nitro-deployment
```
## Run
* Setup and run a Nitro node (L1+L2) by executing the `run-nitro-node.yml` Ansible playbook:
```bash
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost"}' --user $USER
```
* For skipping container build, run with `"skip_container_build" : true`:
```bash
LANG=en_US.utf8 ansible-playbook -i localhost, --connection=local run-nitro-node.yml --extra-vars='{ "target_host": "localhost", "skip_container_build": true }' --user $USER
```
### Clean up
* Switch to deployments dir:
```bash
cd $DEPLOYMENTS_DIR/nitro-node
```
* Stop all Nitro services running in the background:
```bash
laconic-so deployment --dir l1-nitro-deployment stop
laconic-so deployment --dir l2-nitro-deployment stop
```
* To stop all services and also delete data:
```bash
laconic-so deployment --dir l1-nitro-deployment stop --delete-volumes
laconic-so deployment --dir l2-nitro-deployment stop --delete-volumes
# Remove deployment directories (deployments will have to be recreated for a re-run)
sudo rm -r l1-nitro-deployment
sudo rm -r l2-nitro-deployment
```