From aaf4c5e73a7702299b7dd27593ba187ec6560270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oskar=20Thor=C3=A9n?= Date: Thu, 5 Dec 2019 22:49:31 +0800 Subject: [PATCH] Waku mode (#61) * Waku topic-interest mode WIP * Waku topic interest code * add recommendations for clients * Update waku.md Co-Authored-By: kdeme * adjust abstract * n=1000 * fmt --- waku.md | 47 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/waku.md b/waku.md index 098f059c..320645f9 100644 --- a/waku.md +++ b/waku.md @@ -1,6 +1,6 @@ # Waku Whisper Specification -> Version 0.1.1 (Initial release) +> Version 0.1.2 (Initial release) > > Authors: Oskar Thorén oskar@status.im, Dean Eigenmann dean@status.im @@ -33,6 +33,7 @@ - [Censorship resistance](#censorship-resistance) - [Appendix B: Implementation Notes](#appendix-b-implementation-notes) - [Implementation Matrix](#implementation-matrix) + - [Recommendations for clients](#recommendations-for-clients) - [Footnotes](#footnotes) - [Changelog](#changelog) - [Differences between shh/6 waku/0](#differences-between-shh6-waku0) @@ -41,7 +42,7 @@ ## Abstract -This specification describes the format of Waku messages within the ÐΞVp2p Wire Protocol. This spec substitutes [EIP- 627](https://eips.ethereum.org/EIPS/eip-627). Waku is a fork of the original Whisper protocol that enables better usability for resource restricted devices, such as mostly-offline bandwidth-constrained smartphones. It does this primarily through (a) light node support and (b) historic messages (with a mailserver). Additionally, other experimental features for better scalability and DDoS resistance are under development and will be part of future versions. +This specification describes the format of Waku messages within the ÐΞVp2p Wire Protocol. This spec substitutes [EIP-627](https://eips.ethereum.org/EIPS/eip-627). Waku is a fork of the original Whisper protocol that enables better usability for resource restricted devices, such as mostly-offline bandwidth-constrained smartphones. It does this through (a) light node support, (b) historic messages (with a mailserver) (c) `topic-interest` for better bandwidth usage and (d) basic rate limiting. ## Motivation @@ -110,6 +111,9 @@ bloom-filter = *OCTET waku-envelope = "[" expiry ttl topic data nonce "]" +; List of topics interested in +topic-interest = "[" *0100topic "]" + ; 4 bytes (UNIX time in seconds) expiry = 4OCTET @@ -142,7 +146,7 @@ required-packet = 0 status / 2 pow-requirement / 3 bloom-filter -optional-packet = 126 p2p-request / 127 p2p-message / 20 rate-limits +optional-packet = 126 p2p-request / 127 p2p-message / 20 rate-limits / 21 topic-interest packet = "[" required-packet [ optional-packet ] "]" ``` @@ -166,11 +170,12 @@ The Waku sub-protocol MUST support the following packet codes: The following message codes are optional, but they are reserved for specific purpose. -| Name | Int Value | -|----------------------------|-----------| -| Rate limits | 20 | -| P2P Request | 126 | -| P2P Message | 127 | +| Name | Int Value | Comment | +|----------------------------|-----------|---------| +| Rate limits | 20 | | +| Topic interest | 21 | Experimental in v0 | +| P2P Request | 126 | | +| P2P Message | 127 | | ### Packet usage @@ -257,6 +262,14 @@ Each node SHOULD broadcast its rate limits to its peers using the rate limits pa Each node SHOULD respect rate limits advertised by its peers. The number of packets SHOULD be throttled in order not to exceed peer's rate limits. If the limit gets exceeded, the connection MAY be dropped by the peer. +**Topic interest** (experimental) + +This packet is used by Waku nodes for sharing their interest in messages with specific topics. It does this in a more bandwidth considerate way, at the expense of metadata protection. Peers MUST only send envelopes with specified topics. + +This feature will likely stop being experimental in v1. + +It is currently bounded to a maximum of 1000 topics. If you are interested in more topics than that, this is currently underspecified and likely requires updating it. The constant is subject to change. + ### Whisper Envelope data field (Optional) This section outlines the description of the Data Field. @@ -459,8 +472,18 @@ By default Devp2p runs on port `30303`, which is not commonly used for any other | **nimbus** | x | - | - | x | - | | **status-go** | x | x | x |x | - | +### Recommendations for clients + Notes useful for implementing Waku mode. +1. Avoid duplicate envelopes + +To avoid duplicate envelopes, only connect to one Waku node. Benign duplicate envelopes is an intrinsic property of Whisper which often leads to a N factor increase in traffic, where N is the number of peers you are connected to. + +2. Topic specific recommendations + +Consider partition topics based on some usage, to avoid too much traffic on a single topic. + ## Footnotes 1. @@ -469,9 +492,17 @@ Notes useful for implementing Waku mode. | Version | Comment | | :-----: | ------- | +| 0.1.2 | Experimental topic-interest | | 0.1.1 | Add security considerations appendix | | 0.1.0 (current) | Initial Release | + +### Differences between waku/0 and waku/1 (WIP) + +Features considered for waku/1: + +- `topic-interest` packet code + ### Differences between shh/6 waku/0 Summary of main differences between this spec and Whisper v6, as described in [EIP-627](https://eips.ethereum.org/EIPS/eip-627):