|
| 1 | +--- |
| 2 | +title : "Rendezvous" |
| 3 | +description: "The rendezvous protocol can facilitate the routing and discovery of nodes in a P2P network using a common location." |
| 4 | +weight: 223 |
| 5 | +--- |
| 6 | + |
| 7 | +## What is Rendezvous? |
| 8 | + |
| 9 | +A rendezvous protocol is a routing protocol that enables nodes and resources |
| 10 | +in a P2P network to discover each other. Rendezvous is used |
| 11 | +as a common location (point) to route between two routes. |
| 12 | + |
| 13 | +Rendezvous points are typically nodes that are well-connected and stable in |
| 14 | +a network and can handle large amounts of traffic and data. They |
| 15 | +serve as a hub for nodes to discover. |
| 16 | + |
| 17 | +<details> |
| 18 | + <summary>Rendezvous is not decentralized</summary> |
| 19 | + |
| 20 | + It is important to note that Rendezvous is not decentralized but rather |
| 21 | + federated. While this has its use cases, it also introduces a single |
| 22 | + point of failure into the network. This can be contrasted with fully decentralized |
| 23 | + solutions like DHT and Gossipsub. DHT (Distributed Hash Table) and Gossipsub are |
| 24 | + decentralized alternatives to Rendezvous. |
| 25 | + |
| 26 | + [DHT](kaddht.md) is a distributed network protocol used to store and |
| 27 | + retrieve data in a P2P network efficiently. It is like a hash table mapping keys |
| 28 | + to values, allowing for fast lookups and efficient data distribution across the network. |
| 29 | + |
| 30 | + [Gossipsub](pubsub.md), on the other hand, is a pub-sub (publish-subscribe) protocol |
| 31 | + that is used to distribute messages and data across a network. It uses a gossip-based |
| 32 | + mechanism to propagate messages throughout the network, allowing fast and efficient |
| 33 | + distribution without relying on a central control point. |
| 34 | + |
| 35 | +</details> |
| 36 | + |
| 37 | +## Rendezvous in libp2p |
| 38 | + |
| 39 | +{{< alert icon="💡" context="info" text="The current rendezvous implementation replaces the initial ws-star-rendezvous implementation with rendezvous daemons and a fleet of p2p-circuit relays." />}} |
| 40 | + |
| 41 | +The libp2p rendezvous protocol can be used for different use cases. E.g. it can |
| 42 | +be used during bootstrap to discover circuit relays that provide connectivity |
| 43 | +for browser nodes. Generally, a peer can use known rendezvous points to find |
| 44 | +peers that provide network services. Rendezvous is also used throughout the |
| 45 | +lifetime of an application for peer discovery by registering and polling |
| 46 | +rendezvous points. In an application-specific setting, rendezvous points can be |
| 47 | +used to progressively discover peers that can answer specific queries or host |
| 48 | +shards of content. |
| 49 | + |
| 50 | +The libp2p rendezvous protocol allows peers to connect to a rendezvous point and |
| 51 | +register their presence by sending a `REGISTER` message in one or more |
| 52 | +namespaces. Any node implementing the rendezvous protocol can act as a |
| 53 | +rendezvous point, and any peer can connect to a rendezvous point. However, only |
| 54 | +peers initiating a registration can register themselves at a rendezvous point. |
| 55 | + |
| 56 | +By registering with a rendezvous point, peers allow for their discovery by other peers who |
| 57 | +query the rendezvous point. The query may: |
| 58 | + |
| 59 | +- provide namespace(s), such as `test-app`; |
| 60 | +- optionally provide a maximum number of peers to return; |
| 61 | +- can include a cookie that is obtained from the response to a previous query, |
| 62 | + thus the current query only contain registrations that weren't part of the |
| 63 | + previous response. |
| 64 | + > This simplifies discovery as it reduces the overhead of queried peers and allows for |
| 65 | + > the pagination of query responses. |
| 66 | +
|
| 67 | +There is a default peer registration lifetime of 2 hours. Peers can optionally specify the |
| 68 | +lifetime using a TTL parameter in the `REGISTER` message, with an upper bound of 72 hours. |
| 69 | + |
| 70 | +The rendezvous protocol runs over libp2p streams using the protocol ID `/rendezvous/1.0.0`. |
| 71 | + |
| 72 | +<!-- TO ADD: Interaction diagrams and context --> |
| 73 | + |
| 74 | +### Rendezvous and publish-subscribe |
| 75 | + |
| 76 | +For effective discovery, rendezvous can be combined with [libp2p publish/subscribe](../messaging/pubsub/overview). |
| 77 | +At a basic level, rendezvous can bootstrap pubsub by discovering peers subscribed to a topic. The rendezvous would |
| 78 | +be responsible for publishing packets, subscribing, or unsubscribing from packet shapes. |
| 79 | + |
| 80 | +Pubsub can also be used as a mechanism for building rendezvous services, where a number |
| 81 | +of rendezvous points can federate using pubsub for internal distribution while still |
| 82 | +providing a simple interface to clients. |
| 83 | + |
| 84 | +<!-- DIAGRAMS COMING SOON --> |
| 85 | + |
| 86 | +{{< alert icon="💡" context="note" text="See the rendezvous <a class=\"text-muted\" href=\"https://github.com/libp2p/specs/blob/master/rendezvous/README.md\">technical specification</a> for more details." />}} |
0 commit comments