Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer discovery through DHT rendezvous #128

Merged
merged 5 commits into from
Feb 2, 2017
Merged

Peer discovery through DHT rendezvous #128

merged 5 commits into from
Feb 2, 2017

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Feb 1, 2017

The gist: ue use DHT provider records as a rendezvous mechanism:

  • public peers provide the magic "/mediachain/node" key in the DHT
  • the /net/find api allows us to discover peers though a provider query

Example:

$ curl http://127.0.0.1:9002/net/find
QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp

$ mcclient id QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp
Peer ID: QmSbgwkKxtrBFDoGGwoKqH7soYiL64xpMK5oEYdiRnQGJp
Publisher ID: 4XTTMGkYEx5trQX5VV32S82gguRMtVFQL5UDnZNHzyNEHKBeZ
Info: Mediachain Labs test node

@yusefnapora
Copy link
Contributor

Looks good 😄

Should we be keeping a cache of discovered peers, or is that handled for us by the DHT layer? Although perhaps we don't really want to, since we don't want stale results from nodes that have gone offline.

Anyway, it's great that this works. With this + manifests it seems like we're on our way to becoming less dependent on the directories.

@vyzo
Copy link
Contributor Author

vyzo commented Feb 1, 2017

There is no caching at the DHT client, but there is caching (with a hefty ttl) in full DHT nodes.

We could perhaps cache the provider addresses in the peerstore to avoid a subsequent lookup for a peer returned in the result set.

Copy link
Contributor

@yusefnapora yusefnapora left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@vyzo vyzo merged commit bd3160e into master Feb 2, 2017
@vyzo vyzo deleted the vyzo-dht-rendezvous branch February 2, 2017 11:42
@vyzo vyzo added this to the v1.6 milestone Feb 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants