Hi,
I have a general(maybe dumb) question about how IPFS decides from which node to get a resource.
E.g:
User 1(India) adds a resource
User 2(USA, NY) gets and pins that resource
User 3(USA, Washington, D.C) wants that resource.
User 3 will get the resource from which node?
Does IPFS take into account the proximity?
Thanks.
IPFS white paper says:
IPFS nodes require a routing system that can find (a) other peers’ network addresses and (b) peers who can serve particular objects. IPFS achieves this using a DSHT based on S/Kademlia and Coral
But currently the implementation in IPFS is Kademlia.
Kademlia is a little complex, not easy to describe in short.
You can refer to https://en.wikipedia.org/wiki/Kademlia
Or video https://www.youtube.com/watch?v=WqQRQz_XYg4, it describes “Pastry DHT algorithm”, similiar to “Kademlia DHT algorithm”
In Draft 3 Juan Benet says the IPFS uses a mix of Coral and S/Kademlia but I was wondering if there are multiple eligible nodes that have the resource, it takes into account the proximity, the bandwith, etc?
The DHT is used to advertise and find peers that can provide requested pieces of content. But unless I’m mistaken, bitswap is a significant part of determining which peers are involved in fulfilling a given request.
The bitswap spec documentation seems to be in flux, but for reference here it is.
The implementation used in go-ipfs is here:
Since it’s related to DHT…
Let’s say we have node A, B, C.
‘A’ looks for a hash: A–>B–>C (has this hash).
‘B’ will update his own DHT with the pair (hash, NodeID_C) ?