How to implement peer discovery using Kademlia (rust-libp2p)

145 views Asked by At

I saw bunch of "answers" across the internet, but couldn't find any reliable example.

Here is the step by step process I would like to implement:

  • Start node A
  • Start node B by bootstraping Kademlia with node A
  • node A and B start exchanging messages, or heartbeats (trough gossipsub for example)

I got two issues with this:

-> The first is that despite connecting B to A (A emit RoutingUpdated, A doesn't seems to discover B (it doesn't emit an event). So through gossipsub, B send heartbeat to A, but not the other way around. When facing this issue, both nodes are running on the same local machine (but I use public addresses).

-> The second issue arise when I try to connect two nodes from different machine, either on the same network or not. When doing so, I cannot manage to connect two nodes together. The address A is exposing is responding to the ping command, but the telnet command timeout. I took down all my firewalls, VPN and everything that could block the request, but nothing changed. Also, as both node were working on WSL, I looked into windows ip configuration and tried every IP I've found, but couldn't get past this issue.

Once both issues are solved, I will make a small repo that expose a reliable example, because that's what I couldn't find online, and I think it would benefit the community.

0

There are 0 answers