Search code examples
p2pbittorrentdhtchordkademlia

Can applications coexist within the same DHT?


If you create a new application which uses a distributed hash table (DHT), you need to bootstrap the p2p network. I had the idea that you could join an existing DHT (e.g. the Bittorrent DHT).

Is this feasable? Of course, we assume the same technology. Combining Chord with Kademlia is obviously not feasable.

If yes, would this be considered parasitic or symbiotic? Parasitic meaning that it conflicts with the original use somehow. Symbiotic, if it is good for both applications as they support each other.


Solution

  • In general: Kademlia and Chord are just abstract designs, while implementations provide varying functionality. If its feature-set is too narrow you won't be able to map your application logic onto it. If it's overly broad for your needs it might be a pain to re-implement if no open source library is available.

    For bittorrent: The bittorrent DHT provides 20byte key -> List[IP,Port] lookups as its primary feature, where the IP is determined by the sender IP and thus cannot be used to store arbitrary data. There are some secondary features like bloom filter statistics over those lists but they're probably even less useful for other applications.

    It does not provide general key-value storage, at least not as part of the core specification. There is an extension proposal for that

    Although implementations provide some basic forward-compatibility for unknown message types by treating them like node lookup requests instead of just ignoring them that is only of limited usefulness if your application supplies a small fraction of the nodes, since you're unlikely to encounter other nodes implementing that functionality during a lookup.

    If yes, would this be considered parasitic or symbiotic?

    That largely depends on whether you are a "good citizen" in the network.

    • Does your implementation follow the spec, including commonly used extensions?
    • Does your general use-case stay within an order of magnitude compared to other nodes when it comes to the traffic it causes?
    • Is the application lifecycle long enough to not lie outside the expected churn rates of the target DHT?