NFT Metadata Storage in Web3: IPFS, cloud, or on-chain
The world of web3 has been rapidly evolving in recent years, with more companies exploring the potential of blockchain technology. Decentralized applications, or dApps, have become a popular area of focus, and non-fungible tokens (NFTs) have emerged as a critical component of this ecosystem.
NFTs are used for various purposes, including digital art and collectibles, exclusive-access memberships, and verifiable credentials. As their applications continue to grow, it has become clear that the way we store and manage the metadata associated with those tokens is crucial.
In this blog post, we will explore the different options for NFT metadata storage in web3, debunk common misconceptions about decentralized storage, and provide guidance on how to get started with the best storage option for your needs.
One of the most common misconceptions about web3 storage is that an NFT's image or the underlying metadata that comprises it is stored on the blockchain. In most NFT projects, the token's metadata - including information about what the image looks like and when it was created or modified - is usually not stored on the blockchain. Instead, the token's unique identifier (or ID), which doesn't contain metadata, is stored on-chain.
The metadata is linked to where it is stored off-chain, on the cloud, or in a decentralized storage solution like IPFS.
While it is possible to store an NFT's image metadata directly on the blockchain, on-chain storage is limited in other aspects. As a result, most projects store their NFT metadata off-chain. For example, NFTs with high-resolution images or in different media formats like video or audio usually store their data off-chain.
There are three main options to consider when deciding how to store your NFT metadata: cloud storage solutions like Amazon Web Services (AWS) or Google Cloud, decentralized storage solutions like IPFS, or fully on-chain storage. Let's break down the different options for web3 storage, and what the pros and cons are for each.
When creating an NFT, the token ID of the asset is stored on the blockchain. But contrary to popular belief, the image's metadata is usually stored "off-chain" in a centralized server maintained by a cloud hosting provider like AWS or Google Cloud. This means that the metadata is dependent on that hosting provider to be rendered.
- Cloud storage is easy to use.
- Cloud storage is very secure, with all data encrypted at the physical level.
- Cloud storage is fairly reliable, with little downtime.
If your NFT metadata lives within a "centralized" server, then it risks being deleted, lost, or corrupted, which could cause your NFT's asset to be lost. If you stop paying for storage, you will lose access to your NFT metadata.
The most popular decentralized storage solution is IPFS. It uses a distributed network of computers to host content, meaning it doesn't rely on a central server to facilitate seamless, secure, and low-latency data distribution.
IPFS is widely regarded as the go-to decentralized storage solution for Web3 applications due to its unique architecture, security, and reliability.
The distributed network of computers that make up IPFS allows for high availability, making it an ideal solution for hosting your metadata. IPFS is also censorship-resistant, meaning that data stored on the network is immutable and cannot be tampered with.
Furthermore, IPFS is not built on top of a blockchain. Instead, it is used as a decentralized network that is linked to the blockchain. This means that data stored on IPFS is not stored on the blockchain but linked to it.
IPFS is a decentralized file discovery system, which means that it tells you where files live, rather than storing them.
There are a few drawbacks to using IPFS for NFT metadata storage. One of the cons is privacy.
- IPFS storage is public, and everyone can see the stored data.
- Slow upload times, which can be a hindrance for Web3 applications that require quick data transfers.
- Managing the files can be complex if you haven't got experience with development.
There are several popular IPFS gateways you can use now ranging in price:
Some NFT generator platforms such as NFT-Inator handle the entire process of uploading to IPFS. All you need to get started is your artwork and the metadata and artwork pinning is completely taken care of.
We like to use NFT Storage for smaller projects as it's completely free, and Pinata when creating more demanding collections.
On-chain metadata is not dependent on a centralized server, or even IPFS. Instead, it is uploaded directly into the blockchain attached to a smart contract, meaning the data is completely decentralised.
Data stored on the blockchain has a number of innovations that off-chain data does not. It boasts a similar set of advantages to IPFS but on-chain storage:
- Decentralized & secure: Since your data is not stored on a centralized server, controlled by a single organization or entity, it can't be deleted or lost.
- Composable & permissionless: Data on the blockchain can be used permissionlessly by other contracts or off-chain software.
- Eternal: On-chain data will survive for as long as the underlying blockchain does.
- Transparency: For data that is meant to be publicly accessible — such as NFT metadata — on-chain storage is great because it increases transparency for users and holders of the NFTs.
While on-chain metadata has several benefits, it also comes with some notable drawbacks.
- One significant disadvantage of on-chain metadata is slow upload times. Because the blockchain network must validate each transaction and store it across multiple nodes, the process can be slow and time-consuming.
- On-chain metadata can also be challenging to manage and maintain. On-chain metadata is not typically designed for easy retrieval or management and therefore developers may need to create custom tools or applications to interact with the data, which can be complex and time-consuming.
- Lastly, the transparency of on-chain metadata can be both a pro and a con. While the public and immutable nature of the blockchain can increase transparency and accountability, it also means that anyone can access and view the data stored on-chain.
In conclusion, there are several options for storing metadata in decentralized systems, each with its advantages and disadvantages.
On-chain metadata is beneficial for data immutability and transparency, but it comes with high transaction costs, scalability limitations, and the risk of bloat. Off-chain metadata, on the other hand, is flexible and low-cost, but it poses a risk of data loss, lack of transparency, and security vulnerabilities.
Decentralized storage solutions like IPFS provide a great alternative to traditional storage solutions, enabling secure, low-latency data distribution, and high availability.
While there are trade-offs associated with each approach, the choice of metadata storage largely depends on the specific use case, technical requirements, and user preferences. Therefore, developers and organizations should carefully evaluate these options before choosing the most suitable approach for their decentralized application.
Personally, we'd recommend IPFS as the goto option for storing your NFT metadata. If you're unsure about the option that's best for you please feel free to reach out and our team will be more than happy to assist.