搜索
首页 / 公司新闻 / Storing NFT on IPFs
返回

Storing NFT on IPFs

浏览次数:88 分类:公司新闻

Permanence and invariance are part of the core value proposition of irreplaceable General Certificate (NFT), which provides the Creator with unique advantages in copyright protection and creates a very large imagination space for the digital collection field. However, due to the fundamental design defects, many NFT can not provide these two features.

We often hear the saying that NFT “always exists on blockchain”, but generally, due to the cost and space constraints of storing data on the blockchain, only ownership records are actually stored, as well as metadata linked to the actual content of NFT. But these links are fragile, using HTTP protocol to point users to specific locations, not specific assets. This means that content pointed by links can be changed or taken offline at any time in the future, thus making the original asset lost forever.

IPFs can help solve these problems and give NFTs through IPFs some advantages. Of course, compliance with established conventions is essential to ensure the persistence and accessibility of data stored on the network. With the popularity of non replaceable tokens (NFT), it is time to review best practices for linking and storing NFT data on IPFs. Content addressing

The IPFs content identifier (CID) is an extremely stable and flexible way to uniquely identify any content, regardless of where it is stored or how it is stored. To maximize these advantages, developers should follow the following recommendations and conventions to link to IPFs data.

IPFs

The following information needs to be mastered:

1.1 CID

CID is a self description unique identifier for a section of content. CID should be used within the application code and in other contexts, whether you are using IPFs or other systems. We recommend that CID IDS cannot be changed after they are created whenever they are stored on disk, especially after they are converted to IPFs URIs in metadata and blockchain records. include ipfs://URI The scenario adds important contexts to the CID, which clearly shows users and automated tools how to find content.

1.2 IPFS URI

The IPFs URI unified resource identifier (or URI) is used to specify specific content in a given context. The context is determined by the URI scheme. The URI scheme of IPFs is IPFs, which can optionally contain a path appended to the end

The IPFs URI is the specification identifier of the IPFs link to a file or directory. When linking to IPFs data from a smart contract, use the IPFs URI to explicitly indicate that the data should be retrieved using IPFs. IPFs URIs should also be used in the structured metadata of NFT when linked to images and other media assets stored on IPFs.

1.3 HTTP gateway URL

The HTTP gateway provides interoperability for older browsers that cannot resolve IPFs URIs locally. Such links should only be used in the presentation layer of the application, not stored within blockchain or NFT metadata.

Note that the HTTP gateway refocuses content distribution, showing both the middleman vector and a single point of failure – if the gateway operator is offline or inaccessible, the link will be broken. However, browsers that are built-in support of IPFs (extended through the IPFs companion browser or native support via brave) can avoid these problems because they can automatically extract CID from this class link and load IPFs to provide data based on user preferences.

Content addressing in various cases

Developers should set different link formats based on the context.

2.1 chain

The NFT smart contract should return the IPFs URI back to the assets and metadata associated with each token.

We recommend that IPFs URIs be generated before casting each token and storing the full URI on the chain. This is the easiest way to meet the expectations of using the intelligent contract interface with URIs, and the IPFs scheme makes it easy for any distributed application to see data available using IPFs.

2.2 metadata

In metadata, IPFs URIs should be used as the most explicit and reliable way to link to IPFs resources in clear text.

Developers may want to include links to public HTTP gateways to achieve traditional interoperability.

Ideally, alternative methods of linking to content should be avoided (for example, non gateway HTTP URLs). Because content provided over HTTP from a specific location may change, you cannot rely on such links except for temporary content mirroring. Therefore, on a blockchain where data is stored permanently and immutably, the content referenced over HTTP is very fragile and risky.

Instead, IPFs URIs are always valid, so they can be safely considered as canonical links to their data. By using the IPFs URI as the “source of fact” of the link, applications can easily support multiple storage solutions, or easily switch to different gateways over time, just generate new gateway links. This is more flexible than “hard coding” of a specific gateway to a permanent blockchain record.

2.3 Application

In user oriented applications, developers should link to IPFs content in two ways: IPFs URI and HTTP gateway URL.

Until more browsers support native resolution of IPFs URI schemes. Note that you can easily generate two links from the original CID or IPFs URI as needed.

effect

One of the main problems facing NFT is the integrity of assets – which includes the assets themselves and any data related to the assets. IPFs protects the integrity of NFT data by using CID validation that there has been no changes since the link was created. Developers should follow the following recommendations to maximize benefits from the built-in data validation of IPFs.

NFT

3.1 linking metadata to its assets

Metadata should be considered an integral part of the NFT value. Therefore, in order to preserve the value of the asset, metadata should be stored on IPFs with the asset to ensure both are accessible.

The methods to achieve this are as follows:

Create two new directories (one for assets and one for metadata)

Add assets to their catalog

Add the asset catalog to IPFs and note its CID

Create metadata in your own directory, use CID reference assets to create IPFs URIs, which should contain the CID of the directory and the file name of the asset;

Add the directory of metadata to IPFs, and note its CID

Use CID to create an IPFs URI for metadata and store the URI on the chain to form a ownership record.

This process retains the ability of developers to include file names in their links (useful for user interaction), while ensuring that metadata and assets can be referenced independently of each other.

3.2 high availability

The main reason why we use decentralized networks like IPFs to provide content is to prevent link failure, which requires nodes in other networks to manage mirrored data. To ensure that the linked content is still available, developers should secure the CID of the content on the IPFs node they manage and save and distribute the content with others who want to help, so that they can host the content themselves. Of course, you can also host content through fixed services.

标签:ipfsNFT

点击取消回复

    分类

    在线客服x

    客服
    顶部 回到顶部