IPFS is a technology that has revolutionized hosting and has been the underlying technology for NFTs so we thought to give you a rundown of what it is and why it is so important for the future.
What is IPFS and how to use it right
IPFS, which stands for Interplanetary File System, is now quite a common acronym across the crypto space, but not everyone fully understands what it is, or its usage implications. This article will try to throw some light on what exactly it proposes to be and how it works!
How the current web works
If you type in a URL in your browser, like the one you’re using to read this article at the moment, it will resolve to an IP address belonging to the server hosting this content. The server then can respond with a file or webpage for the user to see.
Although this works fine, it has two main shortcomings:
Content is mutable
This means that a given hyperlink can change the content it serves over time. (Hence why tools like the Wayback Machine are so useful). The page you access today may have its appearance changed, or its content completely renovated.
There's no guarantee the URL you access today will keep linking to the same thing tomorrow.
Distribution is inherently centralized
Although there are mitigations to this, like content mirrors, ultimately if I own a website or server, and it goes offline for some reason, all the content, pages and media hosted there go offline as well.
And even if there are backups or mirrors, it isn’t easy to find those, unless you explicitly communicate them or find them through centralized search engines.
Links can die and media can be lost over time if URLs are changed or stop working.
How IPFS is different and why should you care
The way the web works currently isn’t inherently bad or flawed, but due to the shortcomings above, it’s obvious that moving forward with proposals to improve immutability and decentralization is a good idea. IPFS is one such project that promises to change how we think, use and distribute content across the internet.
On IPFS, instead of having URLs that point to servers that serve content, the content itself is "the URL” as a hash. This has big implications.
If you distribute a file on IPFS, say a hello-world.txt, it will have a hash assigned to it based on its content. This hash is what other people can use to request your file.
Why is this relevant? Because you can always be sure that an IPFS hash will point to the same thing. If the content changes, the hash changes.
This is super important, especially in the context of crypto immutability (say, NFT media for example).
As a good example, if your NFT on the blockchain points to a normal link, that link can break, vanish and stop working or serve an entirely different content in the future. If it links to an IPFS hash, you can sleep reassured it will always point to the same content.
IPFS is decentralized, and that’s a big deal
On the current web, if I love xkcd.com and it goes offline, there’s nothing much I can do. Unless I’m actively making backups and mirrors of the website content, it’s gone. And even if I have mirrors and backups, other people that want to see that content will need to know how to get there, since the original link or website may not work anymore in this scenario.
On IPFS, you don’t have the exact concept of “servers” as you have on the normal web, but instead, you'll find nodes in a peer-to-peer network. Those peers can talk to other peers and both request and serve content.
In other words, that means if I'm a node on the IPFS network, and there’s content I care about, I can pin that content (through its hash), and keep it accessible to everyone. This way, even if the origin of that content ceases to exist, the content is still available on the network as if nothing happened, as long as someone cares to host and broadcast it.
And since, the hash in IPFS will always point to the same thing, anyone requesting that content can be sure that no matter who’s serving that request, they’re getting the correct thing.
How to use IPFS right
The concepts above aren’t that hard to grasp. But they do have deep implications for how we think about the web, and as with any paradigm shift, can take a while for us to fully understand.
One of the most confusing things for newcomers to conciliate is the IPFS network itself and IPFS gateways.
No browser, with the notorious exception being Brave, supports IPFS natively yet. This means that you will usually need a gateway to view IPFS content. A gateway is simply a web service that fetches content on IPFS and servers it to you through a common web URL.
You should never treat gateway links as proper IPFS links because the gateway you use can still cease to exist or begin to serve different content.
In other words,
https://ipfs.io/ipfs/QmRaaUwTNfwgFZpeUy8qrZwrp2dY4kCKmmB5xEqvH3vtD1/readme is not the same as
The latter is better as it’s a raw IPFS link. And although you do need special software nowadays to access it directly, it is truly immutable. The first link is still a normal URL and suffers from the same problems described previously.
So, for example, if you’re creating an NFT collection, always choose the latter!
It’s up to whoever displays your NFT, be an application or website, to understand and load properly the IPFS URL as the Tokel dApp does.
The Tokel dApp runs under the hood, a built-in IPFS node, to fetch content directly from the network whenever possible (avoiding gateways as much as possible). This ensures the best UX and we highly incentivize the usage of raw IPFS hashes. As the decentralized web advances, interacting with those hashes will become easier and more commonplace. Hopefully, in the future, we won't need any gateways!
IPFS has shortcomings, too
Of course, IPFS is not meant to be a replacement for the whole web. Immutable content is awesome but in some use cases, it is also undesirable.
Putting something on IPFS allows people to keep broadcasting it forever, removing the choice of whoever put it online to make that content unavailable.
So, different tools for different jobs.
Both those issues are known and there are alternatives and tools in progress to address them, but it’s not the goal of this article to dive too deep into technicalities.
We hope this post was useful in clarifying what IPFS is and how you can use it correctly. As usual, feel free to send any questions or thoughts to us on Discord!
Tokel Talk Podcast