Jul 24, 2024

Understanding IPNS — InterPlanetary Name System: A Developers Guide

Understanding IPNS — InterPlanetary Name System: A Developers Guide

InterPlanetary File System (IPFS) redefines how information can be stored, accessed, and shared across the internet. A key enabler of this is IPFS’ usage of content-based addressing, where each piece of content on IPFS is identified by a unique hash or content identifier (CID).

CIDs are unique labels in IPFS that serve to identify and address data. They are generated based on the content’s cryptographic hash to ensure content authenticity. Any alteration in the content results in a different CID.

While CIDs make the content on the web more resilient and immutable, it presents challenges when it comes to updating or modifying content. From difficulty in content discovery to challenges related to collaborative efforts, CIDs’ immutability is a logistical nightmare.

This is where the InterPlanetary System (IPNS) comes into play. Let’s explore what IPNS is, how it works, and how it helps in onchain hosting:


IPNS brings mutable addressing to IPFS

The InterPlanetary Naming System or IPNS is a global namespace within the IPFS ecosystem. It leverages Public Key Infrastructure (PKI) to create mutable pointers called IPNS names to immutable CIDs.

This makes it possible to update the pointer to a new CID every time a change is published. As a result, content can be updated without changing the link shared with users.

In other words, IPNS can be thought of as a system used to create links that can be updated over time, while still retaining the verifiability that comes with content addressing.

How IPNS works

In IPNS, a name is generated by hashing a public key associated with an IPNS record. This name is then distributed across the IPFS network so it can be resolved to retrieve the content. Here’s what the process looks like:

Alternatively, developers can create an IPNS record without manually handling cryptographic keys or IPNS naming conventions with a simple function call using Fleek’s IPNS SDK.

In addition to making record creation easy, Fleek’s SDK also abstracts away the complexity associated with publishing, updating, querying, listing, and deleting IPNS records. This allows developers to focus on building their applications without needing to dive into the lower-level details of IPNS and IPFS.

Why use IPNS for onchain content delivery

IPNS offers several key advantages for onchain content delivery such as:

While IPNS offers distinct advantages like dynamic updates, other options like Ethereum Name Service (ENS) also exist.

IPNS and ENS: Creating a user-friendly onchain web

While IPNS names solve the issue of content mutability on IPFS, they’re still not human-readable. For example, an IPNS name might look something like this:

/ipns/QmTzQ1N9nBcghB4zDd9fNCTDhLx9Zs4tW3A9H2m7YyKgVH.

This is where the Ethereum Name Service (ENS) comes into play for users within the Ethereum ecosystem. ENS allows you to map a human-readable name, like example.eth, to various resources, including IPNS addresses.

Here’s how ENS and IPNS can be used in tandem to create a more accessible and user-friendly onchain web:

Using IPNS on Fleek

There are a few ways you can leverage IPNS on Fleek.

1. Fleek SDK

Developers can use Fleek SDK for IPNS to manage IPNS records. The SDK allows authenticated users to create, publish, list, and delete IPNS records within a selected project.

Operations include:

This SDK simplifies managing mutable pointers to CIDs, facilitating dynamic content updates for data stored on IPFS..

2. Fleek CLI

Alternatively, developers can use Fleek CLI interacting with IPNS records.

Similar to the SDK, key functionalities of the CLI includes creating an IPNS record and signing it (with Fleek managing the private key), publishing a record to advertise it across nodes, resolving an IPNS record to retrieve the associated CID, and listing all IPNS records within a project.

Fleek provides developers with command-line tools for straightforward IPNS record management, including updates and deployment associations, enhancing the experience of content management on IPFS.

Both these processes eliminate the need for manual updates and transactions for each content change, significantly reducing the time and cost associated with maintaining up-to-date onchain websites.

Is IPNS the missing piece for onchain hosting?

IPNS represents a significant advancement in the realm of onchain hosting, offering a dynamic solution to the challenge of mutable content addressing on the immutable IPFS (InterPlanetary File System) network.

It facilitates the creation of dynamic, onchain websites and applications by enabling stable, persistent identifiers that can point to updated content without changing the identifier itself.

However, despite its potential, IPNS is not without its shortcomings, which have implications for its broader adoption in onchain hosting solutions.

One of the primary challenges is the process of creating and managing the IPNS records itself. The process can be complex and daunting for developers new to the IPFS ecosystem.

However, with Fleek, developers can interact with IPNS through a more intuitive interface, reducing the complexity and technical barriers associated with direct IPNS usage.

Sign in and get started with building and hosting applications leveraging IPNS today on Fleek.xyz


FAQs

What are the benefits of IPNS?

IPNS allows for the creation of dynamic content under a stable, persistent identifier. That means developers can update or modify content without changing its access link, facilitating easier content management and discoverability.

Can IPFS gateways resolve IPNS names?

Yes. You can use IPFS gateways to resolve IPNS names using path resolution or subdomain resolution. However, when you use an IPFS gateway to resolve IPNS names, you’re relying on it to provide accurate content.

How does one set up an IPNS name?

To set up IPNS in the conventional way, you need to create cryptographic key pairs, publish content to the IPFS, and use IPFS’ built-in commands. Alternatively, you can also use

Fleek’s SDK to streamline the process.