Ambient peer discovery protocol #587
Replies: 11 comments 57 replies
-
That's pretty much a requirement for this to be useful for browsers. A filter / preference for supported protocols would likely be helpful for bootstrapping networks as well. |
Beta Was this translation helpful? Give feedback.
-
FWIW, I'm still slowly pushing for rendezvous to become that protocol Some consideration though
Returning a list of peers you are currently connected to is a big no-no in security-concerned networks, as it opens a list of nasty attacks. I would instead advise to return a list of peers you were connected to, which is still not ideal, but also the best we can do :) |
Beta Was this translation helpful? Give feedback.
-
Strongly agree here. If a browser node is sent 10x TCP/QUIC-only peers it kind of defeats the purpose.
I would say yes. Gossipsub uses peer records to exchange peer information so there's precedent. As an attacker you could create a bunch of peer ids and make up garbage addresses to return but having to sign the records makes it a little more expensive?
Probably not? It sounds like it's going to be quite lightweight so it would probably end up getting run on every connection after Identify.
If it's a risk for a given deployment I would encourage them to opt out of this (or any tbh) protocol. For example I would not expect any networks that have homogenous peers to have it turned on. By which I mean if you can guarantee the transports peers on the network have by spec (e.g. lodestar/ethereum) you should be able to use regular means to discover peers. The value I see here is for nodes that cannot realistically use the DHT (e.g. browser nodes) because the majority of discovered peers do not speak compatible transports so your queries usually fail. |
Beta Was this translation helpful? Give feedback.
-
If, by default, all nodes run circuitRelayV2 & listen on ws/webtransport, then does this become obsolete? |
Beta Was this translation helpful? Give feedback.
-
@thomaseizinger How is this proposal different to the Rendezvous Protocol? If I understand it correctly, this ambient discovery protocol doesn't rely on a "central" Rendezvous point and instead allows any peer supporting this protocol to just share other peers they are/were connected to. Is that a good way to understand it? |
Beta Was this translation helpful? Give feedback.
-
I'm no security expert, but I think there is still an opportunity for users to poison the network with invalid peers something akin to https://owasp.org/www-community/attacks/Cache_Poisoning Also, for the assumption that peers won't dial them (a), this protocol is intended to expose methods for peers to find others to dial, so it's implied that the given peers will be dialed. For (b), I think that's an important point, but if this spec is implemented and useful, one can assume that they will eventually receive requests; especially from browser nodes who are very thirsty for dialable peers. Some sort of reputation mechanism could be implemented as part of this ambient-peer-discovery spec so that we can ignore nodes if we discover that they're giving us fake/bad peers. Do we need this, and how would we do that?
That would be great. We were just talking about a POC for "please give me dialable peers" in our recent JS colo in NY: https://pl-strflt.notion.site/libp2p-smart-dialing-ded9379cbfb449fa928b34a7555ea7ff?pvs=4
This seems like a Yes to me, but, to be more specific: prefer them over what exactly?
One callout here is that another attack vector could be spamming nodes with "give me peers." If we have to do filtering/sorting on node A, in order to return only valid/transportX multiaddrs, then a swarm of nodes requesting this information could cause a brown-out on node A. We should ensure we're limiting the work nodes we request things from have to do (aka relayV2 over relayV1).
I think periodically running the protocol makes sense, but also whenever identify is ran. Some scenarios when I think we could run it:
|
Beta Was this translation helpful? Give feedback.
-
I posted this in a thread, and reposting here at top level for visibility: This feature should be strictly opt in. I understand where you are coming from, but there are serious security implications from revealing your peers. |
Beta Was this translation helpful? Give feedback.
-
Another datapoint here - the reason Kademlia is not a realistic option for browsers right now is neatly summarised by the enormous gulf on the right hand side of this graph. Chrome supports only Secure WebSockets, WebTransport and WebRTC - out of the 32k nodes on the IPFS DHT, only about 5.5% of them listen on those transports. For Firefox it's even worse since WebTransport is unusable until serverCertificateHashes support is implemented. So after connecting to the PL managed bootstrappers and issuing a query to find peers that are KAD-close to you, the chances of actually being able to dial those peers is very small. Individual DHT queries also have a high failure rate/results inconsistent with QUIC/TCP peers for the same reason. |
Beta Was this translation helpful? Give feedback.
-
Perhaps a stupid question, but given that this is:
Wouldn't it make sense for this to be an HTTP protocol that can be served over libp2p if desired? Seems like a pretty good match if you're choosing to do something new. |
Beta Was this translation helpful? Give feedback.
-
I would also like for this to have some form of network identifier (ie like namespaces in rendezvous) I think namespaces are even more useful than that, since the app can even split further than the "network level" (ie, create a namespace for nodes storing all the history of the network, vs nodes that only have the recent one), but we don't have to go that far. Both bitcoin PX (in the addr_list.net_addr.services), bittorrent PX (they only exchange peers for a specific file) and waku PX (in the ENR) have such a field |
Beta Was this translation helpful? Give feedback.
-
I am closing this in favor of a spec draft as a PR: #590 Thanks for all the feedback! |
Beta Was this translation helpful? Give feedback.
-
While doing some work on the universal-connectivity app, a discussion came up around supporting "ambient peer discovery". See libp2p/universal-connectivity#96.
I'd like to discuss the feasibility of an "ambient peer discovery" protocol.
Usecase
Goal
Develop a protocol that allows node B to share its ambient peers with node A.
Proposal
Protocol name:
/libp2p/ambient-peers
Kind: request-response
Interactions with other libp2p protocols
The protocol should be applicable in as many situations as possible and not unnecessarily tied to or assume the presence of other protocols like gossipsub, rendezvous, kademlia etc. We assume that simply connecting to some more nodes is good enough. The ambient-peers protocol can be repeated on peers found through it.
Kademlia
It is likely that through several hops of the ambient peer protocol, we eventually connect to a server that allows us to perform a kademlia random walk.
WebRTC
If node A is a browser node and connects to server node B via webrtc-direct, it can immediately detect not only other server nodes but also other browsers that are connected to the same server node. Those two browsers can then attempt to establish a direct connection, assuming node B also supports the relay protocol.
Security
The proposed protocol allows a malicious actor to fake peer records and distribute them in a network and thus implicitly target a certain machine / IP address. However, I don't think it is an issue because:
a. The attacker cannot be sure that the other peer will actually dial any of the addresses.
b. The attacker cannot actively distribute the records, it has to wait for other nodes to request them.
Open questions
Prior art
addr
message that allows peers to exchange IP addresses: https://en.bitcoin.it/wiki/Protocol_documentation#addrFootnotes
There is an argument that if we want to call ourselves a "modular networking stack" then we should be modular at the specification level and not have too many dependencies between them. ↩
Beta Was this translation helpful? Give feedback.
All reactions