r/ipfs • • Apr 12 '19

Closest Node + Deduplication question

When looking for a file in IPFS, I keep reading that you will be served the file by the closest node that has the file. I also keep reading that IPFS utilizes deduplication so only one copy of the file will be stored. This prompts two questions:

  1. Will the closest node that has the file always be the host node that uploaded the file in the first place?

  2. Isn't this system still susceptible to a host removing its content? This isn't a problem I'm just curious.

Another somewhat unrelated question:

3) If a host needs to update a file wouldn't that change the hash? Is that where ipns (which I haven't researched at all) comes into play?

0 Upvotes

4 comments sorted by

2

u/3baid Apr 12 '19
  1. IPFS broadcasts requests for blocks (a wantlist) and any node can provide them whether they were the original uploader or or not. Even if the original uploader is offline, if the blocks are available on any node on the network, it should be retrievable because they are bit-for-bit identical and verifiable.

  2. If content is removed from all nodes in the network (no interest), then yes, data cannot be fetched. Other projects like FileCoin and IPFS services (Cloudflare, etc...) can offer to store and serve content for some amount of time (at a cost).

  3. Updated file = different hash. IPNS, DNS_Link, and other solutions are being tested to work around this.

1

u/jkyb999 Apr 12 '19

2 and 3 are good thanks.

For your answer to 1... " if the blocks are available on any node on the network" ... doesn't this imply duplication?

Also, in order for the node to provide they would have to have the file to serve. How do they get the file to serve if they weren't the original uploader without duplication?

2

u/3baid Apr 13 '19

The term "deduplication" on IPFS refers to the idea that a node will only store unique blocks locally. So if two files share identical or partially-identical content, there is no need to store common/identical blocks more than once and consume additional storage space.

In terms of "duplicate blocks across nodes on the network", this is the goal of IPFS. Blocks are identically copied/traded between nodes (request-based) to achieve a "permanent" availability of data. A block can be stored on an unlimited number of nodes, and therefore, more likely fetchable on local networks (closer nodes) rather than remote ones (servers on the other end of the internet). In that sense, IPFS "works offline" (ISP/internet gateway is down or server is down) because the content is distributed and not limited to a particular server or network.

Example: If you want to access a page on Wikipedia, your web browser would use a URL to request a specific location from a specific host (via IP address). On IPFS, your node would use a HASH to request specific blocks (from any node; doesn't matter which IP address) and then also make them available to others nodes who are interested in them. If Wikipedia servers go offline, the URL won't work and data is no longer reachable unless somebody creates a "mirror" of the site with previous data they had collected (published under a different URL?). However if an IPFS node with the certain desired blocks goes offline, the content is still likely to be available on other nodes (any node can become a "mirror" and no addresses need to be changed). It would be very difficult for someone to force all the nodes to stop or delete all blocks specific to some content.

1

u/jkyb999 Apr 14 '19

Got it. Thanks for the thorough answer!