braidpool icon indicating copy to clipboard operation
braidpool copied to clipboard

Integrate libp2p: peer discovery

Open mcelrath opened this issue 8 months ago • 0 comments

  1. Use Kademlia to obtain a list of peers
  2. Connect to each peer and send a ping message
  3. Write a peer selection function that will use a heuristic on both latency (recorded from the ping messages) and Kademlia xor distance to obtain a set of peers spanning the entire range in latency.
  4. Start some data structures to keep statics on peers: a. Connection attempts/successes b. Connection drops c. Garbled/undecodable messages/packet loss d. Running tally of latency, and the std. deviation of latency e. Did we have to hole punch this peer?
  5. Cache the peer data structure by writing it in ~/.braidpool so it survives restarts.

With hole punching it's important to find a peer that is "between" both peers in terms of latency. Determine if there's anything we can add in the peer data structure that is useful for this.

mcelrath avatar May 20 '25 18:05 mcelrath