Immutability | IPFS Docs (2024)

An immutable object is an object whose state cannot be altered or modified once created. Once a file is added to the IPFS network, the content of that file cannot be changed without altering the content identifier (CID) of the file. This feature is excellent for storing data that does not need to change. However, when it comes to content that needs to be altered or updated, immutability becomes a problem. This page discusses how to keep a mutable state built from immutable building blocks.

A CID is an absolute pointer to content. No matter when we request a CID, the CID value will always be the same. This is part of the content's architecture and cannot be changed. To manage immutable files in a mutable system, we need to add another layer that sits on top of CIDs.

As a basic example, let's have two blocks of content with the strings hello and world hashed into two leaf nodes with the CIDs A and B. If we concatenate these two nodes, then we are given CID C. On top of this root CID, we assign a pointer Pointer.

 +-----------+ | Pointer | +-----------+ ↓ +-----+ +--| C |-+ | +-----+ | | |+-----+ +-----+| A | | B |+-----+ +-----+"hello" "world"

If we change the content of B to IPFS!, all the upstream paths will change as well. In this simple example, the only upstream path is C. If we request content from the pointer we get back new content since the pointer is now pointing at a completely different node. Node B is not being edited, updated, or otherwise changed. Instead, we are creating a new DAG where the pointer points to CID E that joins node A and a new node, node D.

 +-----------+ | Pointer | --------------+ +-----------+ | ↓ +-----+ +-----+ +--| C |-+ +-- | E | --+ | +-----+ | | +-----+ | | | | |+-----+ +-----+ +-----+ +-----+| A | | B | | A | | D |+-----+ +-----+ +-----+ +-----+"hello" "world" "hello" "IPFS!"

Again, node B does not change. It will always refer to the same content, world. Node A also appears in the new DAG. This does not necessarily mean we copied the memory/buffer that contained the hello string into our new message; that would imply the location-addressed paradigm that focuses on the where and not the what. In a content-addressed system, any time someone writes the string hello it will always have CID A, regardless of whether we copied the string from a previous location or we wrote it from scratch.

# Example

In this example, we have a website that displays two headers called header_1 and header_2. The content of the headers is supplied from the variables string_1 and string_2.

<body> <h1 id="header_1"></h1> <h1 id="header_2"></h1></body><script> let string_1 = 'hello' let string_2 = 'world' document.getElementById('header_1').textContent = string_1 document.getElementById('header_2').textContent = string_2</script>

The CID of this website is QmWLdyFMUugMtKZs1xeJCSUKerWd9M627gxjAtp6TLrAgP. Users can go to example.com/QmWLdyFMUugMtKZs1xeJCSUKerWd9M627gxjAtp6TLrAgP (opens new window) to view the site. If we change string_2 to IPFS then the CID of the website changes to Qme1A6ofTweQ1JSfLLdkoehHhpbAAk4Z2hWjyNC7YJF9m5. Now users can go to example.com/Qme1A6ofTweQ1JSfLLdkoehHhpbAAk4Z2hWjyNC7YJF9m5 (opens new window).

Having a user visit the site using the CID is cumbersome since the CID will change every time a variable is updated. So instead, we can use a pointer that maintains the CID of the page with the latest update. This way, users can go to example.com, and always be directed to the latest content. This pointer is mutable; it can be updated to reflect the changes downstream.

+--------+ +---------+ +----------+| User | ---> | Pointer | ---> | QmWLd... |+--------+ +---------+ +----------+

In the website example, when we change a variable, the CID of the webpage is different. The pointer must be updated to redirect users to the latest webpage. What's important is that the old CID still exists. Nothing is overwritten. The original CID QmWLdyFMUugMtKZs1xeJCSUKerWd9M627gxjAtp6TLrAgP will always refer to a webpage with the headers hello and world. What we're doing is constructing a new DAG.

+--------+ +---------+ +----------+| User | ---> | Pointer | | QmWLd... |+--------+ +---------+ +----------+ | | +----------+ + --------> | Qme1A... | +----------+

This process is essentially what the InterPlantery Naming Service (IPNS) does! CIDs can be difficult to deal with and hard to remember, so IPNS saves users from the cumbersome task of dealing with CIDs directly. More importantly, CIDs change with the content because they are the content. Whereas the inbound reference of URLs/pointers stay the same, and the outbound referral changes:

+--------+ +----------------+ +-------------------------------------------------------------+| User | ---> | docs.ipfs.tech | ---> | bafybeigsddxhokzs3swgx6mss5i3gm6jqzv5b45e2xybqg7dr3jmsykrku |+--------+ +----------------+ +-------------------------------------------------------------+
Immutability | IPFS Docs (2024)

FAQs

Is IPFS immutable? ›

Because files in IPFS are content-addressed and immutable, they can be complicated to edit.

What is the point of IPFS? ›

What is IPFS? IPFS stands for Interplanetary File System, a decentralized peer-to-peer file sharing system. Different from the common Internet scheme (HTTP/HTTPS), IPFS is an Internet protocol (or system) that allows people to access content without the need for a centralized server.

Can I change data in IPFS? ›

Once a file is added to the IPFS network, the content of that file cannot be changed without altering the content identifier (CID) of the file. This feature is excellent for storing data that does not need to change.

What to do with IPFS? ›

What is IPFS Used For? Best Use Cases for IPFS Storage: IPFS storage is ideal for high-volume content distribution, like streaming services or software distribution. It's also used in decentralized applications (DApps) to store and access data in a distributed way, ensuring high availability and censorship resistance.

What is the downside of IPFS? ›

Drawbacks of IPFS: Availability Issues: Problem: If a file isn't popular or frequently accessed on IPFS, fewer nodes (computers in the network) might store it. This can make it difficult to access that file when needed.

Is IPFS really permanent? ›

Unlike a blockchain, in which every piece of data is permanent by default (whether you want it to be or not), files on the IPFS network are stored as long as they are pinned.

Is IPFS really decentralized? ›

The InterPlanetary File System (IPFS) is a decentralized protocol, hypermedia, and peer-to-peer (P2P) network for distributed file storage and sharing.

Is IPFS the future? ›

By leveraging IPFS, you can create more secure, efficient, and decentralized blockchain applications that pave the way for a digital future where control is distributed, and access is democratized. The era of IPFS has arrived, bringing with it the promise of a more open, secure, and efficient digital world.

Does IPFS lose data? ›

IPFS uses garbage collection to free disk space on your IPFS node by deleting data that it thinks is no longer needed.

Who owns data in IPFS? ›

IPFS protects data sovereignty by enabling users to store and access data directly on a decentralized network of nodes, rather than centralized, third-party servers. This eliminates the need for intermediaries to control and manage data, giving users full control and ownership over their data.

How long do files last on IPFS? ›

Once a file is uploaded to IPFS, it remains on the network indefinitely and can be accessed by anyone, as long as at least one party has pinned or stored a copy of it.

Can IPFS data be deleted? ›

You can't edit a file once it's on IPFS. You can edit the original file that isn't on IPFS, and then add that to IPFS but you'll get a new content hash. The only way you can delete a file is to unpin the content, and then start a garbage collection run. Keep in mind this only removes it from your node.

What is IPFS for dummies? ›

IPFS is a modular suite of protocols for organizing and transferring data, designed from the ground up with the principles of content addressing and peer-to-peer networking . Because IPFS is open-source , there are multiple implementations of IPFS.

What companies use IPFS? ›

The benefits of IPFS services are revolutionizing the current technology sector, causing large companies to implement it in their processes. Netflix, Opera or Chrome are some companies that rely on this technology.

How secure is IPFS? ›

IPFS uses transport-encryption but not content encryption. This means that your data is secure when being sent from one IPFS node to another. However, anyone can download and view that data if they have the CID.

Is IPFS considered on chain? ›

Simply put, IPFS is not a blockchain, but rather a file system. However, IPFS works well alongside blockchains to address some of the technology's inherent limitations. Let's dive into the details.

Top Articles
How do you secure inter-service communication in a microservice architecture?
Surviving College Rejection – Hartstein Psychological Services
Frases para un bendecido domingo: llena tu día con palabras de gratitud y esperanza - Blogfrases
Celebrity Extra
Hertz Car Rental Partnership | Uber
Paula Deen Italian Cream Cake
Vocabulario A Level 2 Pp 36 40 Answers Key
Umn Biology
Www.paystubportal.com/7-11 Login
Pollen Count Central Islip
今月のSpotify Japanese Hip Hopベスト作品 -2024/08-|K.EG
George The Animal Steele Gif
Labor Gigs On Craigslist
Illinois Gun Shows 2022
Cashtapp Atm Near Me
Craigslist Southern Oregon Coast
Dragger Games For The Brain
Craigslist Battle Ground Washington
Imouto Wa Gal Kawaii - Episode 2
Kimoriiii Fansly
Craigslist Pasco Kennewick Richland Washington
When His Eyes Opened Chapter 3123
Sams Gas Price Sanford Fl
Rural King Credit Card Minimum Credit Score
Bfsfcu Truecar
Renfield Showtimes Near Marquee Cinemas - Wakefield 12
Edward Walk In Clinic Plainfield Il
W B Crumel Funeral Home Obituaries
Best Weapons For Psyker Darktide
Pillowtalk Podcast Interview Turns Into 3Some
Solemn Behavior Antonym
New Gold Lee
Frcp 47
1v1.LOL Game [Unblocked] | Play Online
Craigslist Tulsa Ok Farm And Garden
Discover Wisconsin Season 16
Oppenheimer Showtimes Near B&B Theatres Liberty Cinema 12
Www.craigslist.com Waco
Myrtle Beach Craigs List
Az Unblocked Games: Complete with ease | airSlate SignNow
CrossFit 101
RubberDucks Front Office
Server Jobs Near
Sc Pick 3 Past 30 Days Midday
Mejores páginas para ver deportes gratis y online - VidaBytes
Stephen Dilbeck, The First Hicks Baby: 5 Fast Facts You Need to Know
Wrentham Outlets Hours Sunday
Osrs Vorkath Combat Achievements
Metra Union Pacific West Schedule
Bellin Employee Portal
login.microsoftonline.com Reviews | scam or legit check
Latest Posts
Article information

Author: Dan Stracke

Last Updated:

Views: 5932

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.