Skip to content

IPFS, the distributed web.

  • by

We’ve heard a lot about Web3.0, Blockchain, Distributed Web, etc. But most of them are just in concept and a bunch of essays. Did you know that there’s a real-life example, which powers the distributed web? I’m talking about IPFS, the InterPlanetary File System.

WARNING: IPFS Website & default Gateway are blocked in the People’s Republic of China, so make sure your network condition is okay to access related information. But IPFS itself can’t be blocked, more on that later.

Let’s just start with a one-line definition of IPFS:

IPFS is a distributed system for storing and accessing files, websites, applications, and data. — IPFS Docs

Remember that I’ve said ‘But IPFS itself can’t be blocked’? Here’s why.

IPFS is a distributed file system, so it’s impossible to block specific resources. Because it’s impossible and worthless to block all ‘nodes’. The whole IPFS is powered by volunteers’ computers.

Here’s a simple process for files that are uploaded to IPFS:

First, you upload this file(s) to an IPFS node. Next, the node will try to distribute the file to different nodes(peers) it connected around the world.

Here’s a thing, as an IPFS peer, you can’t decide which file to store on your computer. So it’s possible to store some illegal files (related to your local law) on your computer. Be careful when trying this.

You may notice, that I have just said ‘distribute the file to different peers’. What it brings is that it’s impossible to delete the file from the IPFS world completely. (technically it’s still possible after a certain amount of time, more on that later.)

IPFS creates a unique ID for every file that is uploaded to the IPFS network. We call it CID. Everyone can access your files with your CID, and without your CID, it’s very hard to access your files. Even your files are distributed to their computer.

What on earth is a ‘node’ or ‘peer’?

Participants in the IPFS network are called nodes. Nodes are an IPFS program that you run on your local computer to store files and connect to the IPFS network. They’re the most crucial aspect of IPFS. Without nodes running the IPFS daemon (explained below), there would be no IPFS Network.

Is it possible to completely delete my files on IPFS if I want?

No. There’s a new concept called ‘Pinning’. If you ‘pinned’ the file, then the file will be marked as ‘never purged’, so your files will never be deleted. On the other hand, if you don’t ‘pin’ the file, your file will be purged after a certain amount of time. We call this time a ‘lifecycle’.

When all the nodes activate ‘Garbage collection’, usually when the storage reaches 90% of set storage or is triggered manually, your files are deleted. But there’s still a chance that your files are not deleted permanently.

Long-term storage on IPFS?

Yes, it’s possible. Storing data using a personal IPFS node is easy, but it can be inconvenient since you have to manage your hardware. This problem gave rise to pinning services, paid services that allow you to upload your data to a remotely hosted IPFS node and retrieve it whenever you want. However, while paying a pinning service to store data is a convenient workaround, it still requires someone to bear the cost of storing that data. If that one sponsor stops paying for that pinning, the content may be lost entirely. While IPFS guarantees that any content on the network is discoverable, it doesn’t guarantee that any content is persistently available. This is where Filecoin comes in.

What the heck is Filecoin?

Filecoin is a decentralized storage network in which storage providers rent their storage space to clients. The client and the storage provider agree on how much data will be stored, for how long, and at what cost. This agreement is called a deal. Once both parties agree to a deal, the client sends the data to the storage provider, who periodically verifies that they are correctly storing the data. When the client wants the data back, they send a request to the storage provider, who initiates the data transfer back to the client. For more information on how Filecoin works, head over to the official Filecoin documentation.

Filecoin provides users with a dependable, long-term storage solution. However, there are some limitations to consider. The retrieval process is not always as fast as an IPFS pinning service, and the minimum file size accepted by a Filecoin storage provider can be several GiB. Also, the process for creating a storage deal may seem complicated to new users who aren’t familiar with blockchain transactions or simply aren’t comfortable working within a command line.

Can I use it right away?

Yes, totally! You can set up an IPFS node on your computer in minutes. If you want to do Long-term Storage, then you can check Infura, Pinata, and NFT.Storage etc.

I would recommend nft.storage as your pinning service because they are free and they are worth trying.

After you upload files to them, they will store the files on their IPFS nodes and Pin the file, so that your files are never deleted.

em, they will Pin the file, and that way you can do long-term storage.

Why don’t I just Pin the file by myself?

Think about picking your files on millions of computers. It will take a HUGE amount of time to find your computer and grab your files. But if you use a Pinning service, you can use their ‘Gateway’ and it will be extremely fast.

What is a ‘Gateway’?

It’s basically like the entrance to the IPFS network. You will need it when accessing your files. You can think of it as an index. You’ve got your CID, and you will need your gateway to access your files. All IPFS nodes at least have a localhost node to access the files stored on your node.

What’s IPNS?

You can host static websites on IPFS, and use your custom domain. Regular IPFS would run into trouble when you are trying to host a website on it. Because when a file is updated and uploaded to the IPFS network, the CID will change.

That’s extremely inconvenient, because when your, such as homepage, is changed, you will need to give your visitors a new CID, and it’s basically impossible.

IPNS fixes this problem by giving your files a fixed CID, it won’t change. So that’s why you should use IPNS when uploading ‘dynamic’ (changes often) files.

How can I get started?

I won’t tell you how to get started in this article because it’s just too easy. And because IPFS is still under development, the version changes a lot and if I give you a script, you may not get the latest version, so go to ipfs.io and Get Started yourselves! It supports both Windows, Linux, and macOS. Always bring official documentation with you and it’s welcome to discuss your experience with all of us!

Have a good time!

References

[1]: InterPlanetary File System – Wikipedia. https://en.wikipedia.org/wiki/InterPlanetary_File_System

[2] IPFS powers the Distributed Web. https://ipfs.io

[3] What is IPFS? | IPFS Docs. https://docs.ipfs.tech/concepts/what-is-ipfs/

[4] How IPFS works | IPFS Docs. https://docs.ipfs.tech/concepts/how-ipfs-works/

[5] Privacy and Encryption | IPFS Docs. https://docs.ipfs.tech/concepts/privacy-and-encryption/

[6] Nodes | IPFS Docs. https://docs.ipfs.tech/concepts/nodes/

[7] IPFS Gateway | IPFS Docs. https://docs.ipfs.tech/concepts/ipfs-gateway/

[8] Persistence | IPFS Docs. https://docs.ipfs.tech/concepts/persistence/

[9] IPNS | IPFS Docs. https://docs.ipfs.tech/concepts/ipns/

[10] NFT.Storage – Free decentralized storage and bandwidth for NFTs on IPFS & Filecoin. https://nft.storage

[11] Web3 Storage – Simple file storage with IPFS & Filecoin. https://web3.storage

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.