Why You Should Use IPFS
Interplanetary File System (IPFS) is a peer-to-peer distributed file hosting protocol. When a file or collection of files in a folder are uploaded to the IPFS network. Each individual file and folder is identified with a Content Identifier (CID).
This CID represents a thumbprint that uniquey identifies a file or folder. If the file, or a folder’s contents, are modified in any way the CID will change.
So, how does this help?
Let’s say I want to host my site logo. I have a few options for hosting, but I host it in a typical fashion on my personal web hosting service.
https://www.coderrob.com/img/coderrob.png
At any point I can change the image, without changing the file name, and access the new image by the same URL.
I could change my logo to a pink unicorn horn jousting sharks inside a tornado so long as the file name didn’t change. Based on just the URL itself there is no way to verify what image was there is still there.
Even worse, what if my web host goes down, or what if I forget to pay (or can’t afford) my cloud services bill? If those services stop my logo would be inaccessible. Heck, all my files would be inaccessible.
IPFS doesn’t have this problem. IPFS is a peer-to-peer distributed network where one or more nodes host your files. As long as one node is still active the file remains accessible. In the majority of cases there are no costs for this hosting unlike traditional methods.
When a file is uploaded to IPFS the file data is computed and given a CID that only changes if the file data changes.
Computing the CID for my Coderrob logo using IPFS I get the following:
QmUme7J3fhJHgrN2n961YAStoPZPZShpBMEFo4FtfiJx8t
After uploading my image with Pinata, IPFS.io, or any IPFS services you can now access my logo on the network by its CID:
https://ipfs.io/ipfs/QmUme7J3fhJHgrN2n961YAStoPZPZShpBMEFo4FtfiJx8t
If I modify the image data and re-upload it to IPFS the CID won’t be the same. File name means nothing more than metadata. Only the file data matters.
I now have a guarantee that the requested CID will always be the same file every time.
IPFS isn’t a magic bullet. If a file isn’t pinned the file could be removed from the peer network.
These long term persistence problems are being solved by projects, like Filecoin.io and Pinata, where we can pay to ensure long-term (like forever) storage of data.
Given the benefits of IPFS. It’s clear that this is a radically different approach than traditional centralized hosting methods. IPFS offers signifcantly more assurances of always available file access with its own versioning enforced by CID.
Note: If you’re a developer, and looking to get started with IPFS. I have open sourced some helpful Pinata scripts to get you started.