From 96274e739f9bc771c2d4c9eb66f7a09110e67f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Mon, 29 Mar 2021 14:08:25 +0200 Subject: [PATCH 1/5] Describe peer discovery in ADR Number 003 is selected, because 002 is proposed in #29. --- docs/lazy-adr/adr-003-peer-discovery.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/lazy-adr/adr-003-peer-discovery.md diff --git a/docs/lazy-adr/adr-003-peer-discovery.md b/docs/lazy-adr/adr-003-peer-discovery.md new file mode 100644 index 0000000000..aba456711b --- /dev/null +++ b/docs/lazy-adr/adr-003-peer-discovery.md @@ -0,0 +1,23 @@ +# Peer Discovery + +Libp2p provide multiple ways to discover peers (DHT, mDNS). Currently there are no plans to support mDNS (as it's limited to local networks). + +## Proposed network architecture +1. There will be a set of well-known, application-agnostic seed nodes. Every optimint client will be able to connect to such node, addresses will be saved in configuration. + * This does not limit applications which can create independent networks, with separate set of seed nodes. +2. Nodes in the network will serve DHT. It will be used for active peer discovery. Client of each ORU network will be able to find other peers in this particular network. + * All nodes will cooperate on the same DHT. + * ChainID will be used to advertise that client works in given ORU network. +3. Nodes from multiple networks will help with peer discovery (via single DHT). +4. After connecting to nodes found in DHT, GossipSub will handle peer lists for clients. + +### Pros +* Shared DHT should make it easier to find peers. +* Use of existing libraries. + +### Cons +* There may be some overhead for clients to handle DHT requests from other ORU networks. + +## Alternatives +1. IPFS DHT for peer discovery. +2. Custom peer-exchange protocol. From 8c10ab3e83a27b92e4bd88952f1040ebee9fcd81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Mon, 29 Mar 2021 14:58:53 +0200 Subject: [PATCH 2/5] Update docs/lazy-adr/adr-003-peer-discovery.md Co-authored-by: Ismail Khoffi --- docs/lazy-adr/adr-003-peer-discovery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/lazy-adr/adr-003-peer-discovery.md b/docs/lazy-adr/adr-003-peer-discovery.md index aba456711b..920b3a1a1a 100644 --- a/docs/lazy-adr/adr-003-peer-discovery.md +++ b/docs/lazy-adr/adr-003-peer-discovery.md @@ -1,6 +1,6 @@ # Peer Discovery -Libp2p provide multiple ways to discover peers (DHT, mDNS). Currently there are no plans to support mDNS (as it's limited to local networks). +Libp2p provides multiple ways to discover peers (DHT, mDNS). Currently there are no plans to support mDNS (as it's limited to local networks). ## Proposed network architecture 1. There will be a set of well-known, application-agnostic seed nodes. Every optimint client will be able to connect to such node, addresses will be saved in configuration. From c57160ceef11c4c5866966ee084b59a76086d79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Mon, 29 Mar 2021 14:59:03 +0200 Subject: [PATCH 3/5] Update docs/lazy-adr/adr-003-peer-discovery.md Co-authored-by: Ismail Khoffi --- docs/lazy-adr/adr-003-peer-discovery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/lazy-adr/adr-003-peer-discovery.md b/docs/lazy-adr/adr-003-peer-discovery.md index 920b3a1a1a..5e752d60db 100644 --- a/docs/lazy-adr/adr-003-peer-discovery.md +++ b/docs/lazy-adr/adr-003-peer-discovery.md @@ -4,7 +4,7 @@ Libp2p provides multiple ways to discover peers (DHT, mDNS). Currently there are ## Proposed network architecture 1. There will be a set of well-known, application-agnostic seed nodes. Every optimint client will be able to connect to such node, addresses will be saved in configuration. - * This does not limit applications which can create independent networks, with separate set of seed nodes. + * This does not limit applications as they can still create independent networks with separate set of seed nodes. 2. Nodes in the network will serve DHT. It will be used for active peer discovery. Client of each ORU network will be able to find other peers in this particular network. * All nodes will cooperate on the same DHT. * ChainID will be used to advertise that client works in given ORU network. From ee160a1d21aff0f23d02550d7374ab93df61c3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Mon, 29 Mar 2021 14:59:15 +0200 Subject: [PATCH 4/5] Update docs/lazy-adr/adr-003-peer-discovery.md Co-authored-by: Ismail Khoffi --- docs/lazy-adr/adr-003-peer-discovery.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/lazy-adr/adr-003-peer-discovery.md b/docs/lazy-adr/adr-003-peer-discovery.md index 5e752d60db..e6f424228e 100644 --- a/docs/lazy-adr/adr-003-peer-discovery.md +++ b/docs/lazy-adr/adr-003-peer-discovery.md @@ -7,7 +7,7 @@ Libp2p provides multiple ways to discover peers (DHT, mDNS). Currently there are * This does not limit applications as they can still create independent networks with separate set of seed nodes. 2. Nodes in the network will serve DHT. It will be used for active peer discovery. Client of each ORU network will be able to find other peers in this particular network. * All nodes will cooperate on the same DHT. - * ChainID will be used to advertise that client works in given ORU network. + * ChainID will be used to advertise that client participates in a particular ORU network. 3. Nodes from multiple networks will help with peer discovery (via single DHT). 4. After connecting to nodes found in DHT, GossipSub will handle peer lists for clients. From f5960e23455c179102743a5503ca161a263df4d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Zdyba=C5=82?= Date: Tue, 30 Mar 2021 10:01:09 +0200 Subject: [PATCH 5/5] Adressing peer comments --- docs/lazy-adr/adr-003-peer-discovery.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/lazy-adr/adr-003-peer-discovery.md b/docs/lazy-adr/adr-003-peer-discovery.md index e6f424228e..123c509771 100644 --- a/docs/lazy-adr/adr-003-peer-discovery.md +++ b/docs/lazy-adr/adr-003-peer-discovery.md @@ -1,6 +1,6 @@ # Peer Discovery -Libp2p provides multiple ways to discover peers (DHT, mDNS). Currently there are no plans to support mDNS (as it's limited to local networks). +Libp2p provides multiple ways to discover peers (DHT, mDNS, PubSub peer exchange). Currently there are no plans to support mDNS (as it's limited to local networks). ## Proposed network architecture 1. There will be a set of well-known, application-agnostic seed nodes. Every optimint client will be able to connect to such node, addresses will be saved in configuration. @@ -19,5 +19,12 @@ Libp2p provides multiple ways to discover peers (DHT, mDNS). Currently there are * There may be some overhead for clients to handle DHT requests from other ORU networks. ## Alternatives -1. IPFS DHT for peer discovery. +1. Joining public IPFS DHT for peer discovery. + * pros: large network - finding peers should be very easy + * cons: we may affect public IPFS network stability in case of misconfiguration, possibly lot of unrelated traffic 2. Custom peer-exchange protocol. + * pros: full flexibility of implementation + * cons: need to create from scratch and test +3. Re-use of existing peer discovery mechanism like `discv5` + * pros: ready & battle-tested software + * cons: use different network stack, requires lot of integration