[General] Concept of P2P DHT

zero-one zero-one at tox.chat
Thu Feb 4 22:15:03 PST 2016


You can also check out the toxcore documentation here
https://github.com/Tox-Docs/Text , but it's still relatively unpolished.

On 02/04/2016 02:53 PM, oranges wrote:
> Here is my high level understanding.
>
> There is a distance function that defines for any given node, how
> close a set of keys are to it (the closeness is arbitrary, it just
> needs to be a consistent algorithm)
>
> If your node is "close" to a key you store those key -> ipaddress
> mappings on your machine. (To make this storage more robust, the key
> -> ipadress mappings are a usually replicated on N machines, where N
> is some arbitrary value of how resilient the DHT is.)
>
> Now, you can't obviously know about all the nodes in a network. So
> usually, you only know K nodes that are spread in either direction of
> your "closeness value", i.e some will be closer to the zero, than you
> and some will be closer to the infinity. (ideally half and half).
> Although in this case I'm not sure exactly how tox chooses candidates
> for you to know about (it may just be, the last K nodes I have spoken too)
>
> To lookup a key, you find the 3 nodes that you know about that are
> closest to the key that you want to find.
>
> They may not actually know about the key, but what they can do is then
> find the 3 closest nodes to the key that they know about and ask them.
>
> This repeats and you eventually converge closer and closer to the key
> you want until you find a node with the key -> ipaddress mapping and
> it is returned to the original asker.
>
> This is why when you first time you ever connect to the DHT you need
> to use one of the bootstrap nodes at nodes.tox.chat, so that you can
> "join" the DHT and become aware of at least some members of the network.
>
> (Note that this simplifies the real situation as in tox.chat's case,
> there is onion routing involved, so that you can't just trivially get
> someones IP address by friend requesting them (they have to accept the
> request)
>
> Hopefully that clarifies a bit how the DHT works
> _______________________________________________
> General mailing list
> General at lists.tox.chat
> https://lists.tox.chat/listinfo/general



More information about the General mailing list