From 93bd790c258b3da1e413ce31be342fe4c96126c0 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 17 Jun 2025 19:47:29 +1000 Subject: [PATCH 01/47] Propose custom IDL for Waku API definition --- standards/application/waku-api.md | 174 ++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 standards/application/waku-api.md diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md new file mode 100644 index 0000000..fe5b0b5 --- /dev/null +++ b/standards/application/waku-api.md @@ -0,0 +1,174 @@ +--- +title: MESSAGING-API +name: Messaging API definition +category: Standards Track +tags: [reliability, application, api, protocol composition] +editor: Oleksandr Kozlov +contributors: +- Oleksandr Kozlov +- Prem Chaitanya Prathi +- Franck Royer +--- + +## Table of contents + +- [Abstract](#abstract) +- [Design Requirements](#design-requirements) +- [API design](#api-design) + - [Requirements](#requirements) + - [Initial configuration](#initial-configuration) + - [Send](#send) + - [Subscribe](#subscribe) + - [Message Storage](#message-storage) + - [Health Indicator](#health-indicator) + - [Event Source](#event-source) + +## Abstract + +This document specifies an Application Programming Interface (API) that is RECOMMENDED for developers of the [WAKU2](https://github.com/vacp2p/rfc-index/blob/7b443c1aab627894e3f22f5adfbb93f4c4eac4f6/waku/standards/core/10/waku2.md) clients to implement, +and for consumers to use as a single entry point to its functionalities. + +This API defines the RECOMMENDED interface for leveraging Waku protocols to send and receive messages. +Application developers SHOULD use it to access capabilities for peer discovery, message routing, and peer-to-peer reliability. + +## Motivation + +The accessibility of Waku protocols is capped by the accessibility of their implementations, and hence API. +This RFC enables a concerted effort to draft an API that is simple and accessible, and opiniate on sane defaults. + +This effort is best done in an RFC, allowing all current implementors to review and agree on it. + +The API defined in this document is an opiniated-by-purpose method to use the more agnostic [WAKU2]() protocols. + +## Syntax + +The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, +“RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119.txt). + +### Definitions + +This section defines key terms and concepts used throughout this document. +Each term is detailed in dedicated subsections to ensure clarity and consistency in interpretation. + +`Multiaddr` - a self-describing format for encoding network address of a remote peer as per [libp2p addressing](https://github.com/libp2p/specs/blob/6d38f88f7b2d16b0e4489298bcd0737a6d704f7e/addressing/README.md) specification. + +## API design + +### IDL + +A custom Interface Definition Language (IDL) in YAML is used to define the Waku API. +Existing IDL Such as OpenAPI, AsyncAPI or WIT do not exactly fit the requirements for this API. +Hence, instead of having the reader learn a new IDL, we propose to use a simple IDL with self-describing syntax. + +An alternative would be to choose a programming language. However, such choice may express unintended opinions on the API. + +#### Guidelines + +- No `default` means that the value is mandatory +- Primitive types are `string`, `int`, `bool` and `uint` +- Complex pre-define types are `struct`, `option` and `array` +- Primitive types are preferred to describe the API for simplicity, the implementator may prefer a native type (e.g. `string` vs `Multiaddr` object/struct) + +### Application + +This API is designed for generic use and ease across all programming languages and traditional `REST` architectures. + +## The Waku API + +```yaml +api_version: "0.0.1" +library_name: "waku" +description: "Waku: a private and censorship-resistant message routing library." +``` + +### Type definitions + +```yaml +types: + Config: + type: struct + fields: + operating_mode: + type: string + constraints: ["edge", "relay"] + description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." + network_config: + type: struct + default: TheWakuNetworkPreset + fields: + boostrap_nodes: + type: array + default: "" + description: "Bootstrap nodes, entree and multiaddr formats are accepted." + static_store_nodes: + type: array + default: [] + description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." + clusterId: + type: uint + default: 1 + sharding_mode: + constraints: ["auto", "static"] + auto_sharding_config: + type: optionAutoShardingConfig + default: none + description: "The auto-sharding config, if sharding mode is `auto`" + active_relay_shards: + type: array + constraints: operating_mode == "relay" + default: [] + description: "The shards for relay to subscribe to and participate in." + store_confirmation: + type: bool + default: false + description: "No-payload store hash queries are made to confirm whether outbound messages where received by remote store node." + + AutoShardingConfig: + type: struct + fields: + numShardsInCluster: + type: uint + description: "The number of shards in the configured cluster; this is a globally agreed value for each cluster." +``` + +### Initialise Waku Node + +TODO: define WakuNode? + +```yaml +functions: + init: + description: "Initialise the waku node" + parameters: + - name: config + type: Config + description: "The Waku node configuration." + returns: + type: result +``` + +#### Functionality / Additional Information / Specific Behaviours + +If the node is operating in `edge` mode, it MUST: + +- Use [LIGHTPUSH](../standards/core/lightpush.md) to send messages +- Use [FILTER](https://github.com/vacp2p/rfc-index/blob/7b443c1aab627894e3f22f5adfbb93f4c4eac4f6/waku/standards/core/12/filter.md) to receive messages +- Use [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/f08de108457eed828dadbd36339433c586701267/waku/standards/core/34/peer-exchange.md#abstract) to discover peers +- Use [STORE](../standards/core/store.md) as per [WAKU-P2P-RELIABILITY]() + +If the node is configured in `relay` mode, it MUST: + +- Use [RELAY](https://github.com/vacp2p/rfc-index/blob/0277fd0c4dbd907dfb2f0c28b6cde94a335e1fae/waku/standards/core/11/relay.md) protocol. +- Host endpoints for [LIGHTPUSH](../standards/core/lightpush.md) and [FILTER](https://github.com/vacp2p/rfc-index/blob/7b443c1aab627894e3f22f5adfbb93f4c4eac4f6/waku/standards/core/12/filter.md). +- Serve the [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/f08de108457eed828dadbd36339433c586701267/waku/standards/core/34/peer-exchange.md#abstract) protocol. + +`edge` mode SHOULD be used if node functions in resource restricted environment, +whereas `relay` SHOULD be used if node has no hard restrictions. + +## Security/Privacy Considerations + +See [WAKU2-ADVERSARIAL-MODELS](https://github.com/waku-org/specs/blob/master/informational/adversarial-models.md). + +## Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From e013c158482544d4b216bbbdaf48f21a3e3cf1a7 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 18 Jun 2025 16:34:21 +1000 Subject: [PATCH 02/47] add language translation --- standards/application/waku-api.md | 49 ++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index fe5b0b5..03c1a18 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -12,16 +12,7 @@ contributors: ## Table of contents -- [Abstract](#abstract) -- [Design Requirements](#design-requirements) -- [API design](#api-design) - - [Requirements](#requirements) - - [Initial configuration](#initial-configuration) - - [Send](#send) - - [Subscribe](#subscribe) - - [Message Storage](#message-storage) - - [Health Indicator](#health-indicator) - - [Event Source](#event-source) +TODO ## Abstract @@ -80,6 +71,42 @@ api_version: "0.0.1" library_name: "waku" description: "Waku: a private and censorship-resistant message routing library." ``` +### Language Mappings + +How the API definition should be translated to specific languages. + +```yaml +language_mappings: + rust: + naming_convention: + - functions: "snake_case" + - variables: "snake_case" + - types: "PascalCase" + error_handling: "Result" + async_pattern: "tokio" + + golang: + naming_convention: + - functions: "snake_case" + - variables: "snake_case" + - types: "PascalCase" + error_handling: "error_return" + package_name: "waku" + + c: + naming_convention: "snake_case" + prefix: "waku_" + error_handling: "error_codes" + + typescript: + naming_convention: + - functions: "camelCase" + - variables: "camelCase" + - types: "PascalCase" + error_handling: "Promise" + module_type: "esm" +``` + ### Type definitions @@ -151,7 +178,7 @@ functions: If the node is operating in `edge` mode, it MUST: -- Use [LIGHTPUSH](../standards/core/lightpush.md) to send messages +- Use [LIGHTPUSH](/standards/core/lightpush.md) to send messages - Use [FILTER](https://github.com/vacp2p/rfc-index/blob/7b443c1aab627894e3f22f5adfbb93f4c4eac4f6/waku/standards/core/12/filter.md) to receive messages - Use [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/f08de108457eed828dadbd36339433c586701267/waku/standards/core/34/peer-exchange.md#abstract) to discover peers - Use [STORE](../standards/core/store.md) as per [WAKU-P2P-RELIABILITY]() From adaba5428b3a100c0f6b05c4577ed915e1bbbb46 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 24 Jun 2025 12:23:12 +1000 Subject: [PATCH 03/47] typos and types --- standards/application/waku-api.md | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 03c1a18..c6b026a 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -25,11 +25,11 @@ Application developers SHOULD use it to access capabilities for peer discovery, ## Motivation The accessibility of Waku protocols is capped by the accessibility of their implementations, and hence API. -This RFC enables a concerted effort to draft an API that is simple and accessible, and opiniate on sane defaults. +This RFC enables a concerted effort to draft an API that is simple and accessible, and provides an opinion on sane defaults. This effort is best done in an RFC, allowing all current implementors to review and agree on it. -The API defined in this document is an opiniated-by-purpose method to use the more agnostic [WAKU2]() protocols. +The API defined in this document is an opinionated-by-purpose method to use the more agnostic [WAKU2]() protocols. ## Syntax @@ -56,9 +56,12 @@ An alternative would be to choose a programming language. However, such choice m #### Guidelines - No `default` means that the value is mandatory -- Primitive types are `string`, `int`, `bool` and `uint` -- Complex pre-define types are `struct`, `option` and `array` -- Primitive types are preferred to describe the API for simplicity, the implementator may prefer a native type (e.g. `string` vs `Multiaddr` object/struct) +- Primitive types are `string`, `int`, `bool`, `enum` and `uint` +- Complex pre-defined types are: + - `struct`: object and other nested types + - `option`: a value that can be set or left null + - `array`: iterable object containing values of all the same type + - `Multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language ### Application @@ -178,16 +181,16 @@ functions: If the node is operating in `edge` mode, it MUST: -- Use [LIGHTPUSH](/standards/core/lightpush.md) to send messages -- Use [FILTER](https://github.com/vacp2p/rfc-index/blob/7b443c1aab627894e3f22f5adfbb93f4c4eac4f6/waku/standards/core/12/filter.md) to receive messages -- Use [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/f08de108457eed828dadbd36339433c586701267/waku/standards/core/34/peer-exchange.md#abstract) to discover peers -- Use [STORE](../standards/core/store.md) as per [WAKU-P2P-RELIABILITY]() +- Use [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) to send messages +- Use [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) to receive messages +- Use [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md#abstract) to discover peers +- Use [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as per [WAKU-P2P-RELIABILITY](/standards/application/p2p-reliability.md) If the node is configured in `relay` mode, it MUST: - Use [RELAY](https://github.com/vacp2p/rfc-index/blob/0277fd0c4dbd907dfb2f0c28b6cde94a335e1fae/waku/standards/core/11/relay.md) protocol. -- Host endpoints for [LIGHTPUSH](../standards/core/lightpush.md) and [FILTER](https://github.com/vacp2p/rfc-index/blob/7b443c1aab627894e3f22f5adfbb93f4c4eac4f6/waku/standards/core/12/filter.md). -- Serve the [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/f08de108457eed828dadbd36339433c586701267/waku/standards/core/34/peer-exchange.md#abstract) protocol. +- Host endpoints for [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) and [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md). +- Serve the [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) protocol. `edge` mode SHOULD be used if node functions in resource restricted environment, whereas `relay` SHOULD be used if node has no hard restrictions. From d5c688a3278ac7ab59130effb9159a8812a53d4d Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 24 Jun 2025 12:43:11 +1000 Subject: [PATCH 04/47] set default value --- standards/application/waku-api.md | 73 ++++++++++++++++++++----------- 1 file changed, 47 insertions(+), 26 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index c6b026a..65789cc 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -118,41 +118,44 @@ types: Config: type: struct fields: - operating_mode: + mode: type: string constraints: ["edge", "relay"] description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." network_config: - type: struct + type: NetworkConfig default: TheWakuNetworkPreset - fields: - boostrap_nodes: - type: array - default: "" - description: "Bootstrap nodes, entree and multiaddr formats are accepted." - static_store_nodes: - type: array - default: [] - description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." - clusterId: - type: uint - default: 1 - sharding_mode: - constraints: ["auto", "static"] - auto_sharding_config: - type: optionAutoShardingConfig - default: none - description: "The auto-sharding config, if sharding mode is `auto`" - active_relay_shards: - type: array - constraints: operating_mode == "relay" - default: [] - description: "The shards for relay to subscribe to and participate in." + active_relay_shards: + type: array + constraints: mode == "relay" + default: [] + description: "The shards for relay to subscribe to and participate in." store_confirmation: type: bool default: false description: "No-payload store hash queries are made to confirm whether outbound messages where received by remote store node." - + + NetworkConfig: + type: struct + fields: + boostrap_nodes: + type: array + default: "" + description: "Bootstrap nodes, entree and multiaddr formats are accepted." + static_store_nodes: + type: array + default: [] + description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." + cluster_id: + type: uint + default: 1 + sharding_mode: + constraints: ["auto", "static"] + auto_sharding_config: + type: option + default: none + description: "The auto-sharding config, if sharding mode is `auto`" + AutoShardingConfig: type: struct fields: @@ -195,6 +198,24 @@ If the node is configured in `relay` mode, it MUST: `edge` mode SHOULD be used if node functions in resource restricted environment, whereas `relay` SHOULD be used if node has no hard restrictions. +#### Default Values + +```yaml +values: + TheWakuNetworkPreset: + type: NetworkConfig + fields: + bootstrap_nodes: ["enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im"] + static_store_nodes: #TODO: enter sandbox store nodes multiaddr + cluster_id: 1 + sharding_mode: "auto" + auto_sharding_config: TheWakuNetworkAutoShardingConfig + TheWakuNetworkAutoShardingConfig: + type: AutoShardingConfig + fields: + numShardsInCluster: 8 +``` + ## Security/Privacy Considerations See [WAKU2-ADVERSARIAL-MODELS](https://github.com/waku-org/specs/blob/master/informational/adversarial-models.md). From 95ebcd9ea030bcbea696217776654a84b81f6a94 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 24 Jun 2025 13:03:22 +1000 Subject: [PATCH 05/47] Reducing prescription re language mapping --- standards/application/waku-api.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 65789cc..fa7b6fc 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -61,7 +61,10 @@ An alternative would be to choose a programming language. However, such choice m - `struct`: object and other nested types - `option`: a value that can be set or left null - `array`: iterable object containing values of all the same type - - `Multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language + - `multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language + - `result`: an enum type that either contain a return value (success), or an error (failure). The error is left to the implementor + - `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language. +- The first parameter of a function MAY be considered as the object on which a method is called. It is left to the implementor on whether an objective programming approach is idiomatic to the language. ### Application @@ -85,28 +88,22 @@ language_mappings: - functions: "snake_case" - variables: "snake_case" - types: "PascalCase" - error_handling: "Result" - async_pattern: "tokio" golang: naming_convention: - functions: "snake_case" - variables: "snake_case" - types: "PascalCase" - error_handling: "error_return" - package_name: "waku" c: naming_convention: "snake_case" prefix: "waku_" - error_handling: "error_codes" typescript: naming_convention: - functions: "camelCase" - variables: "camelCase" - types: "PascalCase" - error_handling: "Promise" module_type: "esm" ``` @@ -115,6 +112,10 @@ language_mappings: ```yaml types: + WakuNode: + type: struct + description: "A Waku node instance." + Config: type: struct fields: @@ -166,18 +167,16 @@ types: ### Initialise Waku Node -TODO: define WakuNode? - ```yaml functions: init: - description: "Initialise the waku node" + description: "Initialise a Waku node instance" parameters: - - name: config - type: Config - description: "The Waku node configuration." + - name: config + type: Config + description: "The Waku node configuration." returns: - type: result + type: result ``` #### Functionality / Additional Information / Specific Behaviours @@ -196,7 +195,7 @@ If the node is configured in `relay` mode, it MUST: - Serve the [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) protocol. `edge` mode SHOULD be used if node functions in resource restricted environment, -whereas `relay` SHOULD be used if node has no hard restrictions. +whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restrictions. #### Default Values From 25984c0b142a3b284831e37e0f85cf7385e770ca Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 30 Jun 2025 14:22:49 +1000 Subject: [PATCH 06/47] Remove shard relay subscription for init config Being able to set what shard to subscribe too when initialising a Waku node is a biased towards service nodes. Indeed, subscribing to shard should be done with the `subscribe` API (yet to be defined). Which can be used with a content topic, and pubsub topic (only if static sharding). A service node such as the `wakunode2` binary can still accept "shards to subscribe to" via CLI, but this is unrelated to the Waku node conf, and the `wakunode2` software should simply call `subscribe` when ready. --- standards/application/waku-api.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index fa7b6fc..f9f3183 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -126,11 +126,6 @@ types: network_config: type: NetworkConfig default: TheWakuNetworkPreset - active_relay_shards: - type: array - constraints: mode == "relay" - default: [] - description: "The shards for relay to subscribe to and participate in." store_confirmation: type: bool default: false From 73354fd6838417f0608f99035b6d3d79135258da Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 30 Jun 2025 14:26:25 +1000 Subject: [PATCH 07/47] Only specify nim and TS naming convention Reducing the scope, we can review Rust, Golang and C in a separate PR. --- standards/application/waku-api.md | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index f9f3183..862cd01 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -83,28 +83,16 @@ How the API definition should be translated to specific languages. ```yaml language_mappings: - rust: - naming_convention: - - functions: "snake_case" - - variables: "snake_case" - - types: "PascalCase" - - golang: - naming_convention: - - functions: "snake_case" - - variables: "snake_case" - - types: "PascalCase" - - c: - naming_convention: "snake_case" - prefix: "waku_" - typescript: naming_convention: - functions: "camelCase" - variables: "camelCase" - types: "PascalCase" - module_type: "esm" + nim: + naming_convention: + - functions: "camelCase" + - variables: "camelCase" + - types: "PascalCase" ``` From 2096211872c5b18823727416a07e730bedcec0e7 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 30 Jun 2025 14:28:00 +1000 Subject: [PATCH 08/47] remove extra --- standards/application/waku-api.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 862cd01..14c782e 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -27,8 +27,6 @@ Application developers SHOULD use it to access capabilities for peer discovery, The accessibility of Waku protocols is capped by the accessibility of their implementations, and hence API. This RFC enables a concerted effort to draft an API that is simple and accessible, and provides an opinion on sane defaults. -This effort is best done in an RFC, allowing all current implementors to review and agree on it. - The API defined in this document is an opinionated-by-purpose method to use the more agnostic [WAKU2]() protocols. ## Syntax From b20f5fd1795c9b77bc90a3b255ee27ee8d1b2837 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 30 Jun 2025 14:39:30 +1000 Subject: [PATCH 09/47] rename RFC --- standards/application/waku-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 14c782e..4773a64 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -1,6 +1,6 @@ --- -title: MESSAGING-API -name: Messaging API definition +title: WAKU-API +name: Waku API definition category: Standards Track tags: [reliability, application, api, protocol composition] editor: Oleksandr Kozlov From 4ca0e08038f7cc2df664ec9e06a3b32418d63ab7 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 30 Jun 2025 15:25:12 +1000 Subject: [PATCH 10/47] rework structure, include feedback --- standards/application/waku-api.md | 104 ++++++++++++++++-------------- 1 file changed, 57 insertions(+), 47 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 4773a64..4bf50f5 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -34,13 +34,6 @@ The API defined in this document is an opinionated-by-purpose method to use the The keywords “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in [RFC2119](https://www.ietf.org/rfc/rfc2119.txt). -### Definitions - -This section defines key terms and concepts used throughout this document. -Each term is detailed in dedicated subsections to ensure clarity and consistency in interpretation. - -`Multiaddr` - a self-describing format for encoding network address of a remote peer as per [libp2p addressing](https://github.com/libp2p/specs/blob/6d38f88f7b2d16b0e4489298bcd0737a6d704f7e/addressing/README.md) specification. - ## API design ### IDL @@ -51,31 +44,20 @@ Hence, instead of having the reader learn a new IDL, we propose to use a simple An alternative would be to choose a programming language. However, such choice may express unintended opinions on the API. -#### Guidelines +### Primitive types and general guidelines - No `default` means that the value is mandatory - Primitive types are `string`, `int`, `bool`, `enum` and `uint` - Complex pre-defined types are: - - `struct`: object and other nested types - - `option`: a value that can be set or left null - - `array`: iterable object containing values of all the same type - - `multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language - - `result`: an enum type that either contain a return value (success), or an error (failure). The error is left to the implementor + - `struct`: object and other nested types. + - `option`: a value that can be set or left null. + - `array`: iterable object containing values of all the same type. + - `multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language. + - `result`: an enum type that either contain a return value (success), or an error (failure); The error is left to the implementor. - `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language. -- The first parameter of a function MAY be considered as the object on which a method is called. It is left to the implementor on whether an objective programming approach is idiomatic to the language. +- Usage of `result` is RECOMMENDED, usage of exceptions is NOT RECOMMENDED, no matter the language. -### Application - -This API is designed for generic use and ease across all programming languages and traditional `REST` architectures. - -## The Waku API - -```yaml -api_version: "0.0.1" -library_name: "waku" -description: "Waku: a private and censorship-resistant message routing library." -``` -### Language Mappings +### Language mappings How the API definition should be translated to specific languages. @@ -93,8 +75,21 @@ language_mappings: - types: "PascalCase" ``` +### Application -### Type definitions +This API is designed for generic use and ease across all programming languages, for `edge` and `relay` type nodes. + +## The Waku API + +```yaml +api_version: "0.0.1" +library_name: "waku" +description: "Waku: a private and censorship-resistant message routing library." +``` + +### Initialise Waku node + +#### Type definitions ```yaml types: @@ -146,7 +141,7 @@ types: description: "The number of shards in the configured cluster; this is a globally agreed value for each cluster." ``` -### Initialise Waku Node +#### Function definitions ```yaml functions: @@ -160,28 +155,11 @@ functions: type: result ``` -#### Functionality / Additional Information / Specific Behaviours - -If the node is operating in `edge` mode, it MUST: - -- Use [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) to send messages -- Use [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) to receive messages -- Use [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md#abstract) to discover peers -- Use [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as per [WAKU-P2P-RELIABILITY](/standards/application/p2p-reliability.md) - -If the node is configured in `relay` mode, it MUST: - -- Use [RELAY](https://github.com/vacp2p/rfc-index/blob/0277fd0c4dbd907dfb2f0c28b6cde94a335e1fae/waku/standards/core/11/relay.md) protocol. -- Host endpoints for [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) and [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md). -- Serve the [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) protocol. - -`edge` mode SHOULD be used if node functions in resource restricted environment, -whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restrictions. - -#### Default Values +#### Predefined values ```yaml values: + TheWakuNetworkPreset: type: NetworkConfig fields: @@ -190,12 +168,44 @@ values: cluster_id: 1 sharding_mode: "auto" auto_sharding_config: TheWakuNetworkAutoShardingConfig + TheWakuNetworkAutoShardingConfig: type: AutoShardingConfig fields: numShardsInCluster: 8 ``` +#### Extended definitions + +If the `mode` set is `edge`, the initialised `WakuNode` MUST mount: + +- [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as client +- [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) as client +- [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as client + +And must use mount and use the following protocols to discover peers: + +- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) + +If the `mode` set is `relay`, the initialised `WakuNode` MUST mount: + +- [RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/11/relay.md) +- [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as service node +- [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) as service node +- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) as service node +- [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as client + +And must use mount and use the following protocols to discover peers: + +- [DISCV5](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/33/discv5.md) +- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) +- [RENDEZVOUS](https://github.com/waku-org/specs/blob/master/standards/core/rendezvous.md) + +`edge` mode SHOULD be used if node functions in resource restricted environment, +whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restrictions. + + + ## Security/Privacy Considerations See [WAKU2-ADVERSARIAL-MODELS](https://github.com/waku-org/specs/blob/master/informational/adversarial-models.md). From 6289f91f8f23569aa16763a6ad9dd51cc07bd558 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 21 Jul 2025 22:07:14 +1000 Subject: [PATCH 11/47] wip --- standards/application/waku-api.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 4bf50f5..5bcc33c 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -204,7 +204,15 @@ And must use mount and use the following protocols to discover peers: `edge` mode SHOULD be used if node functions in resource restricted environment, whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restrictions. +## The Validation API +[RLN Relay]() is currently the primary message validation mechanism in place. + +Work is scheduled to specify a validate API to enable plug-in validation. +As part of this API, it will be expected that an validation object can be passed, +that would contain all validation parameters including RLN. + +In the time being, we ## Security/Privacy Considerations From e92d2f8d8e3ab5d3d57a83689bf260a65f4061b3 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 5 Aug 2025 15:16:00 +1000 Subject: [PATCH 12/47] Change `init` to `create` As it is commonly used across both js-waku and nwaku code bases. --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 5bcc33c..7ec815e 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -145,7 +145,7 @@ types: ```yaml functions: - init: + create: description: "Initialise a Waku node instance" parameters: - name: config From 1e312bc2c380bfcd6aa62cb64b1cf3d0e4ec86ca Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 5 Aug 2025 15:27:48 +1000 Subject: [PATCH 13/47] update sharding defaults from previous discussions --- standards/application/waku-api.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 7ec815e..d9c2847 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -102,6 +102,7 @@ types: fields: mode: type: string + # For now, a mode **must** be passed by the developer constraints: ["edge", "relay"] description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." network_config: @@ -109,6 +110,7 @@ types: default: TheWakuNetworkPreset store_confirmation: type: bool + # Until further dogfooding, assuming default false, usage of SDS should be preferred default: false description: "No-payload store hash queries are made to confirm whether outbound messages where received by remote store node." @@ -117,6 +119,8 @@ types: fields: boostrap_nodes: type: array + # Default means the node does not bootstrap, it is not ideal but practical for local development + # TODO: get feedback default: "" description: "Bootstrap nodes, entree and multiaddr formats are accepted." static_store_nodes: @@ -125,13 +129,14 @@ types: description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." cluster_id: type: uint - default: 1 sharding_mode: constraints: ["auto", "static"] + # The default network config is TheWakuNetwork, but if a dev override it, then we still provide a sharding default + default: "auto" auto_sharding_config: type: option - default: none - description: "The auto-sharding config, if sharding mode is `auto`" + default: DefaultAutoShardingConfig + description: "The auto-sharding config, if sharding mode is `auto`" AutoShardingConfig: type: struct @@ -173,6 +178,13 @@ values: type: AutoShardingConfig fields: numShardsInCluster: 8 + + # If TheWakuNetworkPreset is not used, autosharding is one cluster is applied by default + # This is a safe default that abstract shards (content topic shard derivation), and enables scaling at a later stage + DefaultAutoShardingConfig: + type: AutoShardingConfig + fields: + numShardsInCluster: 1 ``` #### Extended definitions From 6a37950c66af1fac4001a0db66c65e9716f9a03e Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 5 Aug 2025 15:28:46 +1000 Subject: [PATCH 14/47] user snake case for field names --- standards/application/waku-api.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index d9c2847..20913fd 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -96,14 +96,14 @@ types: WakuNode: type: struct description: "A Waku node instance." - + Config: type: struct fields: - mode: + mode: type: string # For now, a mode **must** be passed by the developer - constraints: ["edge", "relay"] + constraints: [ "edge", "relay" ] description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." network_config: type: NetworkConfig @@ -125,23 +125,23 @@ types: description: "Bootstrap nodes, entree and multiaddr formats are accepted." static_store_nodes: type: array - default: [] + default: [ ] description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." cluster_id: type: uint sharding_mode: - constraints: ["auto", "static"] + constraints: [ "auto", "static" ] # The default network config is TheWakuNetwork, but if a dev override it, then we still provide a sharding default default: "auto" auto_sharding_config: type: option default: DefaultAutoShardingConfig - description: "The auto-sharding config, if sharding mode is `auto`" + description: "The auto-sharding config, if sharding mode is `auto`" AutoShardingConfig: type: struct fields: - numShardsInCluster: + num_shards_in_cluster: type: uint description: "The number of shards in the configured cluster; this is a globally agreed value for each cluster." ``` @@ -166,9 +166,9 @@ functions: values: TheWakuNetworkPreset: - type: NetworkConfig + type: NetworkConfig fields: - bootstrap_nodes: ["enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im"] + bootstrap_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] static_store_nodes: #TODO: enter sandbox store nodes multiaddr cluster_id: 1 sharding_mode: "auto" @@ -178,13 +178,13 @@ values: type: AutoShardingConfig fields: numShardsInCluster: 8 - + # If TheWakuNetworkPreset is not used, autosharding is one cluster is applied by default # This is a safe default that abstract shards (content topic shard derivation), and enables scaling at a later stage DefaultAutoShardingConfig: type: AutoShardingConfig fields: - numShardsInCluster: 1 + num_shards_in_cluster: 1 ``` #### Extended definitions From bebbe8b284172f38748e157fa326f6026e179b3c Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 6 Aug 2025 16:15:40 +1000 Subject: [PATCH 15/47] Add message validation --- standards/application/waku-api.md | 60 +++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 20913fd..518534a 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -131,12 +131,16 @@ types: type: uint sharding_mode: constraints: [ "auto", "static" ] - # The default network config is TheWakuNetwork, but if a dev override it, then we still provide a sharding default + # If the default config for TWN is not used, then we still provide a sharding default default: "auto" auto_sharding_config: type: option default: DefaultAutoShardingConfig description: "The auto-sharding config, if sharding mode is `auto`" + message_validation: + type: MessageValidation + # If the default config for TWN is not used, then we still provide a message validation default + default: DefaultMessageValidation AutoShardingConfig: type: struct @@ -144,6 +148,33 @@ types: num_shards_in_cluster: type: uint description: "The number of shards in the configured cluster; this is a globally agreed value for each cluster." + + MessageValidation: + type: struct + fields: + max_message_size_bytes: + type: uint + default: 153600 # 150 KiB + description: "The maximum accepted message size in Bytes" + # For now, RLN is the only message validation available + rln_config: + type: option + # If the default config for TWN is not used, then we do not apply RLN + default: none + + RlnConfig: + type: struct + fields: + contract_address: + type: string + description: "The address of the RLN contract exposes `root` and `getMerkleRoot` ABIs" + chain_id: + type: uint + description: "The chain id on which the RLN contract is deployed" + epoch_size_sec: + type: uint + description: "The epoch size to use for RLN, in seconds" + # Note that the limit for ``` #### Function definitions @@ -172,19 +203,34 @@ values: static_store_nodes: #TODO: enter sandbox store nodes multiaddr cluster_id: 1 sharding_mode: "auto" - auto_sharding_config: TheWakuNetworkAutoShardingConfig + auto_sharding_config: + fields: + numShardsInCluster: 8 + message_validation: - TheWakuNetworkAutoShardingConfig: - type: AutoShardingConfig + TheWakuNetworkMessageValidation: + type: MessageValidation fields: - numShardsInCluster: 8 + max_message_bytes_uint: 153600 # 150 KiB + rln_config: + fields: + contract_address: "0xB9cd878C90E49F797B4431fBF4fb333108CB90e6" + chain_id: 59141 + epoch_size_sec: 600 # 10 minutes - # If TheWakuNetworkPreset is not used, autosharding is one cluster is applied by default - # This is a safe default that abstract shards (content topic shard derivation), and enables scaling at a later stage + # If not preset is used, autosharding on one cluster is applied by default + # This is a safe default that abstract shards (content topic shard derivation), and it enables scaling at a later stage DefaultAutoShardingConfig: type: AutoShardingConfig fields: num_shards_in_cluster: 1 + + # If no preset is used, we only apply a max size limit to messages + DefaultMessageValidation: + type: MessageValidation + fields: + max_message_bytes_uint: 153600 # 150 KiB + rln_config: none ``` #### Extended definitions From 872115a9c0a500444a5a48d314a195435b8abad4 Mon Sep 17 00:00:00 2001 From: fryorcraken <110212804+fryorcraken@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:24:26 +1000 Subject: [PATCH 16/47] Apply suggestion from @chaitanyaprem Co-authored-by: Prem Chaitanya Prathi --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 518534a..5e1cafe 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -112,7 +112,7 @@ types: type: bool # Until further dogfooding, assuming default false, usage of SDS should be preferred default: false - description: "No-payload store hash queries are made to confirm whether outbound messages where received by remote store node." + description: "No-payload store hash queries are made to confirm whether outbound messages were received by remote store node." NetworkConfig: type: struct From 1ec75279d50b5576998fa423d7af45e499abf167 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 9 Sep 2025 14:49:12 +1000 Subject: [PATCH 17/47] rename function to `createNode` --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 5e1cafe..3fedbb3 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -181,7 +181,7 @@ types: ```yaml functions: - create: + createNode: description: "Initialise a Waku node instance" parameters: - name: config From f1225e1cca865a178457dd9aff8c46382b6567f3 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Tue, 9 Sep 2025 19:55:56 +1000 Subject: [PATCH 18/47] Add web3 RPC API URLs --- standards/application/waku-api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 3fedbb3..99035c5 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -174,7 +174,9 @@ types: epoch_size_sec: type: uint description: "The epoch size to use for RLN, in seconds" - # Note that the limit for + rpc_api_urls: + type: array + description: "Web3 RPC API URLs" ``` #### Function definitions From b2b81b4c2ce929b4725c99e2bb60ecae249dcc38 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 10 Sep 2025 14:02:35 +1000 Subject: [PATCH 19/47] remove multiaddr type --- standards/application/waku-api.md | 1 - 1 file changed, 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 99035c5..2b969ad 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -52,7 +52,6 @@ An alternative would be to choose a programming language. However, such choice m - `struct`: object and other nested types. - `option`: a value that can be set or left null. - `array`: iterable object containing values of all the same type. - - `multiaddr`: a libp2p multiaddress; may be an object or a string, most idiomatic approach depending on the language. - `result`: an enum type that either contain a return value (success), or an error (failure); The error is left to the implementor. - `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language. - Usage of `result` is RECOMMENDED, usage of exceptions is NOT RECOMMENDED, no matter the language. From f68707ea86b23d807683482703e205a7c6705594 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 10 Sep 2025 14:15:23 +1000 Subject: [PATCH 20/47] default network message validation --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 2b969ad..045a5b6 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -207,7 +207,7 @@ values: auto_sharding_config: fields: numShardsInCluster: 8 - message_validation: + message_validation: TheWakuNetworkMessageValidation TheWakuNetworkMessageValidation: type: MessageValidation From cf84d3d4a3d6a8486839a76e352191db3e9a3cc0 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 10 Sep 2025 14:19:52 +1000 Subject: [PATCH 21/47] Move eth rpc endpoints to top --- standards/application/waku-api.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 045a5b6..1120143 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -112,6 +112,9 @@ types: # Until further dogfooding, assuming default false, usage of SDS should be preferred default: false description: "No-payload store hash queries are made to confirm whether outbound messages were received by remote store node." + eth_rpc_endpoints: + type: array + description: "Eth/Web3 RPC endpoint URLs" NetworkConfig: type: struct @@ -173,9 +176,6 @@ types: epoch_size_sec: type: uint description: "The epoch size to use for RLN, in seconds" - rpc_api_urls: - type: array - description: "Web3 RPC API URLs" ``` #### Function definitions From a3c37c1be1db7123472014658eac1455cae792c3 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 10 Sep 2025 15:32:06 +1000 Subject: [PATCH 22/47] if a default is possible it means values are optional --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 1120143..9206df3 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -105,7 +105,7 @@ types: constraints: [ "edge", "relay" ] description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." network_config: - type: NetworkConfig + type: option default: TheWakuNetworkPreset store_confirmation: type: bool From 0004fff78083a24a4e1f939775935470e03f92eb Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 10 Sep 2025 15:33:44 +1000 Subject: [PATCH 23/47] if a default is possible it means values are optional --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 9206df3..04fb2c7 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -108,7 +108,7 @@ types: type: option default: TheWakuNetworkPreset store_confirmation: - type: bool + type: option # Until further dogfooding, assuming default false, usage of SDS should be preferred default: false description: "No-payload store hash queries are made to confirm whether outbound messages were received by remote store node." From 6c01164f922f4829592fa96e4226209718751148 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 11 Sep 2025 15:51:13 +1000 Subject: [PATCH 24/47] only auto sharding, remove mix up on option --- standards/application/waku-api.md | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 04fb2c7..d5f1339 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -46,11 +46,10 @@ An alternative would be to choose a programming language. However, such choice m ### Primitive types and general guidelines -- No `default` means that the value is mandatory +- No `default` means that the value is mandatory, meaning a `default` value implies an optional parameter. - Primitive types are `string`, `int`, `bool`, `enum` and `uint` - Complex pre-defined types are: - `struct`: object and other nested types. - - `option`: a value that can be set or left null. - `array`: iterable object containing values of all the same type. - `result`: an enum type that either contain a return value (success), or an error (failure); The error is left to the implementor. - `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language. @@ -101,14 +100,14 @@ types: fields: mode: type: string - # For now, a mode **must** be passed by the developer constraints: [ "edge", "relay" ] + default: *platform dependent* description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." network_config: - type: option + type: NetworkConfig default: TheWakuNetworkPreset store_confirmation: - type: option + type: bool # Until further dogfooding, assuming default false, usage of SDS should be preferred default: false description: "No-payload store hash queries are made to confirm whether outbound messages were received by remote store node." @@ -123,20 +122,14 @@ types: type: array # Default means the node does not bootstrap, it is not ideal but practical for local development # TODO: get feedback - default: "" description: "Bootstrap nodes, entree and multiaddr formats are accepted." static_store_nodes: type: array - default: [ ] description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." cluster_id: type: uint - sharding_mode: - constraints: [ "auto", "static" ] - # If the default config for TWN is not used, then we still provide a sharding default - default: "auto" auto_sharding_config: - type: option + type: AutoShardingConfig default: DefaultAutoShardingConfig description: "The auto-sharding config, if sharding mode is `auto`" message_validation: @@ -160,7 +153,7 @@ types: description: "The maximum accepted message size in Bytes" # For now, RLN is the only message validation available rln_config: - type: option + type: RlnConfig # If the default config for TWN is not used, then we do not apply RLN default: none @@ -203,7 +196,6 @@ values: bootstrap_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] static_store_nodes: #TODO: enter sandbox store nodes multiaddr cluster_id: 1 - sharding_mode: "auto" auto_sharding_config: fields: numShardsInCluster: 8 From 40450003ac8b9fcbfe12f66bbb2470feec838884 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 12 Sep 2025 13:40:54 +1000 Subject: [PATCH 25/47] use "waku config" --- standards/application/waku-api.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index d5f1339..79b19cf 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -95,7 +95,7 @@ types: type: struct description: "A Waku node instance." - Config: + NodeConfig: type: struct fields: mode: @@ -103,8 +103,8 @@ types: constraints: [ "edge", "relay" ] default: *platform dependent* description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." - network_config: - type: NetworkConfig + waku_config: + type: WakuConfig default: TheWakuNetworkPreset store_confirmation: type: bool @@ -115,7 +115,7 @@ types: type: array description: "Eth/Web3 RPC endpoint URLs" - NetworkConfig: + WakuConfig: type: struct fields: boostrap_nodes: @@ -191,7 +191,7 @@ functions: values: TheWakuNetworkPreset: - type: NetworkConfig + type: WakuConfig fields: bootstrap_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] static_store_nodes: #TODO: enter sandbox store nodes multiaddr From f834dc43462aae00ca2c9e5800c01995b7957516 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 12 Sep 2025 17:40:23 +1000 Subject: [PATCH 26/47] by default no static store nodes are passed --- standards/application/waku-api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 79b19cf..647dafb 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -125,6 +125,7 @@ types: description: "Bootstrap nodes, entree and multiaddr formats are accepted." static_store_nodes: type: array + default: [] description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." cluster_id: type: uint From 5bb37c24dc11c497e7dc7db1d2e813097c72d471 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 15 Sep 2025 15:31:50 +1000 Subject: [PATCH 27/47] update networking section --- standards/application/waku-api.md | 41 ++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 647dafb..0a5dcac 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -101,7 +101,7 @@ types: mode: type: string constraints: [ "edge", "relay" ] - default: *platform dependent* + default: "_platform dependent_" description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." waku_config: type: WakuConfig @@ -111,6 +111,9 @@ types: # Until further dogfooding, assuming default false, usage of SDS should be preferred default: false description: "No-payload store hash queries are made to confirm whether outbound messages were received by remote store node." + networking_config: + type: NetworkConfig + default: DefaultNetworkingConfig eth_rpc_endpoints: type: array description: "Eth/Web3 RPC endpoint URLs" @@ -118,11 +121,11 @@ types: WakuConfig: type: struct fields: - boostrap_nodes: + remote_nodes: type: array - # Default means the node does not bootstrap, it is not ideal but practical for local development - # TODO: get feedback - description: "Bootstrap nodes, entree and multiaddr formats are accepted." + # Default means the node does not bootstrap, e.g. for local development + default: [] + description: "Nodes to connect to; used for discovery bootstrapping and quick connectivity. entree and multiaddr formats are accepted." static_store_nodes: type: array default: [] @@ -138,6 +141,25 @@ types: # If the default config for TWN is not used, then we still provide a message validation default default: DefaultMessageValidation + NetworkingConfig: + type: string + fields: + listen_address: + # Is not applicable in some environments such as browser. + type: string + default: "0.0.0.0" + description: "The network IP address on which libp2p and discv5 listen for inbound connections" + p2p_tcp_port: + # Is not applicable in non-TCP environments such as browser + type: uint + default: 60000 + description: "The TCP port used for libp2p, relay, aka, general p2p message routing." + discv5_udp_port: + # Is not applicable in non-UDP environments such as browser + type: uint + default: 9000 + description: "The UDP port used for discv5." + AutoShardingConfig: type: struct fields: @@ -191,10 +213,17 @@ functions: ```yaml values: + DefaultNetworkingConfig: + type: NetworkConfig + fields: + listen_address: "0.0.0.0" + p2p_tcp_port: 60000 + discv5_udp_port: 9000 + TheWakuNetworkPreset: type: WakuConfig fields: - bootstrap_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] + remote_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] static_store_nodes: #TODO: enter sandbox store nodes multiaddr cluster_id: 1 auto_sharding_config: From a0700f07309b061f1eb0de1553e1e665d735aadf Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 13:35:05 +1000 Subject: [PATCH 28/47] results may return void --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 0a5dcac..5cc243e 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -51,7 +51,7 @@ An alternative would be to choose a programming language. However, such choice m - Complex pre-defined types are: - `struct`: object and other nested types. - `array`: iterable object containing values of all the same type. - - `result`: an enum type that either contain a return value (success), or an error (failure); The error is left to the implementor. + - `result`: an enum type that either contains a value or void (success), or an error (failure); The error is left to the implementor. - `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language. - Usage of `result` is RECOMMENDED, usage of exceptions is NOT RECOMMENDED, no matter the language. From 6de55db122b43621fc5784efc39ceab971571c18 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 13:42:28 +1000 Subject: [PATCH 29/47] change confirmation to store/filter --- standards/application/waku-api.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 5cc243e..426707f 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -106,11 +106,12 @@ types: waku_config: type: WakuConfig default: TheWakuNetworkPreset - store_confirmation: - type: bool + message_confirmation: + type: array + constraints: [ "store", "filter" ] # Until further dogfooding, assuming default false, usage of SDS should be preferred - default: false - description: "No-payload store hash queries are made to confirm whether outbound messages were received by remote store node." + default: [ "none" ] + description: "Whether to apply peer-to-peer reliability strategies to confirm that outgoing message have been received by other peers." networking_config: type: NetworkConfig default: DefaultNetworkingConfig From 036fe615ed9e99c454943d209ca966fd781a8ade Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 13:45:21 +1000 Subject: [PATCH 30/47] change to seed nodes --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 426707f..22e11eb 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -122,7 +122,7 @@ types: WakuConfig: type: struct fields: - remote_nodes: + seed_nodes: type: array # Default means the node does not bootstrap, e.g. for local development default: [] From 4ab882189d1e37543a1df471fa9301602a8e9d0d Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 13:46:35 +1000 Subject: [PATCH 31/47] change address to ipv4 So a different fields can be provided for ipv6 when supported --- standards/application/waku-api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 22e11eb..fc67bf4 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -145,7 +145,7 @@ types: NetworkingConfig: type: string fields: - listen_address: + listen_ipv4: # Is not applicable in some environments such as browser. type: string default: "0.0.0.0" From fa5bf8cc4cebc155ec2ffa4a12d36c19703e7c64 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 13:48:40 +1000 Subject: [PATCH 32/47] finish sentence --- standards/application/waku-api.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index fc67bf4..3b57dc0 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -171,10 +171,10 @@ types: MessageValidation: type: struct fields: - max_message_size_bytes: - type: uint - default: 153600 # 150 KiB - description: "The maximum accepted message size in Bytes" + max_message_size: + type: string + default: "150 KiB" + description: "Maximum message size. Accepted units: KiB, KB, and B. e.g. 1024KiB; 1500 B; etc." # For now, RLN is the only message validation available rln_config: type: RlnConfig @@ -288,13 +288,14 @@ whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restr ## The Validation API -[RLN Relay]() is currently the primary message validation mechanism in place. +[WAKU2-RLN-RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/17/rln-relay.md) is currently the primary message validation mechanism in place. Work is scheduled to specify a validate API to enable plug-in validation. -As part of this API, it will be expected that an validation object can be passed, +As part of this API, it will be expected that a validation object can be passed, that would contain all validation parameters including RLN. -In the time being, we +In the time being, parameters specific to RLN are accepted for the message validation. +RLN can also be disabled. ## Security/Privacy Considerations From 9d5191f75f5fb65bd17d78e602129aac3000c854 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 13:50:15 +1000 Subject: [PATCH 33/47] static store default value --- standards/application/waku-api.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 3b57dc0..a390ec3 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -225,7 +225,8 @@ values: type: WakuConfig fields: remote_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] - static_store_nodes: #TODO: enter sandbox store nodes multiaddr + # On TWN, we encourage the usage of discovered store nodes + static_store_nodes: [] cluster_id: 1 auto_sharding_config: fields: From 616306e3780c58eed955e16e6ca89e12b5382228 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 13:53:04 +1000 Subject: [PATCH 34/47] Mention trait approach for ETH RPC After feedback from @osmaczko --- standards/application/waku-api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index a390ec3..b8831e2 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -115,6 +115,7 @@ types: networking_config: type: NetworkConfig default: DefaultNetworkingConfig + # TODO: to be reviewed, developers have expressed that accepting an object implementing specific traits is useful. eth_rpc_endpoints: type: array description: "Eth/Web3 RPC endpoint URLs" From 388c25714fd3c81d80d7a6ec279158dd30f17bdd Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Thu, 25 Sep 2025 14:03:10 +1000 Subject: [PATCH 35/47] add toc --- standards/application/waku-api.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index b8831e2..cab59c3 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -12,7 +12,26 @@ contributors: ## Table of contents -TODO + + * [Table of contents](#table-of-contents) + * [Abstract](#abstract) + * [Motivation](#motivation) + * [Syntax](#syntax) + * [API design](#api-design) + * [IDL](#idl) + * [Primitive types and general guidelines](#primitive-types-and-general-guidelines) + * [Language mappings](#language-mappings) + * [Application](#application) + * [The Waku API](#the-waku-api) + * [Initialise Waku node](#initialise-waku-node) + * [Type definitions](#type-definitions) + * [Function definitions](#function-definitions) + * [Predefined values](#predefined-values) + * [Extended definitions](#extended-definitions) + * [The Validation API](#the-validation-api) + * [Security/Privacy Considerations](#securityprivacy-considerations) + * [Copyright](#copyright) + ## Abstract From ad4fb96e7dfd9505a35d0a4b4b04675e447ac3f5 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 11:32:23 +1000 Subject: [PATCH 36/47] prefer `entry_nodes` --- standards/application/waku-api.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index cab59c3..b6714d0 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -142,7 +142,7 @@ types: WakuConfig: type: struct fields: - seed_nodes: + entry_nodes: type: array # Default means the node does not bootstrap, e.g. for local development default: [] @@ -244,7 +244,7 @@ values: TheWakuNetworkPreset: type: WakuConfig fields: - remote_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] + entry_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] # On TWN, we encourage the usage of discovered store nodes static_store_nodes: [] cluster_id: 1 From 0c64eaac5840ba2598e0b240772310d49e3eb786 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 11:39:49 +1000 Subject: [PATCH 37/47] integrate feedback --- standards/application/waku-api.md | 34 ++++++++++++++----------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index b6714d0..2f8fd43 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -46,7 +46,7 @@ Application developers SHOULD use it to access capabilities for peer discovery, The accessibility of Waku protocols is capped by the accessibility of their implementations, and hence API. This RFC enables a concerted effort to draft an API that is simple and accessible, and provides an opinion on sane defaults. -The API defined in this document is an opinionated-by-purpose method to use the more agnostic [WAKU2]() protocols. +The API defined in this document is an opinionated-by-purpose method to use the more agnostic [WAKU2](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/10/waku2.md) protocols. ## Syntax @@ -68,7 +68,7 @@ An alternative would be to choose a programming language. However, such choice m - No `default` means that the value is mandatory, meaning a `default` value implies an optional parameter. - Primitive types are `string`, `int`, `bool`, `enum` and `uint` - Complex pre-defined types are: - - `struct`: object and other nested types. + - `object`: object and other nested types. - `array`: iterable object containing values of all the same type. - `result`: an enum type that either contains a value or void (success), or an error (failure); The error is left to the implementor. - `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language. @@ -111,11 +111,11 @@ description: "Waku: a private and censorship-resistant message routing library." ```yaml types: WakuNode: - type: struct + type: object description: "A Waku node instance." NodeConfig: - type: struct + type: object fields: mode: type: string @@ -128,7 +128,6 @@ types: message_confirmation: type: array constraints: [ "store", "filter" ] - # Until further dogfooding, assuming default false, usage of SDS should be preferred default: [ "none" ] description: "Whether to apply peer-to-peer reliability strategies to confirm that outgoing message have been received by other peers." networking_config: @@ -140,17 +139,17 @@ types: description: "Eth/Web3 RPC endpoint URLs" WakuConfig: - type: struct + type: object fields: entry_nodes: type: array - # Default means the node does not bootstrap, e.g. for local development default: [] - description: "Nodes to connect to; used for discovery bootstrapping and quick connectivity. entree and multiaddr formats are accepted." + description: "Nodes to connect to; used for discovery bootstrapping and quick connectivity. entree and multiaddr formats are accepted. If not provided, node does not bootstrap to the network (local dev)." static_store_nodes: type: array default: [] - description: "Only the passed nodes are used for store queries, discovered store nodes are discarded." + # TODO: confirm behaviour at implementation time. + description: "The passed nodes are prioritised for store queries." cluster_id: type: uint auto_sharding_config: @@ -159,37 +158,34 @@ types: description: "The auto-sharding config, if sharding mode is `auto`" message_validation: type: MessageValidation - # If the default config for TWN is not used, then we still provide a message validation default + description: "If the default config for TWN is not used, then we still provide default configuration for message validation." default: DefaultMessageValidation NetworkingConfig: type: string fields: listen_ipv4: - # Is not applicable in some environments such as browser. type: string default: "0.0.0.0" - description: "The network IP address on which libp2p and discv5 listen for inbound connections" + description: "The network IP address on which libp2p and discv5 listen for inbound connections. Not applicable for some environments such as the browser." p2p_tcp_port: - # Is not applicable in non-TCP environments such as browser type: uint default: 60000 - description: "The TCP port used for libp2p, relay, aka, general p2p message routing." + description: "The TCP port used for libp2p, relay, aka, general p2p message routing. Not applicable for some environments such as the browser." discv5_udp_port: - # Is not applicable in non-UDP environments such as browser type: uint default: 9000 - description: "The UDP port used for discv5." + description: "The UDP port used for discv5. Not applicable for some environments such as the browser." AutoShardingConfig: - type: struct + type: object fields: num_shards_in_cluster: type: uint description: "The number of shards in the configured cluster; this is a globally agreed value for each cluster." MessageValidation: - type: struct + type: object fields: max_message_size: type: string @@ -202,7 +198,7 @@ types: default: none RlnConfig: - type: struct + type: object fields: contract_address: type: string From 82181bf2c1c4aa1f7efa2cddc0f6722251aac13d Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 15:47:47 +1000 Subject: [PATCH 38/47] fix inconsistencies --- standards/application/waku-api.md | 35 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 2f8fd43..91c8381 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -120,7 +120,7 @@ types: mode: type: string constraints: [ "edge", "relay" ] - default: "_platform dependent_" + default: "relay" # "edge" for mobile and browser devices. description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." waku_config: type: WakuConfig @@ -128,15 +128,14 @@ types: message_confirmation: type: array constraints: [ "store", "filter" ] - default: [ "none" ] + default: [] description: "Whether to apply peer-to-peer reliability strategies to confirm that outgoing message have been received by other peers." networking_config: type: NetworkConfig - default: DefaultNetworkingConfig - # TODO: to be reviewed, developers have expressed that accepting an object implementing specific traits is useful. + default: DefaultNetworkingConfig eth_rpc_endpoints: type: array - description: "Eth/Web3 RPC endpoint URLs" + description: "Eth/Web3 RPC endpoint URLs, required for RLN message validation. Accepting an object for ETH RPC will be added at a later stage. Fail-over available by passing multiple URLs" WakuConfig: type: object @@ -144,7 +143,7 @@ types: entry_nodes: type: array default: [] - description: "Nodes to connect to; used for discovery bootstrapping and quick connectivity. entree and multiaddr formats are accepted. If not provided, node does not bootstrap to the network (local dev)." + description: "Nodes to connect to; used for discovery bootstrapping and quick connectivity. enrtree and multiaddr formats are accepted. If not provided, node does not bootstrap to the network (local dev)." static_store_nodes: type: array default: [] @@ -162,7 +161,7 @@ types: default: DefaultMessageValidation NetworkingConfig: - type: string + type: object fields: listen_ipv4: type: string @@ -218,8 +217,8 @@ functions: createNode: description: "Initialise a Waku node instance" parameters: - - name: config - type: Config + - name: nodeConfig + type: NodeConfig description: "The Waku node configuration." returns: type: result @@ -233,7 +232,7 @@ values: DefaultNetworkingConfig: type: NetworkConfig fields: - listen_address: "0.0.0.0" + listen_ipv4: "0.0.0.0" p2p_tcp_port: 60000 discv5_udp_port: 9000 @@ -246,13 +245,13 @@ values: cluster_id: 1 auto_sharding_config: fields: - numShardsInCluster: 8 + num_shards_in_cluster: 8 message_validation: TheWakuNetworkMessageValidation TheWakuNetworkMessageValidation: type: MessageValidation fields: - max_message_bytes_uint: 153600 # 150 KiB + max_message_size: "150 KiB" rln_config: fields: contract_address: "0xB9cd878C90E49F797B4431fBF4fb333108CB90e6" @@ -270,12 +269,14 @@ values: DefaultMessageValidation: type: MessageValidation fields: - max_message_bytes_uint: 153600 # 150 KiB + max_message_size: "150 KiB" rln_config: none ``` #### Extended definitions +**`mode`**: + If the `mode` set is `edge`, the initialised `WakuNode` MUST mount: - [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as client @@ -303,6 +304,14 @@ And must use mount and use the following protocols to discover peers: `edge` mode SHOULD be used if node functions in resource restricted environment, whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restrictions. +**`message_confirmation`**: + +As defined in [P2P-RELIABILITY](/standards/application/p2p-reliability.md). +Proceed with confirmation on whether outgoing messages were received by other nodes in the network. + +- `store`: [Store-based reliability for publishing is enabled](/standards/application/p2p-reliability.md#1-store-based-reliability-for-publishing) +- `filter`: [Retransmit on possible message loss detection](/standards/application/p2p-reliability.md#4-retransmit-on-possible-message-loss-detection) by installing filter subscription(s) matching the content topic(s) used for publishing. + ## The Validation API [WAKU2-RLN-RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/17/rln-relay.md) is currently the primary message validation mechanism in place. From 09e3ade1098999243376f2a0ef6742e7daa95ecb Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 15:53:59 +1000 Subject: [PATCH 39/47] clarify scope --- standards/application/waku-api.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 91c8381..f581211 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -41,6 +41,8 @@ and for consumers to use as a single entry point to its functionalities. This API defines the RECOMMENDED interface for leveraging Waku protocols to send and receive messages. Application developers SHOULD use it to access capabilities for peer discovery, message routing, and peer-to-peer reliability. +TODO: This spec must be further extended to include connection health inspection, message sending, subscription and store hash queries. + ## Motivation The accessibility of Waku protocols is capped by the accessibility of their implementations, and hence API. @@ -135,7 +137,7 @@ types: default: DefaultNetworkingConfig eth_rpc_endpoints: type: array - description: "Eth/Web3 RPC endpoint URLs, required for RLN message validation. Accepting an object for ETH RPC will be added at a later stage. Fail-over available by passing multiple URLs" + description: "Eth/Web3 RPC endpoint URLs, onlyrequired for RLN message validation. Accepting an object for ETH RPC will be added at a later stage. Fail-over available by passing multiple URLs" WakuConfig: type: object From 34b94435d529787894a06da997587ce11fed3015 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 15:56:10 +1000 Subject: [PATCH 40/47] raw spec --- standards/application/waku-api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index f581211..8e8bba8 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -2,6 +2,7 @@ title: WAKU-API name: Waku API definition category: Standards Track +status: raw tags: [reliability, application, api, protocol composition] editor: Oleksandr Kozlov contributors: From 214ee738ea09488de8ee2e2bea2ae955fd95ba0f Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 16:00:59 +1000 Subject: [PATCH 41/47] note on errors --- standards/application/waku-api.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 8e8bba8..f8806d3 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -77,6 +77,8 @@ An alternative would be to choose a programming language. However, such choice m - `error`: Left to the implementor on whether `error` types are `string` or `object` in the given language. - Usage of `result` is RECOMMENDED, usage of exceptions is NOT RECOMMENDED, no matter the language. +TODO: Review whether to specify categories of errors. + ### Language mappings How the API definition should be translated to specific languages. @@ -129,16 +131,15 @@ types: type: WakuConfig default: TheWakuNetworkPreset message_confirmation: - type: array - constraints: [ "store", "filter" ] - default: [] + type: bool + default: true description: "Whether to apply peer-to-peer reliability strategies to confirm that outgoing message have been received by other peers." networking_config: type: NetworkConfig default: DefaultNetworkingConfig eth_rpc_endpoints: type: array - description: "Eth/Web3 RPC endpoint URLs, onlyrequired for RLN message validation. Accepting an object for ETH RPC will be added at a later stage. Fail-over available by passing multiple URLs" + description: "Eth/Web3 RPC endpoint URLs, only required when RLN is used for message validation; fail-over available by passing multiple URLs. Accepting an object for ETH RPC will be added at a later stage." WakuConfig: type: object @@ -312,8 +313,8 @@ whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restr As defined in [P2P-RELIABILITY](/standards/application/p2p-reliability.md). Proceed with confirmation on whether outgoing messages were received by other nodes in the network. -- `store`: [Store-based reliability for publishing is enabled](/standards/application/p2p-reliability.md#1-store-based-reliability-for-publishing) -- `filter`: [Retransmit on possible message loss detection](/standards/application/p2p-reliability.md#4-retransmit-on-possible-message-loss-detection) by installing filter subscription(s) matching the content topic(s) used for publishing. +When set to true, [Store-based reliability for publishing](/standards/application/p2p-reliability.md#1-store-based-reliability-for-publishing) SHOULD be enabled. +In `edge` `mode`, [Retransmit on possible message loss detection](/standards/application/p2p-reliability.md#4-retransmit-on-possible-message-loss-detection) by installing filter subscription(s) matching the content topic(s) used for publishing, MAY be enabled. ## The Validation API From 7748d6a9bac2c6fdc7cbb66121221873c5f8a3f0 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 16:05:24 +1000 Subject: [PATCH 42/47] add metadata --- standards/application/waku-api.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index f8806d3..a57d26d 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -286,6 +286,7 @@ If the `mode` set is `edge`, the initialised `WakuNode` MUST mount: - [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as client - [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) as client - [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as client +- [METADATA](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/66/metadata.md) as client And must use mount and use the following protocols to discover peers: @@ -298,6 +299,7 @@ If the `mode` set is `relay`, the initialised `WakuNode` MUST mount: - [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) as service node - [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) as service node - [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as client +- [METADATA](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/66/metadata.md) as client and service node And must use mount and use the following protocols to discover peers: From b9454e3d97cbb19b3861a3d679dc86b40202984b Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 16:08:15 +1000 Subject: [PATCH 43/47] change "relay" to "sovereign" --- standards/application/waku-api.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index a57d26d..45f3e98 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -99,7 +99,7 @@ language_mappings: ### Application -This API is designed for generic use and ease across all programming languages, for `edge` and `relay` type nodes. +This API is designed for generic use and ease across all programming languages, for `edge` and `sovereign` type nodes. ## The Waku API @@ -124,8 +124,8 @@ types: fields: mode: type: string - constraints: [ "edge", "relay" ] - default: "relay" # "edge" for mobile and browser devices. + constraints: [ "edge", "sovereign" ] + default: "sovereign" # "edge" for mobile and browser devices. description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." waku_config: type: WakuConfig @@ -174,7 +174,7 @@ types: p2p_tcp_port: type: uint default: 60000 - description: "The TCP port used for libp2p, relay, aka, general p2p message routing. Not applicable for some environments such as the browser." + description: "The TCP port used for libp2p, relay, etc aka, general p2p message routing. Not applicable for some environments such as the browser." discv5_udp_port: type: uint default: 9000 @@ -292,7 +292,7 @@ And must use mount and use the following protocols to discover peers: - [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) -If the `mode` set is `relay`, the initialised `WakuNode` MUST mount: +If the `mode` set is `sovereign`, the initialised `WakuNode` MUST mount: - [RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/11/relay.md) - [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as service node @@ -308,7 +308,7 @@ And must use mount and use the following protocols to discover peers: - [RENDEZVOUS](https://github.com/waku-org/specs/blob/master/standards/core/rendezvous.md) `edge` mode SHOULD be used if node functions in resource restricted environment, -whereas `relay` SHOULD be used if node has no strong hardware or bandwidth restrictions. +whereas `sovereign` SHOULD be used if node has no strong hardware or bandwidth restrictions. **`message_confirmation`**: From 6a421f59557a0c7ca050c029176c5dc1ea52180d Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Fri, 26 Sep 2025 23:05:58 +1000 Subject: [PATCH 44/47] change "sovereign" to "core" --- standards/application/waku-api.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 45f3e98..46c13a4 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -99,7 +99,7 @@ language_mappings: ### Application -This API is designed for generic use and ease across all programming languages, for `edge` and `sovereign` type nodes. +This API is designed for generic use and ease across all programming languages, for `edge` and `core` type nodes. ## The Waku API @@ -124,9 +124,9 @@ types: fields: mode: type: string - constraints: [ "edge", "sovereign" ] - default: "sovereign" # "edge" for mobile and browser devices. - description: "The mode of operation of the Waku node. Core protocols used by the node are inferred from this mode." + constraints: [ "edge", "core" ] + default: "core" # "edge" for mobile and browser devices. + description: "The mode of operation of the Waku node; 'edge' of the network: relies on other nodes for message routing; 'core' of the network: fully participate to message routing." waku_config: type: WakuConfig default: TheWakuNetworkPreset @@ -292,7 +292,7 @@ And must use mount and use the following protocols to discover peers: - [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) -If the `mode` set is `sovereign`, the initialised `WakuNode` MUST mount: +If the `mode` set is `core`, the initialised `WakuNode` MUST mount: - [RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/11/relay.md) - [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as service node @@ -308,7 +308,7 @@ And must use mount and use the following protocols to discover peers: - [RENDEZVOUS](https://github.com/waku-org/specs/blob/master/standards/core/rendezvous.md) `edge` mode SHOULD be used if node functions in resource restricted environment, -whereas `sovereign` SHOULD be used if node has no strong hardware or bandwidth restrictions. +whereas `core` SHOULD be used if node has no strong hardware or bandwidth restrictions. **`message_confirmation`**: From 6a5a3d21f273e22985d87907c004eaa9a85efcd8 Mon Sep 17 00:00:00 2001 From: Jazz Turner-Baggs <473256+jazzz@users.noreply.github.com> Date: Fri, 26 Sep 2025 19:02:14 -0700 Subject: [PATCH 45/47] chore: add html filtering to aspell (#84) --- .spellcheck.yml | 7 +++++-- .wordlist.txt | 28 ++++++++++++++-------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/.spellcheck.yml b/.spellcheck.yml index 33142a5..0e94ad8 100644 --- a/.spellcheck.yml +++ b/.spellcheck.yml @@ -5,13 +5,16 @@ matrix: expect_match: false # false -> supress errors if no markdown files were edited aspell: lang: en + mode: none + add-filter: + - url dictionary: wordlists: - .wordlist.txt - encoding: utf-8 pipeline: - pyspelling.filters.markdown + - pyspelling.filters.html: + comments: false - pyspelling.filters.text default_encoding: utf-8 suggest: true - diff --git a/.wordlist.txt b/.wordlist.txt index 4d6c057..8e754de 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -1,23 +1,23 @@ ALLOC -IANA -SHARDING -WAKU -Waku -danielkaiser creativecommons -github -GITHUB -https -iana -md -rfc -RFC -www +danielkaiser DHT DoS -GossipSub +github +GITHUB gossipsub +GossipSub +https +iana +IANA libp2p +md pubsub +rfc +RFC +SHARDING subnets +Waku +WAKU +www ZXCV \ No newline at end of file From 5cd0080f320736b42df2d7d7df1014668db133f1 Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Mon, 29 Sep 2025 21:15:32 +1000 Subject: [PATCH 46/47] remove message confirmation --- standards/application/waku-api.md | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 46c13a4..6cfceb5 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -130,10 +130,6 @@ types: waku_config: type: WakuConfig default: TheWakuNetworkPreset - message_confirmation: - type: bool - default: true - description: "Whether to apply peer-to-peer reliability strategies to confirm that outgoing message have been received by other peers." networking_config: type: NetworkConfig default: DefaultNetworkingConfig @@ -281,18 +277,16 @@ values: **`mode`**: -If the `mode` set is `edge`, the initialised `WakuNode` MUST mount: +If the `mode` set is `edge`, the initialised `WakuNode` SHOULD use: - [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as client - [FILTER](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/12/filter.md) as client - [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as client - [METADATA](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/66/metadata.md) as client +- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) as client +- [P2P-RELIABILITY](/standards/application/p2p-reliability.md) -And must use mount and use the following protocols to discover peers: - -- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) - -If the `mode` set is `core`, the initialised `WakuNode` MUST mount: +If the `mode` set is `core`, the initialised `WakuNode` SHOULD use: - [RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/11/relay.md) - [LIGHTPUSH](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/19/lightpush.md) as service node @@ -300,24 +294,14 @@ If the `mode` set is `core`, the initialised `WakuNode` MUST mount: - [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) as service node - [STORE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/13/store.md) as client - [METADATA](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/66/metadata.md) as client and service node - -And must use mount and use the following protocols to discover peers: - +- [P2P-RELIABILITY](/standards/application/p2p-reliability.md) - [DISCV5](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/33/discv5.md) -- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) -- [RENDEZVOUS](https://github.com/waku-org/specs/blob/master/standards/core/rendezvous.md) +- [PEER-EXCHANGE](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/34/peer-exchange.md) as client and service node +- [RENDEZVOUS](https://github.com/waku-org/specs/blob/master/standards/core/rendezvous.md) as client and service node `edge` mode SHOULD be used if node functions in resource restricted environment, whereas `core` SHOULD be used if node has no strong hardware or bandwidth restrictions. -**`message_confirmation`**: - -As defined in [P2P-RELIABILITY](/standards/application/p2p-reliability.md). -Proceed with confirmation on whether outgoing messages were received by other nodes in the network. - -When set to true, [Store-based reliability for publishing](/standards/application/p2p-reliability.md#1-store-based-reliability-for-publishing) SHOULD be enabled. -In `edge` `mode`, [Retransmit on possible message loss detection](/standards/application/p2p-reliability.md#4-retransmit-on-possible-message-loss-detection) by installing filter subscription(s) matching the content topic(s) used for publishing, MAY be enabled. - ## The Validation API [WAKU2-RLN-RELAY](https://github.com/vacp2p/rfc-index/blob/main/waku/standards/core/17/rln-relay.md) is currently the primary message validation mechanism in place. From e42629eb9c85246255248c33d1cd8ab38a8a1d1a Mon Sep 17 00:00:00 2001 From: fryorcraken Date: Wed, 1 Oct 2025 22:20:24 +1000 Subject: [PATCH 47/47] Rename Waku API's "Waku Config" to "Protocols" Config Make it clearer that with this config, we are configuring the Waku protocols, in contrast to other parameters which are more executable related. Related to https://github.com/waku-org/nwaku/issues/3493 --- standards/application/waku-api.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/standards/application/waku-api.md b/standards/application/waku-api.md index 6cfceb5..03d4bf6 100644 --- a/standards/application/waku-api.md +++ b/standards/application/waku-api.md @@ -127,8 +127,8 @@ types: constraints: [ "edge", "core" ] default: "core" # "edge" for mobile and browser devices. description: "The mode of operation of the Waku node; 'edge' of the network: relies on other nodes for message routing; 'core' of the network: fully participate to message routing." - waku_config: - type: WakuConfig + protocols_config: + type: ProtocolsConfig default: TheWakuNetworkPreset networking_config: type: NetworkConfig @@ -137,7 +137,7 @@ types: type: array description: "Eth/Web3 RPC endpoint URLs, only required when RLN is used for message validation; fail-over available by passing multiple URLs. Accepting an object for ETH RPC will be added at a later stage." - WakuConfig: + ProtocolsConfig: type: object fields: entry_nodes: @@ -237,7 +237,7 @@ values: discv5_udp_port: 9000 TheWakuNetworkPreset: - type: WakuConfig + type: ProtocolsConfig fields: entry_nodes: [ "enrtree://AIRVQ5DDA4FFWLRBCHJWUWOO6X6S4ZTZ5B667LQ6AJU6PEYDLRD5O@sandbox.waku.nodes.status.im" ] # On TWN, we encourage the usage of discovered store nodes