If you have started working on a dApp project, you might’ve heard the word IPFS. This is especially true if you are dealing with questions about how to handle large data as part of a smart contract. IPFS (InterPlanetary File System) is an alternative to HTTP, albeit nascent, which works as a large distributed file system. This description is only the beginning of what IPFS is capable of becoming as it blossoms into a working alternative to traditional web networking protocols. IPFS will be able to accommodate many use cases, but the most powerful application of IPFS for dApp development would be in the way it could handle large data without considerable cost.
The problem with dApps that need to handle large data
One way to handle large datasets in a smart contract would be to create a side chain, which could improve performance issues but would not save transaction costs. Another solution would be to maintain a reference to large data from a mongoDB or Postgres database and reference that, but would that be too vulnerable for attacks and integrity issues? IPFS could be the ultimate solution to this. By creating an encrypted hash from an isolated network node as a reference link, IPFS would be a great match for dApp development.
What exactly does IPFS do?
As IPFS is a distributed web protocol and a decentralized method of handling storage (which is done through a “node” that could be hosted by a machine or Docker Image (or whatever you would use to host a node—I would consult the documentation).
- Each node is given a cryptographic hash.
- Duplications are removed while tracking version history.
- Nodes only store data of interest.
- Nodes are indexed with who stored what data.
- Lookup of files involves finding nodes by their given hash.
- IPNS is a human-readable decentralized naming system to find files, which is part of IPFS.
- Latency would not be an issue since the data is clustered and persistent.
- Archiving is decentralized.
- Permanence and persistence of data would be compliant with new policies (e.g. GDPR).
All of these features of IPFS are near-perfect companions to dApps, and could solve performance issues that plague current dApps that are dependent on centralized web technologies and the HTTP protocol. Decentralized archiving and hashing of pointers to data is exactly what certain dApps need to do to scale (e.g. large datasets and growing user base) without amassing costs/fees (and improving performance along with the user experience). Of course when I write that this is near-perfect, I’m referring to the possibilities. IPFS is not production-ready quite yet. It’s still in Alpha and iterating at a brisk pace. Implementation of IPFS into your dApp is another factor, especially dependent on developer language preference, current state of the dApp, and demonstrated need of IPFS after running the dApp on the testnet.
As with any protocol, platform, framework, or technology you choose to employ for your product, the idea of the “right tool for the job” is especially true for IPFS. IPFS application for a dApp, in my opinion, is one of the ways to test the viability of IPFS now. Creating a static site and hosting it on a node is another. (The point is to play with the tech without fear.)
Is IPFS usable?
It is new, so it will be awhile before this protocol is usable. The promise of a safer, more open, and highly performant web network is too great to not jump on this and learn how to implement it on a dApp (or an app!). IPFS is open source and community-friendly with a discuss site containing support forums and community discussion.