description |
---|
Mutable content in IPFS |
One of the most powerful things about IPFS is that any piece of data or content you store on the network cannot be modified with changing the Content Identifier (CID) for that data, since the CID is created (in part) by hashing the content.
The fact that the history of the data are preserved on the blockchain - that is, the content in one block contains, as a part of the data that makes it up, the id of the parent of that block - also contributes to the immutability of that piece of data.
Data on IPFS will not by default remain on that network unless it is pinned. In order to make a piece of data a persistent piece of data, you need to make sure that data is pinned on a node that is active on the IPFS network.
Your options for persistent data are:
- You pin it yourself, and keep that node active on the network
- You make an agreement with a pinning service and pay them to make sure your data persists in long-term storage.
See the full set of resources on the ResNetLab Tutorials page
{% embed url="https://www.youtube.com/watch?v=57guoGS53Bo&t=12s" %}
Since IPFS uses CIDs, if you were to share an IPFS address such as /ipfs/QmbezGequPwcsWo8UL4wDF6a8hYwM1hmbzYv2mnKkEWaUp
with someone, you would need to give the person a new link every time you update the content.
The InterPlanetary Name System (IPNS) solves this issue by creating an address that can be updated.
A name in IPNS is the hash of a public key. It is associated with a record containing information about the hash it links to that is signed by the corresponding private key. New records can be signed and published at any time.
When looking up an IPNS address, use the /ipns/
prefix:
/ipns/QmSrPmbaUKA3ZodhzPWZnpFgcPMFWF4QsxXbkWfEptTBJd
IPNS solves the issue of creating constant links to content that may be updated, and provides the 'new' link to content that you want to share with others. IPNS uses public-link cryptography to assign a link to the content you created on IPFS.
There are a couple of ways you can link to the content you are sharing, either using DNSLink to link using the DNS addressing system, or a truly decentralized solution such as ENS that will help maintain a constant link to the most updated version of a piece of content.
Pubsub Makes it possible for users to share the content with the peers that wish to subscribe to it & delivers messages throughout a decentralized network. Read more in the libp2p docs.