add peer discovery guide

This commit is contained in:
LordGhostX 2023-06-16 09:40:22 +01:00
parent a6aae704c6
commit 4e1cc330fd
No known key found for this signature in database
GPG Key ID: 520CC5DC4F94FCC7
12 changed files with 85 additions and 26 deletions

View File

@ -45,7 +45,9 @@
"devel", "devel",
"statusteam", "statusteam",
"myaddr", "myaddr",
"extip" "extip",
"staticnode",
"permissioned"
], ],
"flagWords": [], "flagWords": [],
"ignorePaths": [ "ignorePaths": [

View File

@ -1,7 +0,0 @@
```mermaid
sequenceDiagram
Alice->>Bob: Connect to Bob (predefined node details)
Alice->>Carol: Connect to Carol (predefined node details)
```
Alice establishes connections with Bob and Carol using their node details, which are predefined (hard-coded) into Alice's node.

View File

@ -0,0 +1,7 @@
```mermaid
sequenceDiagram
Alice->>Bob: Connect to Bob (static peer details)
Alice->>Carol: Connect to Carol (static peer details)
```
Alice establishes connections with Bob and Carol using their node details, which are predefined (hard-coded) into Alice's node.

View File

@ -0,0 +1,48 @@
---
title: Configure Peer Discovery
---
This guide provides detailed steps to configure a `nwaku` node to locate and connect with peers in the Waku Network.
:::tip
You can configure a `nwaku` node to use multiple peer discovery mechanisms simultaneously.
:::
## Configure Static Peers
You can provide static peers to a `nwaku` node during startup using the `staticnode` configuration option. To connect to multiple peers on startup, repeat the `staticnode` option:
```bash
wakunode2 \
--staticnode:[Libp2p MULTIADDR PEER 1] \
--staticnode:[Libp2p MULTIADDR PEER 2]
```
## Configure DNS Discovery
To enable [DNS Discovery](/overview/concepts/dns-discovery) in a `nwaku` node, use the following configuration options:
- `dns-discovery`: Enables DNS Discovery on the node (disabled by default).
- `dns-discovery-url`: URL for DNS node list in the format `enrtree://<key>@<fqdn>` where `<fqdn>` is the fully qualified domain name and `<key>` is the base32 encoding of the compressed 32-byte public key that signed the list at that location.
- `dns-discovery-name-server` (optional): DNS name server IPs to query. You can repeat this option to provide multiple DNS name servers.
```
wakunode2 \
--dns-discovery:true \
--dns-discovery-url:[DNS NODE LIST]
```
## Configure Discv5
You can enable [Discv5](/overview/concepts/discv5) in a `nwaku` node using the `discv5-discovery` and `discv5-bootstrap-node` configuration options. To configure multiple bootstrap entries for the Discv5 routing table, repeat the `discv5-bootstrap-node` option:
```bash
wakunode2 \
--discv5-discovery:true \
--discv5-bootstrap-node:[DISCV5 ENR BOOTSTRAP ENTRY 1] \
--discv5-bootstrap-node:[DISCV5 ENR BOOTSTRAP ENTRY 2]
```
:::info
When Discv5 is enabled and used with [DNS Discovery](#configure-dns-discovery), the `nwaku` node will attempt to bootstrap the Discv5 routing table by extracting `ENRs` from peers discovered through DNS.
:::

View File

@ -92,4 +92,8 @@ The following options are available:
--tcp-port TCP listening port. [=60000]. --tcp-port TCP listening port. [=60000].
<...> <...>
``` ```
:::tip
To explore the available node configuration options, please refer to the [Node Configuration Options](/guides/reference/node-config-options) guide.
:::

View File

@ -2,7 +2,7 @@
title: Node Configuration Options title: Node Configuration Options
--- ---
Here are the node configuration options and their descriptions: Here are the available node configuration options, along with their default values and descriptions:
## Application-Level Config ## Application-Level Config
@ -131,7 +131,7 @@ Here are the node configuration options and their descriptions:
| `dns-discovery-url` | | URL for DNS node list in format 'enrtree://<key\>@<fqdn\>' | | `dns-discovery-url` | | URL for DNS node list in format 'enrtree://<key\>@<fqdn\>' |
| `dns-discovery-name-server` | `@[1.1.1.1, 1.0.0.1]` | DNS name server IPs to query. Argument may be repeated | | `dns-discovery-name-server` | `@[1.1.1.1, 1.0.0.1]` | DNS name server IPs to query. Argument may be repeated |
## Discovery v5 Config ## Discv5 Config
| Name | Default Value | Description | | Name | Default Value | Description |
| - | - | - | | - | - | - |
@ -158,4 +158,8 @@ Here are the node configuration options and their descriptions:
| `websocket-port` | `8000` | WebSocket listening port | | `websocket-port` | `8000` | WebSocket listening port |
| `websocket-secure-support` | `false` | Enable secure websocket: true\|false | | `websocket-secure-support` | `false` | Enable secure websocket: true\|false |
| `websocket-secure-key-path` | | Secure websocket key path: '/path/to/key.txt' | | `websocket-secure-key-path` | | Secure websocket key path: '/path/to/key.txt' |
| `websocket-secure-cert-path` | | Secure websocket Certificate path: '/path/to/cert.txt' | | `websocket-secure-cert-path` | | Secure websocket Certificate path: '/path/to/cert.txt' |
:::tip
To configure your node using the provided configuration options, please refer to the [Node Configuration Methods](/guides/reference/node-config-methods) guide.
:::

View File

@ -57,9 +57,9 @@ To join the Waku Network, nodes must connect with peers. Nwaku provides multiple
| | Description | Documentation | | | Description | Documentation |
| - | - | - | | - | - | - |
| Predefined Nodes | Configure the bootstrap nodes that `nwaku` should establish connections upon startup | [Configure Predefined Nodes](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/connect.md#option-1-configure-peers-statically) | | Static Peers | Configure the bootstrap nodes that `nwaku` should establish connections upon startup | [Configure Static Peers](/guides/nwaku/configure-discovery#configure-static-peers) |
| DNS Discovery | Enable `nwaku` to locate peers to connect to using the `DNS Discovery` mechanism | [Configure DNS Discovery](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/configure-dns-disc.md) | | DNS Discovery | Enable `nwaku` to locate peers to connect to using the `DNS Discovery` mechanism | [Configure DNS Discovery](/guides/nwaku/configure-discovery#configure-dns-discovery) |
| Discv5 | Enable `nwaku` to locate peers to connect to using the `Discv5` mechanism | [Configure Discv5](https://github.com/waku-org/nwaku/blob/master/docs/operators/how-to/connect.md#option-3-discover-peers-using-waku-discovery-v5) | | Discv5 | Enable `nwaku` to locate peers to connect to using the `Discv5` mechanism | [Configure Discv5](/guides/nwaku/configure-discovery#configure-discv5) |
:::tip :::tip
You can configure a `nwaku` node to use multiple peer discovery mechanisms simultaneously. You can configure a `nwaku` node to use multiple peer discovery mechanisms simultaneously.

View File

@ -12,7 +12,7 @@ Once a connection is established, the node must actively seek out additional pee
Waku supports multiple peer discovery mechanisms, such as: Waku supports multiple peer discovery mechanisms, such as:
- [Configuring Predefined Nodes](/overview/concepts/predefined-nodes) - [Configuring Static Peers](/overview/concepts/static-peers)
- [Peer Discovery via DNS](/overview/concepts/dns-discovery) - [Peer Discovery via DNS](/overview/concepts/dns-discovery)
- [Discv5 Ambient Peer Discovery](/overview/concepts/discv5) - [Discv5 Ambient Peer Discovery](/overview/concepts/discv5)
- [Peer Exchange](/overview/concepts/peer-exchange) - [Peer Exchange](/overview/concepts/peer-exchange)

View File

@ -1,8 +1,8 @@
--- ---
title: Predefined Nodes title: Static Peer
--- ---
Waku applications have the flexibility to embed bootstrap node addresses directly into their codebase. Developers can use either the [predefined nodes by Status](https://github.com/waku-org/js-waku/blob/master/packages/core/src/lib/predefined_bootstrap_nodes.ts#L45) or [run a node](/guides/nodes-and-sdks#run-a-waku-node) per their preference. Waku applications have the flexibility to embed bootstrap node addresses directly into their codebase. Developers can either use [static peers by Status](https://github.com/waku-org/js-waku/blob/master/packages/core/src/lib/predefined_bootstrap_nodes.ts#L45) or [run a node](/guides/nodes-and-sdks#run-a-waku-node) per their preference.
#### Pros #### Pros
@ -18,7 +18,7 @@ Waku applications have the flexibility to embed bootstrap node addresses directl
## Overview ## Overview
```mdx-code-block ```mdx-code-block
import PredefinedNodes from "@site/diagrams/_predefined-nodes.md"; import StaticPeers from "@site/diagrams/_static-peers.md";
<PredefinedNodes /> <StaticPeers />
``` ```

View File

@ -11,7 +11,7 @@ import { PoweredBy } from "@site/src/components/mdx";
{ {
name: "Status", name: "Status",
description: description:
"Status is a secure messaging app, crypto wallet, and Web3 browser built with state-of-the-art technology.", "Waku powers many of the Status super app's features, including its private messaging.",
logoSrc: "/img/status-mark-black.svg", logoSrc: "/img/status-mark-black.svg",
logoSrcDark: "/img/status-mark-white.svg", logoSrcDark: "/img/status-mark-white.svg",
link: "https://status.im", link: "https://status.im",
@ -19,7 +19,7 @@ import { PoweredBy } from "@site/src/components/mdx";
{ {
name: "RAILGUN", name: "RAILGUN",
description: description:
"RAILGUN uses Waku to offer private gas payments to users, ensuring anonymity and privacy for their transactions.", "The privacy-focused DeFi protocol Railgun anonymizes Ethereum transactions with Waku.",
logoSrc: "/img/railgun-mark-black.svg", logoSrc: "/img/railgun-mark-black.svg",
logoSrcDark: "/img/railgun-mark-white.svg", logoSrcDark: "/img/railgun-mark-white.svg",
link: "https://railgun.org", link: "https://railgun.org",
@ -35,7 +35,7 @@ import { PoweredBy } from "@site/src/components/mdx";
{ {
name: "XMTP", name: "XMTP",
description: description:
"XMTP uses the Waku network to enable secure Web3 messaging in their open protocol and network.", "Inter-blockchain account messaging protocol XMTP uses Waku to facilitate communication between nodes in its currently permissioned network.",
logoSrc: "/img/xmtp-mark-black.svg", logoSrc: "/img/xmtp-mark-black.svg",
logoSrcDark: "/img/xmtp-mark-white.svg", logoSrcDark: "/img/xmtp-mark-white.svg",
link: "https://xmtp.org", link: "https://xmtp.org",

View File

@ -17,12 +17,12 @@ def parse_table_heading(line: str) -> Tuple[str, bool]:
word_replace_re = re.compile('|'.join([ word_replace_re = re.compile('|'.join([
r'(Configuration)', r'(And)', r'(Lightpush)', r'(Configuration)', r'(And)', r'(Lightpush)',
r'(Json-Rpc)', r'(Rest Http)', r'(Dns)', r'(Json-Rpc)', r'(Rest Http)', r'(Dns)',
r'(V5)', r'(Websocket)' r'(Discovery V5)', r'(Websocket)'
])) ]))
word_replace_dict = { word_replace_dict = {
'Configuration': 'Config', 'And': 'and', 'Lightpush': 'Light Push', 'Configuration': 'Config', 'And': 'and', 'Lightpush': 'Light Push',
'Json-Rpc': 'JSON-RPC', 'Rest Http': 'REST HTTP', 'Dns': 'DNS', 'Json-Rpc': 'JSON-RPC', 'Rest Http': 'REST HTTP', 'Dns': 'DNS',
'V5': 'v5', 'Websocket': 'WebSocket' 'Discovery V5': 'Discv5', 'Websocket': 'WebSocket'
} }
table_heading = word_replace_re.sub(lambda match: word_replace_dict[match.group(0)], table_heading) table_heading = word_replace_re.sub(lambda match: word_replace_dict[match.group(0)], table_heading)
return '## ' + table_heading, True return '## ' + table_heading, True

View File

@ -31,7 +31,7 @@ const sidebars = {
id: "overview/concepts/peer-discovery", id: "overview/concepts/peer-discovery",
}, },
items: [ items: [
"overview/concepts/predefined-nodes", "overview/concepts/static-peers",
"overview/concepts/dns-discovery", "overview/concepts/dns-discovery",
"overview/concepts/discv5", "overview/concepts/discv5",
"overview/concepts/peer-exchange", "overview/concepts/peer-exchange",
@ -64,6 +64,7 @@ const sidebars = {
"guides/nwaku/build-source", "guides/nwaku/build-source",
"guides/nwaku/run-docker", "guides/nwaku/run-docker",
"guides/nwaku/run-docker-compose", "guides/nwaku/run-docker-compose",
"guides/nwaku/configure-discovery",
] ]
}, },
{ {