2021-10-15
The question of peer discovery for Waku v2 has been a focus area since the protocol was first conceptualized. Since then several different approaches to discovery had been proposed, investigated, implemented or placed on development roadmaps.
This post aims to:
It is meant to be an interactive discussion, with feedback from as many Waku v2 stakeholders as possible, to get a clear picture of where we are, what the specific peer discovery requirements are for different use cases, and how to proceed from here.
method | nim-waku (Nim) | go-waku (Go) | js-waku |
---|---|---|---|
DNS-based discovery | ✔ | ✔ | 🚧 |
GossipSub peer exchange | ✔ | ? | |
Node Discovery v5 | 🚧 | ||
Rendezvous | ✔ |
Peer discovery is the method by which nodes become aware of each other's existence. This definition should be general enough to cover the use case of discovering peers with selected capabilities, although "peer ID discovery" and "capability discovery" could be treated as separate problem domains in implementation.
Since the problem of discovery is (mostly) orthogonal to the messenger-oriented problems addressed by Waku v2 protocols, Waku v2 can in theory be used in conjunction with any discovery mechanism. We are, however, researching more integrated approaches that are specifically geared towards Waku v2 design goals.
Specifically, we want to maximize the following properties in selecting discovery schemes:
In practice every discovery mechanism implies a tradeoff between these three properties.
Waku v2 nodes may also be interested in peers with specific capabilities, for example:
store
capability,store
peers with x days of history for a specific content topic, etc.There may be ways for some of these capabilities to be advertised and discoverable within any of the mechanisms described below, although this could increase the complexity of finding a node with specific capabilities within the larger network (a needle in a haystack).
Using this method a new node can retrieve an authenticated, updateable list of peers via DNS to bootstrap connection to a Waku v2 network. Our implementation is based on EIP-1459.
Based on EIP-1459 across all three Waku v2 implementations. Since EIP-1459 operates on EIP-778 Ethereum Node Records there is an ongoing conversation about how to encode multiaddr
information for which there exists no key definition in EIP-778. These include websocket ports, DNS addresses, etc. which are required for running Waku from a browser.
IMPORTANT NOTE: RFC 25/LIBP2P-DNS-DISCOVERY proposes an alternative approach to DNS discovery not based on EIP-778 ENR. This specification is not currently implemented or on a roadmap to be implemented.
EIP-1459 implementation done and integrated in go-waku
EIP-1459 implementation done and integrated in nim-waku
WIP. Awaiting consensus on multiaddr
encoding in EIP-778 ENR.
GossipSub Peer Exchange (PX) is a GossipSub v1.1 mechanism whereby a pruning peer may provide a pruned peer with a set of alternative peers where it can connect to reform its mesh. This is a very suitable mechanism to gradually discover more peers from an initial connection to a small set of bootstrap peers.
Implemented in go-libp2p. Enabled and integrated in go-waku.
Not yet implemented in nim-libp2p. Implementation is likely to form part of the medium term nim-libp2p goal of peer and connection management.
A shorter term minimal implementation is possible by adding support in nim-libp2p for:
PRUNE
is received and contains peer exchange information. nim-waku
could then implement this callback function, handling and connecting to the discovered peers.???
Node Discovery Protocol v5 is a DHT-based discovery mechanism adapted to store and relay node records.
Not yet implemented.
POC implementation in progress. The POC proposes that discv5 can be started and stopped via API calls to limit resource usage.
Not yet implemented.
Rendezvous protocol is a discovery method whereby peers register and discover other registered peers at rendezvous points. Status rendezvous introduces some differences with the original specification, including using ENR for peer information.
Implemented and integrated in go-waku.
Not yet implemented.
Not yet implemented.