When a Web3 developer begins building their project, they have a whole slew of questions that they need to answer to get started.
What language do I want to write my smart contracts in? What will my project accomplish? What blockchains does it need to use?
One question is often an afterthought: Where will my project’s assets be stored?
For many, they start with local storage on their hard drive, then maybe they upload it to GitHub. Some will upload assets that they need to use in their app to a service like AWS, then reference it using an S3 URL.
These workflows open several vulnerabilities. Local storage without any backup can be destroyed through data corruption or spilling coffee on your laptop. Centralized cloud providers have a single point of failure and come with restrictions like vendor lock-in or limitations regarding how your data can be accessed. GitHub is popular for maintaining code repositories, but for deploying a project to be live on the web, it's often not the best choice.
What if there was a better way to store both your project’s files and any assets that it uses that benefits from decentralization without a single point of failure, plus flexibility for any workflow?
What is IPFS?
IPFS, or Interplanetary File System, is a decentralized content addressing protocol. When a file is uploaded to the IPFS network, it is given a unique identifier called a content identifier, or CID. The CID is a record of the file’s existence on the network. When your file is requested to be viewed or downloaded, the nodes on the IPFS network communicate with one another to determine which node is storing the content referenced by the requested CID.
When another node views or downloads the requested file, it is stored in the node’s cache data, creating another copy of the file within the network. The file will stay in the cache of the node until it is cleared through a process known as the IPFS garbage collection.
To keep files on the network indefinitely, they must pinned. Pinning is when a node on the IPFS network stores content without it being at risk of being deleted through the garbage collection process.
Since IPFS files and folders can be accessed through their CID, they can be referenced from anywhere in the world by anyone using an IPFS gateway. An IPFS gateway is dedicated to retrieving and serving content through a URL. This URL could be an IPFS URL like ipfs:// for programs or platforms that natively support IPFS, or this can be an HTTP URL like ipfs.filebase.io/ipfs.
By using content addressing, files on IPFS are:
- Available for anyone to view or download without authentication.
- Available to be used by programs and platforms without restrictions.
- Stored using a distributed network that is resilient to outages or disruptions.
In addition to content addressing, all files uploaded to IPFS are immutable. Once data is uploaded on IPFS, the file is immutable. If any changes are made to the file when it is re-uploaded, the CID generated for the file is different from the original. This is because when a file is uploaded, the CID is generated based on the cryptographic hash of the file. Any change to the file or its metadata will alter this cryptographic hash.
Filebase: Geo-Redundant IPFS
For a file to be truly decentralized and benefit from the persistence of the IPFS network, the IPFS pinning service must be announcing your data to the DHT, or distributed hash table. The DHT is responsible for mapping CIDs and their associated files across the network. If the IPFS pinning provider doesn’t announce to the DHT and the pinning provider’s node goes offline, so does your data.
Filebase is a geo-redundant IPFS pinning service that announces all data to the DHT. Every file and folder uploaded to the IPFS network through Filebase is automatically pinned to Filebase's IPFS infrastructure. Each pin is stored with a 3x level of redundancy, and each level is located in a different country and datacenter. The combination of DHT announcements and 3x redundancy provides a geo-redundant, reliable, and performant method of storing data on IPFS.
What can I build on IPFS?
IPFS supports all file types, enabling hundreds of thousands of workflows. If you can think of it, you can build it. The most popular use-cases of IPFS currently include:
NFT Collections: NFT collections benefit from using IPFS CIDs to reference each NFT’s visual image file and its associated metadata file.
Decentralized Websites: IPFS supports hosting static websites through IPFS folders that contain the website’s assets and HTML files. These IPFS CIDs can be referenced throughout the world through IPFS gateways. Then, an IPFS gateway can be routed through a domain name like Unstoppable Domains.
Decentralized Applications: dApps benefit from storing assets on IPFS, which can be referenced through their CID without having to reference or manage the files stored in the local development workspace.
Need some inspiration for your project? Check out these Web3 tutorials for ideas and workflows using IPFS on Filebase.
You can sign up for a free Filebase account to get started with your IPFS journey today.