How to dial a PeerId using kademlia #6052
Replies: 2 comments 1 reply
-
For In order to obtain an address of a peer, you will need at least one connected peer to bootstrap from. Bootstrapping can be triggered manually, by periodic bootstrapping, or upon new connection. By bootstrapping, peers participating in the same DHT network will send you information about the network, for example other peers that they know, and a key-value map. Then you can listen for |
Beta Was this translation helpful? Give feedback.
-
The docs aren't very clear on this, I agree. In Kademlia, peer IDs and record IDs are mapped to the same key space. To find a peer (and their address) "closest" (XOR metric) to a key, you can use cc @guillaumemichel correct me if I am wrong. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
According to the libp2p concept docs on Peer routing
This doesn't explicitly state how or why kademlia may be looking for a peer, just that it may do so at times.
Directly below under Content provider routing, it states that (highlight by me)
The
seems to indicate that provider discovery and peer(id) discovery are conceptionally on the same level, existing in parallel, as alternatives. So I should be able tokademlia_find_provider(provided_key)
andkademlia_find_peer(peer_id)
.However, in the crate docs, I only find APIs for and , nothing that would allow me to directly find a specific peer. I could, of course, have that peer provide its PeerId and use the provider API, but that seems awkward.
For this reason, I have so far assumed that this would happen automagically: I dial a peer, kademlia sees that and starts looking for it. However, answers to my question here seem to suggest that this is not the case.
As I understand it right now, either the rust implementation of libp2p does not fully implement kademlia as outlined by the concept, or I'm missing something fundamental. So here's the question: Given a
PeerId
, how do I find the addresses of that peer?Beta Was this translation helpful? Give feedback.
All reactions