2

I am using IPFS(Inter Planetary File System) to store documents/files in a decentralized manner.

  • In order to search a file from the network, is there a record of all the hashes on the network(like leeches)?
  • How does my request travel through the network?
Chamin Wickramarathna
  • 1,672
  • 2
  • 20
  • 34
  • All I can say is that it uses a DHT. It does not use a routing overlay. In this way it is more like BitTorrent and less like Freenet. – Dan D. May 26 '19 at 09:57

1 Answers1

5

Apologies, but it's unclear to me if you intend to search the contents of files on the network or to just search for files on the network. I'm going to assume the latter, please correct me if that's wrong.

What follows is a bit of an oversimplification, but here it goes:

In order to search a file from the network, is there a record of all the hashes on the network(like leeches)?

There is not a single record, no. Instead, each of the ipfs nodes that makes up the network holds a piece of the total record. When you add a block to your node, the node will announce to the network that it will provide that block if asked to. The process of announcing means letting a number of other ipfs nodes in the network know that you have that block. Essentially, your node asks its peers who ask their peers, and so on, until you find some nodes with ids that are near the hash of the block. Near could be measured using something simple like xor.

The important thing to understand is that, given the hash for a block, your node finds other ipfs nodes in the network that have ids which are similar to the hash of the block, and tells them "if anyone asks, I have the block with this hash". This is important because someone who wants to go find the content for the same hash can use the same process to find nodes that have been told where the hash can be retrieved from.

How does my request travel through the network?

Basically the reverse of above.


You can read more about ipfs content routing in the following:

michaelavila
  • 1,059
  • 7
  • 20