From 325ed9a748a4577e0717c2ab217900be77480c59 Mon Sep 17 00:00:00 2001 From: aidan46 Date: Mon, 9 Dec 2024 16:17:42 +0700 Subject: [PATCH 1/7] rfc: Add RFC for libp2p resolver --- rfcs/001-libp2p-resolver.md | 82 +++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 rfcs/001-libp2p-resolver.md diff --git a/rfcs/001-libp2p-resolver.md b/rfcs/001-libp2p-resolver.md new file mode 100644 index 00000000..1946b70d --- /dev/null +++ b/rfcs/001-libp2p-resolver.md @@ -0,0 +1,82 @@ +# RFC-001: Peer ID to Multi-Address Resolver + +## Abstract + +This RFC proposes an application for resolving [Peer ID][5]s to [multi-addresses][4] in a [libp2p][1] network. +The application will utilize [libp2p][1]'s [rendezvous protocol][2] for peer discovery and the [identify protocol][3] for retrieving [multi-addresses][4] and related information. +By leveraging these protocols, the application aims to provide an efficient and seamless mechanism for peer-to-peer address resolution over the internet. + +## Introduction + +In [libp2p][1]-based networks, [Peer ID][5]s serve as unique identifiers for peers, while [multi-addresses][4] describe their network locations. +Clients need to resolve [Peer ID][5]s to [multi-addresses][4] do they can connect to storage providers and fetch their files. File fetching will not be covered in this document. +This application will provide a straightforward interface to resolve [Peer ID][5]s to [multi-addresses][4] by using [libp2p][1]'s discovery and information exchange mechanisms. + +The application will operate over the internet, relying on bootstrap nodes as rendezvous points to join the network and initiate discovery. +It will integrate [libp2p][1]'s [rendezvous protocol][2] for locating peers and the [identify protocol][3] for exchanging relevant connection information. + +## Bootstrap Nodes as Rendezvous Points + +The application will rely on bootstrap nodes to initialize network interactions. +These nodes act as rendezvous points, enabling the clients to join the network and locate other peers. +Clients can configure the bootstrap nodes through a configuration file or command-line arguments. + +### Bootstrap Node Incentives + +Storage providers have a incentive to run bootstrap nodes in the P2P network because it enhances their trustworthiness and visibility within the ecosystem. +As bootstrap nodes, storage providers aid in peer discovery, enabling new and existing peers to connect more easily to the network. +This presence not only benefits the network's overall health and connectivity but also reflects positively on the storage provider's reliability and commitment to the decentralized storage ecosystem. +Trust is critical factor for storage clients selecting which storage provider to store their data. +A provider that operates a bootstrap node demonstrates that they want to support the broader network, increasing confidence and trustworthiness among clients. +Bootstrap nodes and contribute to a more seamless client experience by helping ensure that content can be discovered and retrieved efficiently. +This increase in trustworthiness can lead to increased client adoption and preference for storage providers that operate bootstrap nodes, giving these providers a competitive advantage in the ecosystem. + +## Peer Discovery + +The [identify protocol][3] plays a vital role in establishing communication of peer information. +This protocol allows peers to exchange metadata about themselves upon connection. This metadata includes: + +- [Peer ID][5]: A unique identifier for the peer. +- [Multiaddrs][4]: Addresses where the peer can be reached. +- Supported Protocols: A list of protocols the peer supports. + +Peer discovery is done using the [rendezvous protocol][3], this protocol involves a system where peers join a shared namespace to advertise themselves and find others. +When a new peer wants to participate in the network, it first connects to a bootstrap node (also known as a rendezvous point), which is a well-known and reachable peer that helps initialize connections within the network. +Once connected to the bootstrap node, the new peer uses the [rendezvous protocol][3] to discover other peers. The [rendezvous protocol][3] operates by having peers register their presence under a specific namespace with a designated rendezvous point. +Peers seeking connections to others interested in the same namespace query the rendezvous point, which returns a list of peer addresses registered under that namespace. + +## Multi-Address Resolution + +Once the target peer is discovered, the application will use the [identify protocol][3] to retrieve detailed information, including the peer's [multi-addresses][4], supported protocols, and additional metadata. + +The [identify protocol][3] facilitates the exchange of information between peers once a connection is established. After discovering the target peer via the [rendezvous protocol][2], the application will: + +- Establish a direct connection to the target peer using its discovered address. +- Initiate the [identify protocol][3] handshake to request identity information. +- Extract and display the [multi-addresses][4] and associated data provided by the target peer. + +The application will output this information in a human-readable format, making it easy for clients to consume and utilize in further operations. +The combination of the [rendezvous protocol][2] and [identify protocol][3] ensures a robust and modular approach to both discovering and resolving peers in the network. + +## Command-Line Interface + +The application will provide an intuitive CLI interface, allowing clients to input a [Peer ID][5] and retrieve its [multi-addresses][4]. +Additional options will enable customization of settings, such as specifying bootstrap nodes or adjusting discovery parameters. +The output will include a list of [multi-addresses][4] associated with the [Peer ID][5], presented in a structured and readable format. + +## Configuration and Deployment + +The application will allow configuration through a settings file or environment variables. +Clients can define bootstrap nodes, set timeouts for peer discovery and identify protocol exchanges, and specify logging preferences. +The CLI tool will be distributed as a single executable binary, ensuring ease of deployment across diverse platforms and environments. + +## Conclusion + +The [Peer ID][5] to [Multi-Address][5] Resolver application provides utility for interacting with [libp2p][1] networks. +By leveraging [libp2p][1]'s [rendezvous protocol][2] and [identify protocol][3], the application ensures efficient peer discovery and address resolution, fostering seamless communication in decentralized systems. + +[1]: https://docs.libp2p.io/ +[2]: https://github.com/libp2p/specs/blob/master/rendezvous/README.md +[3]: https://github.com/libp2p/specs/blob/master/identify/README.md +[4]: https://github.com/libp2p/specs/blob/master/addressing/README.md#multiaddr-in-libp2p +[5]: https://docs.libp2p.io/concepts/fundamentals/peers/#peer-id From b1d0cde2066ac176ecd06480620d8923d8872695 Mon Sep 17 00:00:00 2001 From: aidan46 <47111423+aidan46@users.noreply.github.com> Date: Tue, 10 Dec 2024 05:50:21 +0100 Subject: [PATCH 2/7] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: José Duarte --- rfcs/001-libp2p-resolver.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/rfcs/001-libp2p-resolver.md b/rfcs/001-libp2p-resolver.md index 1946b70d..aebc2385 100644 --- a/rfcs/001-libp2p-resolver.md +++ b/rfcs/001-libp2p-resolver.md @@ -9,7 +9,7 @@ By leveraging these protocols, the application aims to provide an efficient and ## Introduction In [libp2p][1]-based networks, [Peer ID][5]s serve as unique identifiers for peers, while [multi-addresses][4] describe their network locations. -Clients need to resolve [Peer ID][5]s to [multi-addresses][4] do they can connect to storage providers and fetch their files. File fetching will not be covered in this document. +Clients need to resolve [Peer ID][5]s to [multi-addresses][4] so they can connect to and communicate with storage providers. This application will provide a straightforward interface to resolve [Peer ID][5]s to [multi-addresses][4] by using [libp2p][1]'s discovery and information exchange mechanisms. The application will operate over the internet, relying on bootstrap nodes as rendezvous points to join the network and initiate discovery. @@ -23,12 +23,12 @@ Clients can configure the bootstrap nodes through a configuration file or comman ### Bootstrap Node Incentives -Storage providers have a incentive to run bootstrap nodes in the P2P network because it enhances their trustworthiness and visibility within the ecosystem. +Storage providers have a incentive to run bootstrap nodes in the P2P network because it increases their perceived trustworthiness and visibility within the ecosystem. As bootstrap nodes, storage providers aid in peer discovery, enabling new and existing peers to connect more easily to the network. This presence not only benefits the network's overall health and connectivity but also reflects positively on the storage provider's reliability and commitment to the decentralized storage ecosystem. -Trust is critical factor for storage clients selecting which storage provider to store their data. +Trust is a critical factor for storage clients selecting which storage provider to store their data. A provider that operates a bootstrap node demonstrates that they want to support the broader network, increasing confidence and trustworthiness among clients. -Bootstrap nodes and contribute to a more seamless client experience by helping ensure that content can be discovered and retrieved efficiently. +Bootstrap nodes are required for a seamless client experience by helping ensure that content can be discovered and retrieved efficiently. This increase in trustworthiness can lead to increased client adoption and preference for storage providers that operate bootstrap nodes, giving these providers a competitive advantage in the ecosystem. ## Peer Discovery From 37f569e518ccc0eff1bf87d0b7c146e3d8b85bc2 Mon Sep 17 00:00:00 2001 From: aidan46 Date: Tue, 10 Dec 2024 12:53:07 +0800 Subject: [PATCH 3/7] fix: Remove configuration and deployment section --- rfcs/001-libp2p-resolver.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/rfcs/001-libp2p-resolver.md b/rfcs/001-libp2p-resolver.md index aebc2385..1b7c29d9 100644 --- a/rfcs/001-libp2p-resolver.md +++ b/rfcs/001-libp2p-resolver.md @@ -64,12 +64,6 @@ The application will provide an intuitive CLI interface, allowing clients to inp Additional options will enable customization of settings, such as specifying bootstrap nodes or adjusting discovery parameters. The output will include a list of [multi-addresses][4] associated with the [Peer ID][5], presented in a structured and readable format. -## Configuration and Deployment - -The application will allow configuration through a settings file or environment variables. -Clients can define bootstrap nodes, set timeouts for peer discovery and identify protocol exchanges, and specify logging preferences. -The CLI tool will be distributed as a single executable binary, ensuring ease of deployment across diverse platforms and environments. - ## Conclusion The [Peer ID][5] to [Multi-Address][5] Resolver application provides utility for interacting with [libp2p][1] networks. From 17c7fdecb7f52b4872619f9d84551d0af1fb76fb Mon Sep 17 00:00:00 2001 From: aidan46 Date: Tue, 10 Dec 2024 18:08:14 +0800 Subject: [PATCH 4/7] docs: Add part about possible bootstrap failures --- rfcs/001-libp2p-resolver.md | 1 + 1 file changed, 1 insertion(+) diff --git a/rfcs/001-libp2p-resolver.md b/rfcs/001-libp2p-resolver.md index 1b7c29d9..48c6f2c5 100644 --- a/rfcs/001-libp2p-resolver.md +++ b/rfcs/001-libp2p-resolver.md @@ -20,6 +20,7 @@ It will integrate [libp2p][1]'s [rendezvous protocol][2] for locating peers and The application will rely on bootstrap nodes to initialize network interactions. These nodes act as rendezvous points, enabling the clients to join the network and locate other peers. Clients can configure the bootstrap nodes through a configuration file or command-line arguments. +For protection against bootstrap nodes going down, the application will attempt to connect to the first configured bootstrap node and connect to a different one in case this one is down. ### Bootstrap Node Incentives From 83d6d5894696611d3d1cf201e17f16430249edbc Mon Sep 17 00:00:00 2001 From: aidan46 Date: Fri, 13 Dec 2024 19:07:43 +0800 Subject: [PATCH 5/7] docs: Update resolver RFC --- rfcs/001-libp2p-resolver.md | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) diff --git a/rfcs/001-libp2p-resolver.md b/rfcs/001-libp2p-resolver.md index 48c6f2c5..e7a838d4 100644 --- a/rfcs/001-libp2p-resolver.md +++ b/rfcs/001-libp2p-resolver.md @@ -2,25 +2,25 @@ ## Abstract -This RFC proposes an application for resolving [Peer ID][5]s to [multi-addresses][4] in a [libp2p][1] network. -The application will utilize [libp2p][1]'s [rendezvous protocol][2] for peer discovery and the [identify protocol][3] for retrieving [multi-addresses][4] and related information. -By leveraging these protocols, the application aims to provide an efficient and seamless mechanism for peer-to-peer address resolution over the internet. +This RFC proposes an library for resolving [Peer ID][5]s to [multi-addresses][4] in a [libp2p][1] network. +The library will utilize [libp2p][1]'s [rendezvous protocol][2] for peer discovery and the [identify protocol][3] for retrieving [multi-addresses][4] and related information. +By leveraging these protocols, the library aims to provide an efficient and seamless mechanism for peer-to-peer address resolution over the internet. ## Introduction In [libp2p][1]-based networks, [Peer ID][5]s serve as unique identifiers for peers, while [multi-addresses][4] describe their network locations. Clients need to resolve [Peer ID][5]s to [multi-addresses][4] so they can connect to and communicate with storage providers. -This application will provide a straightforward interface to resolve [Peer ID][5]s to [multi-addresses][4] by using [libp2p][1]'s discovery and information exchange mechanisms. +This library will provide a straightforward interface to resolve [Peer ID][5]s to [multi-addresses][4] by using [libp2p][1]'s discovery and information exchange mechanisms. -The application will operate over the internet, relying on bootstrap nodes as rendezvous points to join the network and initiate discovery. +The library will operate over the internet, relying on bootstrap nodes as rendezvous points to join the network and initiate discovery. It will integrate [libp2p][1]'s [rendezvous protocol][2] for locating peers and the [identify protocol][3] for exchanging relevant connection information. ## Bootstrap Nodes as Rendezvous Points -The application will rely on bootstrap nodes to initialize network interactions. +The library will rely on bootstrap nodes to initialize network interactions. These nodes act as rendezvous points, enabling the clients to join the network and locate other peers. Clients can configure the bootstrap nodes through a configuration file or command-line arguments. -For protection against bootstrap nodes going down, the application will attempt to connect to the first configured bootstrap node and connect to a different one in case this one is down. +For protection against bootstrap nodes going down, the library will attempt to connect to the first configured bootstrap node and connect to a different one in case this one is down. ### Bootstrap Node Incentives @@ -48,27 +48,21 @@ Peers seeking connections to others interested in the same namespace query the r ## Multi-Address Resolution -Once the target peer is discovered, the application will use the [identify protocol][3] to retrieve detailed information, including the peer's [multi-addresses][4], supported protocols, and additional metadata. +Once the target peer is discovered, the library will use the [identify protocol][3] to retrieve detailed information, including the peer's [multi-addresses][4], supported protocols, and additional metadata. -The [identify protocol][3] facilitates the exchange of information between peers once a connection is established. After discovering the target peer via the [rendezvous protocol][2], the application will: +The [identify protocol][3] facilitates the exchange of information between peers once a connection is established. After discovering the target peer via the [rendezvous protocol][2], the library will: - Establish a direct connection to the target peer using its discovered address. - Initiate the [identify protocol][3] handshake to request identity information. - Extract and display the [multi-addresses][4] and associated data provided by the target peer. -The application will output this information in a human-readable format, making it easy for clients to consume and utilize in further operations. +The library will output this information in a human-readable format, making it easy for clients to consume and utilize in further operations. The combination of the [rendezvous protocol][2] and [identify protocol][3] ensures a robust and modular approach to both discovering and resolving peers in the network. -## Command-Line Interface - -The application will provide an intuitive CLI interface, allowing clients to input a [Peer ID][5] and retrieve its [multi-addresses][4]. -Additional options will enable customization of settings, such as specifying bootstrap nodes or adjusting discovery parameters. -The output will include a list of [multi-addresses][4] associated with the [Peer ID][5], presented in a structured and readable format. - ## Conclusion -The [Peer ID][5] to [Multi-Address][5] Resolver application provides utility for interacting with [libp2p][1] networks. -By leveraging [libp2p][1]'s [rendezvous protocol][2] and [identify protocol][3], the application ensures efficient peer discovery and address resolution, fostering seamless communication in decentralized systems. +The [Peer ID][5] to [Multi-Address][5] Resolver library provides utility for interacting with [libp2p][1] networks. +By leveraging [libp2p][1]'s [rendezvous protocol][2] and [identify protocol][3], the library ensures efficient peer discovery and address resolution, fostering seamless communication in decentralized systems. [1]: https://docs.libp2p.io/ [2]: https://github.com/libp2p/specs/blob/master/rendezvous/README.md From 232992f4c4e6fd2dac25656842c8661be54b2500 Mon Sep 17 00:00:00 2001 From: aidan46 Date: Mon, 16 Dec 2024 14:09:36 +0800 Subject: [PATCH 6/7] docs: Update resolver RFC --- rfcs/001-libp2p-resolver.md | 1 - 1 file changed, 1 deletion(-) diff --git a/rfcs/001-libp2p-resolver.md b/rfcs/001-libp2p-resolver.md index e7a838d4..1200d859 100644 --- a/rfcs/001-libp2p-resolver.md +++ b/rfcs/001-libp2p-resolver.md @@ -19,7 +19,6 @@ It will integrate [libp2p][1]'s [rendezvous protocol][2] for locating peers and The library will rely on bootstrap nodes to initialize network interactions. These nodes act as rendezvous points, enabling the clients to join the network and locate other peers. -Clients can configure the bootstrap nodes through a configuration file or command-line arguments. For protection against bootstrap nodes going down, the library will attempt to connect to the first configured bootstrap node and connect to a different one in case this one is down. ### Bootstrap Node Incentives From d417d4ad12a7491db008112043e078cd78a48f4b Mon Sep 17 00:00:00 2001 From: aidan46 Date: Tue, 17 Dec 2024 12:55:31 +0800 Subject: [PATCH 7/7] docs: Add author and date to RFC --- rfcs/001-libp2p-resolver.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/rfcs/001-libp2p-resolver.md b/rfcs/001-libp2p-resolver.md index 1200d859..24e53b3c 100644 --- a/rfcs/001-libp2p-resolver.md +++ b/rfcs/001-libp2p-resolver.md @@ -1,5 +1,8 @@ # RFC-001: Peer ID to Multi-Address Resolver +Author: Aidan Sullivan — @aidan46 +Date: 17/12/24 + ## Abstract This RFC proposes an library for resolving [Peer ID][5]s to [multi-addresses][4] in a [libp2p][1] network.