From debad68a883e72c65fbcf4e47b32de11f8e1ad22 Mon Sep 17 00:00:00 2001 From: LordGhostX Date: Thu, 15 Jun 2023 17:28:53 +0100 Subject: [PATCH] add guide on finding node addresses --- docs/guides/nwaku/build-source.md | 14 +++--- docs/guides/nwaku/configuration.md | 2 +- docs/guides/nwaku/run-docker-compose.md | 6 ++- docs/guides/nwaku/run-docker.md | 8 ++-- docs/guides/run-nwaku-node.md | 60 +++++++++++++++++++++++-- 5 files changed, 72 insertions(+), 18 deletions(-) diff --git a/docs/guides/nwaku/build-source.md b/docs/guides/nwaku/build-source.md index 6c52f65..0d8f9ef 100644 --- a/docs/guides/nwaku/build-source.md +++ b/docs/guides/nwaku/build-source.md @@ -2,13 +2,11 @@ title: Build Nwaku from Source --- -This guide provides detailed steps to build a `nwaku` node from the source to access the latest development version or a specific commit of nwaku. If you prefer a more stable version, [download a pre-compiled binary](https://github.com/waku-org/nwaku/tags) instead. +This guide provides detailed steps to build a `nwaku` node from the source to access the latest development version or a specific commit or tag of `nwaku`. If you prefer a more stable version, [download a pre-compiled binary](https://github.com/waku-org/nwaku/tags) instead. -## Prerequisites - -- 2GB of RAM -- [Git](https://git-scm.com/) or [GitHub Desktop](https://desktop.github.com/) -- [Nim](https://nim-lang.org/install.html) installed on your system +:::info +A minimum of 2GB of RAM is required to build `nwaku`. The build process will only succeed on systems that meet this requirement. +::: ## Install Dependencies @@ -71,7 +69,7 @@ You can use `git tag -l` to check specific version tags. ## Build the Binary -To build the `nwaku` binary, use: +Build the `nwaku` binary: ```bash make wakunode2 @@ -103,7 +101,7 @@ To learn more about running nwaku, please refer to: ## Run Test Suite -To run the tests for both `Waku v1` and `Waku v2`, use: +Run the tests for both `Waku v1` and `Waku v2`: ```bash make test diff --git a/docs/guides/nwaku/configuration.md b/docs/guides/nwaku/configuration.md index 711ae8e..740bca0 100644 --- a/docs/guides/nwaku/configuration.md +++ b/docs/guides/nwaku/configuration.md @@ -2,7 +2,7 @@ title: Node Configuration --- -Nwaku can be configured using a combination of the following methods: +Waku nodes can be configured using a combination of the following methods: 1. Command line options and flags 2. Environment variables (recommended) diff --git a/docs/guides/nwaku/run-docker-compose.md b/docs/guides/nwaku/run-docker-compose.md index 7ecf902..70f3d9d 100644 --- a/docs/guides/nwaku/run-docker-compose.md +++ b/docs/guides/nwaku/run-docker-compose.md @@ -2,7 +2,9 @@ title: Run Nwaku with Docker Compose --- -`nwaku-compose` is a ready-to-use `docker-compose` setup that runs a nwaku node and monitors it with already configured [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/) instances. This guide provides detailed steps to build, run, and monitor a `nwaku` node with [nwaku-compose](https://github.com/alrevuelta/nwaku-compose). +`nwaku-compose` is a ready-to-use `docker-compose` setup that runs a nwaku node and monitors it with already configured [Prometheus](https://prometheus.io/) and [Grafana](https://grafana.com/) instances. + +This guide provides detailed steps to build, configure, run, and monitor a `nwaku` node with [nwaku-compose](https://github.com/alrevuelta/nwaku-compose). ## Prerequisites @@ -23,7 +25,7 @@ Modify the `docker-compose.yml` file to customize your node's configuration, inc ## Run Docker Compose -To export your public IP (`MY_EXT_IP`) and run `nwaku-compose`, use: +Export your public IP (`MY_EXT_IP`) and run `nwaku-compose`: ```bash export MY_EXT_IP=$(dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{ print $2}') diff --git a/docs/guides/nwaku/run-docker.md b/docs/guides/nwaku/run-docker.md index 0c6fc06..452d82d 100644 --- a/docs/guides/nwaku/run-docker.md +++ b/docs/guides/nwaku/run-docker.md @@ -17,13 +17,13 @@ sudo sh get-docker.sh The Nwaku Docker images are available on the Docker Hub public registry under the [statusteam/nim-waku](https://hub.docker.com/r/statusteam/nim-waku) repository. Please visit [statusteam/nim-waku/tags](https://hub.docker.com/r/statusteam/nim-waku/tags) for images of specific releases. -To pull the latest image, use: +Pull the latest docker image: ```bash docker pull statusteam/nim-waku ``` -You can also build the Docker image locally using: +You can also build the Docker image locally: ```bash # Clone the repository @@ -39,7 +39,7 @@ make docker-image ## Run Docker Container -To run `nwaku` in a new Docker container, use: +Run `nwaku` in a new Docker container: ```bash docker run [OPTIONS] [IMAGE] [ARG...] @@ -49,7 +49,7 @@ docker run [OPTIONS] [IMAGE] [ARG...] - `IMAGE` is the image and tag you pulled from the registry or built locally - `ARG...` is the list of `nwaku` arguments for your [chosen node configuration](/guides/nwaku/configuration) -To run `nwaku` in a Docker container using the most typical configuration, use: +Run `nwaku` using the most typical configuration: ```bash docker run -i -t -p 60000:60000 -p 9000:9000/udp statusteam/nim-waku \ diff --git a/docs/guides/run-nwaku-node.md b/docs/guides/run-nwaku-node.md index 5a800ce..53eb8f1 100644 --- a/docs/guides/run-nwaku-node.md +++ b/docs/guides/run-nwaku-node.md @@ -4,7 +4,7 @@ title: Run a Nwaku Node Nwaku (formerly `nim-waku`) is a lightweight and robust Nim client for running a Waku node, equipped with tools to monitor and maintain a running node. Nwaku is highly configurable, enabling operators to select the [protocols](/overview/concepts/protocols) they want to support based on their needs, motivations, and available resources. -This guide provides detailed steps to build, configure, and connect a `nwaku` node to the Waku Network. It also covers using existing tools to monitor and maintain the node. +This guide provides detailed steps to build, configure, and connect a `nwaku` node to the Waku Network. It also includes interacting with the node and finding its addresses. :::info Nwaku can be built and run on Linux and macOS, while Windows support is currently experimental. @@ -108,5 +108,59 @@ curl --location --request GET 'http://localhost:8545' \ :::info -The `listenAddresses` field stores the transport addresses for accepting connections, while the `enrUri` field stores the `ENR` URI for peer discovery. -::: \ No newline at end of file +The `listenAddresses` field stores the node's listening address(es), while the `enrUri` field stores the discoverable `ENR` URI for peer discovery. +::: + +## Find the Node Addresses + +You can find the addresses of a running node through its logs or by calling the `get_waku_v2_debug_v1_info` method of the [JSON RPC API](https://rfc.vac.dev/spec/16/). + +:::tip +When starting the node, `nwaku` will display all the public listening and discovery addresses at the `INFO` log level. +::: + +### Listening Address(es) + +Look for the log entry that begins with `Listening on`, for example: + +```txt title="Nwaku Log Output" +INF 2023-06-15 16:09:54.448+01:00 Listening on topics="waku node" tid=1623445 file=waku_node.nim:922 full=[/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn][/ip4/0.0.0.0/tcp/8000/ws/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn] +``` + +```bash +# Listening TCP transport address +/ip4/0.0.0.0/tcp/60000/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn + +# Listening websocket address +/ip4/0.0.0.0/tcp/8000/ws/p2p/16Uiu2HAmQCsH9V81xoqTwGuT3qwkZWbwY1TtTQwpr3DjHU2TSwMn +``` + +### Discoverable ENR Address(es) + +A `nwaku` node can encode it's addressing information in an [Ethereum Node Record (ENR)](https://eips.ethereum.org/EIPS/eip-778) following the [WAKU2-ENR](https://rfc.vac.dev/spec/31/) specification, primarily for peer discovery. + +#### ENR for DNS discovery + +Look for the log entry that begins with `DNS: discoverable ENR`, for example: + +```txt title="Nwaku Log Output" +INF 2023-06-15 16:09:54.448+01:00 DNS: discoverable ENR topics="waku node" tid=1623445 file=waku_node.nim:923 enr=enr:-Iu4QBKYj8Ovxwz4fIalxZ_1a8dOCU2WC-1LQrcBCCb4Np93f9-UuSZXn3vagJL1S3k3hwRYfOp3JSbW7_VqwtqMIeMBgmlkgnY0gmlwhAAAAACJc2VjcDI1NmsxoQOrmyV59dAzY4ZKrvrj32VOoZbLby8dCKFnXnqhIdQ0NYN0Y3CC6mCFd2FrdTIB +``` + +```bash +# ENR the node addresses are encoded in +enr:-Iu4QBKYj8Ovxwz4fIalxZ_1a8dOCU2WC-1LQrcBCCb4Np93f9-UuSZXn3vagJL1S3k3hwRYfOp3JSbW7_VqwtqMIeMBgmlkgnY0gmlwhAAAAACJc2VjcDI1NmsxoQOrmyV59dAzY4ZKrvrj32VOoZbLby8dCKFnXnqhIdQ0NYN0Y3CC6mCFd2FrdTIB +``` + +#### ENR for Discv5 + +Look for the log entry that begins with `Discv5: discoverable ENR`, for example: + +```txt title="Nwaku Log Output" +INF 2023-06-15 16:09:54.448+01:00 Discv5: discoverable ENR topics="waku node" tid=1623445 file=waku_node.nim:924 enr=enr:-IO4QDxToTg86pPCK2KvMeVCXC2ADVZWrxXSvNZeaoa0JhShbM5qed69RQz1s1mWEEqJ3aoklo_7EU9iIBcPMVeKlCQBgmlkgnY0iXNlY3AyNTZrMaEDdBHK1Gx6y_zv5DVw5Qb3DtSOMmVHTZO1WSORrF2loL2DdWRwgiMohXdha3UyAw +``` + +```bash +# ENR the node addresses are encoded in +enr:-IO4QDxToTg86pPCK2KvMeVCXC2ADVZWrxXSvNZeaoa0JhShbM5qed69RQz1s1mWEEqJ3aoklo_7EU9iIBcPMVeKlCQBgmlkgnY0iXNlY3AyNTZrMaEDdBHK1Gx6y_zv5DVw5Qb3DtSOMmVHTZO1WSORrF2loL2DdWRwgiMohXdha3UyAw +``` \ No newline at end of file