DEV Community

chandra penugonda
chandra penugonda

Posted on

Understanding the InterPlanetary File System (IPFS)

What is IPFS?

  • IPFS is a peer-to-peer network for storing and sharing files. Similar to a Blockchain where distributed and decentralized nodes store the ledger (the chain of blocks), nodes in IPFS stores files in different nodes.

  • In IPFS, files are stored on different computers on the network. For example, a single image can be broken up into several files and stored on different computers. IPFS, like Blockchain, is decentralized:

IPFS file

image location

you can fetch this image from IPFS using this URL:

format: https://ipfs.io/ipfs/{hash}
example: https://ipfs.io/ipfs/QmbjYzobwnXvpHbSBjw8aHYuWYitdr33YyoZGeN7q5J4WC

What happens when two different users upload the same file? In this case, only one copy of the file would be stored in IPFS. This greatly reduces the storage needed to store all the files in IPFS.

  • How does IPFS know that two files are identical? Remember one of the properties of hashing — collision resistance? Collision resistance means that no two different inputs should hash to the same output. And this means that if two files have the exact content, the hash of these two files would be the same.
  • It is important to know that all files in IPFS are public, and so if you do not want your private files to be viewable by everyone on the network, be sure to encrypt them before you upload them to IPFS.

So why should you use IPFS?

  • Files uploaded to the IPFS are immutable. This means that once a file is uploaded to IPFS, its content cannot be changed without changing its CID. This property ensures that an item stored on IPFS is always the original copy that has not been altered. So when you retrieve a file from IPFS, you can be sure that it is the original copy.
  • Files uploaded to IPFS are permanent — there is no guarantee that a file can be deleted once another node has managed to copy it.
  • IPFS ensures that there is no single point of failure. As files are distributed, stored, and cached by different nodes, IPFS is resistant to centralized points of failure such as server issues or coordinated attacks.

Top comments (0)