Mutable File System | Lesson 1 of 11

Introducing IPFS

IPFS: The InterPlanetary File System

IPFS, or the InterPlanetary File System, is a peer-to-peer (P2P) networking protocol used to share data on the distributed web. As its full name suggests, you can think of IPFS as a file system, and it has some unique characteristics that make it ideal for safe, decentralized sharing.

If you haven't yet done so, we encourage you to check out our Decentralized Data Structures tutorial, where you can learn all about the decentralized web and how it compares to the web you're accustomed to. There you'll learn all about content addressing, cryptographic hashing, Content Identifiers (CIDs), and sharing with peers, all of which you'll need to understand to make the most of this tutorial on IPFS.

Storing and sharing data in IPFS

Where does content live when it's added to the IPFS network?

As a peer-to-peer data storage system, IPFS allows each user (peer) to host whatever data they'd like locally. When you first add new content to IPFS, you're really just setting it up on your own machine in a format suitable for sharing via the IPFS protocol. Typically you'd install IPFS on your own computer and create a new instance of IPFS (also known as a node) there. That's where your data would live locally, referenced by content addresses (CIDs). Data stored in IPFS can take many forms, but one of the most common use cases is the sharing of traditional files, which we'll learn more about in this tutorial.

You could choose to share your data or files with your peers when you had a network connection, but if you were the only one hosting a particular resource, it would become unavailable to your peers when your machine went offline. Having multiple peers hosting the same files is what makes them more readily available, and using CIDs (unique content identifiers created through cryptograhpic hashing) is what makes this system secure. We'll talk more about sharing in future tutorials, but for now we'll focus on how to work with files within your own IPFS instance.

Mutable File System

Because files in IPFS are content-addressed and immutable, you can't edit files; instead, a new file is created with every change. The Mutable File System (MFS) is a tool built into IPFS that lets you treat files like you normally would in a name-based filesystem — you can add, remove, move, and edit MFS files and have all the work of updating links and hashes taken care of for you. It's an abstraction that lets you deal with immutable data as if it were mutable.

MFS is accessed through the files commands in the IPFS CLI (command-line interface) and API. In this tutorial we'll explore the Files API.

If you've worked with files and directories from the command line before, many of the MFS methods will look very familiar!

Let's start exploring how we can work with files in IPFS!