The Ultimate Guide to Web3 Storage: IPFS vs. On-Chain vs. Cloud

The Ultimate Guide to Web3 Storage: Cloud vs. IPFS vs. On-Chain - Thumbnail Image

The world of web3 has been rapidly evolving in recent years — but even as more companies look towards building on the blockchain, one of the most essential aspects of decentralized applications (or dApps) that is often overlooked is media storage for NFTs (non-fungible tokens).

If you're building in web3, you're most likely going to be using NFTs in one way or another as their applications continue to grow. Used for everything from digital art & collectibles, to exclusive-access memberships, to verifiable credentials — it has become clear that the way we store and manage the metadata associated with those tokens is crucial.

In this blog post, we're going to dive into everything you need to know about storage in web3. We'll cover the different available options for NFT metadata storage, examine the pros and cons of each, and debunk common misconceptions about decentralized storage. We will also briefly go over how to get started with whichever option suits your storage needs best.

What is NFT metadata and how is it different from the token itself?

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. What is actually stored on-chain is the token's unique identified (or ID), which doesn't contain metadata. Instead, it links to where the metadata is stored off-chain, on the cloud or in a decentralized storage solution like IPFS.

This does mean, however, that a token to exist without any associated metadata — which can can cause problems. We'll dive deeper into when exploring the different options for NFT metadata below.

Are NFTs stored on-chain or off-chain?

While it is possible to store an NFT's image metadata directly on the blockchain (with many advantages), on-chain storage is limited in other aspects — and thus, 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. We’ll expand on the pros and cons of on-chain storage below.

How does storing NFT metadata work?

There are 3 main options to consider when deciding how to store your NFT metadata:

  1. Cloud storage solutions like Amazon Web Services (AWS), or Google Cloud
  2. Decentralized storage solutions like IPFS
  3. Fully on-chain storage

Let’s break down the different options for web3 storage, and what the pros & cons are for each.

Option #1: Cloud Storage for NFT Metadata

The blockchain is a decentralized system, so why would you need a centralized storage solution for NFT metadata? The answer lies in the fact that data storage on-chain has its limitations (which we will dive into below).

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 — meaning that the metadata is dependent on that hosting provider to be rendered.

Cloud Storage for NFT Metadata: Pros and Cons

Pros

  • 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

Cons

  • 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

There are two options to opt for when thinking about decentralized web3 storage: on a decentralized storage solution like IPFS, or directly on a blockchain like Ethereum.

Let's cover off-chain decentralized storage first:

Option #2: Decentralized Storage (IPFS) for NFT Metadata

The most popular decentralized storage solution is IPFS, and thus it'll comprise the majority of this blog post.

What is IPFS?

IPFS, which stands for InterPlanetary File System, is a “protocol, hypermedia, and file sharing peer-to-peer network for storing and sharing data in a distributed file system,” built by Protocol Labs.

In simpler terms, IPFS 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 combines common data storage concepts with a versioning system and digital signatures, which allows for high availability, permanence of information, and replication between nodes.

Is IPFS Decentralized? On-Chain vs. Off-Chain Decentralized Storage

There is a common misconception that storing NFT metadata on a decentralized solution like IPFS (which we'll expand on below) means that the NFT is fully stored on the blockchain.

But not every decentralized network is built on top of a blockchain. And so while IPFS is used as a decentralized network, the data on it is not stored on the blockchain — rather, it is linked to it.

You can think of IPFS more as a decentralized file discovery system — telling you where files live — rather than decentralized file storage (which web3 fills that gap for, but more on this later).

IPFS Storage for NFT Metadata: Pros and Cons

Pros

  • Decentralization: Since your data is not stored on a centralized server, controlled by a single organization or entity, it can't be deleted, corrupted, or lost.
  • Censorship-resistance: Same pros that decentralization enables. Your data is immutable and can't be tampered with.
  • Redundancy

Cons

  • Privacy: IPFS is great for storing NFT metadata in most use cases — but not for sensitive data since IPFS storage is public and everyone can see it
  • Slow upload times
  • Unclear pricing models
  • Management overhead

How is IPFS Used to Store NFT Metadata?

IPFS uses content-addressed file discovery instead of source or destination addresses in its links (such as /home/juan/Pictures), which means it's similar to Dropbox in how files are stored and retrieved. However, unlike Dropbox, IPFS has no central server that hosts all the files; instead, each node stores only the parts of files it needs from other peers in its network.

In this way, any user can access any file on IPFS because each node contains some portion of every piece of information available through this network—you can even get access to your own data if there are no nodes near you!

"Storing" an NFT's metadata on IPFS requires for the image to be "pinned" which you can learn more about here:

What Is IPFS and How Does it Store NFT Metadata?
Learn How thirdweb Stores Your NFTs On The InterPlanetary File System (IPFS) And Pins Your NFT Metadata Under The Hood.

What is an IPFS gateway (like NFT.Storage, Pinata, Filebase)?

Storing and managing data on IPFS can be difficult, which is why there are services that deal with the complexity of decentralized storage for you — also known as IPFS gateways. Users can upload their data to these platforms, which then store the data on the IPFS network in a decentralized way.

Some popular IPFS solutions include:

What is Filecoin and How Does it Factor into IPFS Storage?

Filecoin is a decentralized storage network that aims to make it easy for people to store and access files online. Instead of relying on a single company or organization to store your files, Filecoin allows anyone to participate in the network and earn rewards for providing storage space.

Filecoin builds on top of something called IPFS, which stands for InterPlanetary File System. IPFS is a way to address and access files online using a unique identifier called a hash, instead of a traditional URL. By using IPFS, Filecoin ensures that files can be stored and accessed in a decentralized way, with no single point of failure.

Additionally, Filecoin uses a cryptocurrency token called FIL to incentivize users to provide storage space and keep files available for as long as possible. So, Filecoin makes use of IPFS technology and also provides an incentivization mechanism to make sure files are persistently stored on the network.

How to Store NFT Metadata on IPFS

You can learn more about how to store NFT metadata, or any other data when building a web3 application, in this guide:

How To Upload And Pin Files to IPFS
This guide will show how to upload any file to IPFS using thirdweb storage. We will use thirdweb SDK and CLI to achieve this

Sidenote: When you use thirdweb for IPFS storage, you don't have to worry about pinning at all — we do it for you! We don't use local storage or APIs. You own the smart contract, you own the NFTs, and we save the image in the best possible way.

Option #3: On-Chain Storage (IPFS) for NFT Metadata

On-chain metadata is not dependent on a centralized server, or even IPFS. Instead, it is uploaded directly into the blockchain — meaning that the NFT’s image is live-rendered by the smart contract that it’s attached to, giving the requester instructions to create the image right in your browser or mobile phone.

While on-chain rendering is more limited, this also means that the NFTs are stored entirely “on-chain” without any dependencies on external parties — meaning your NFT’s image will exist for as long as the Ethereum blockchain does. There are no centralized servers that you have to pay for access to, and they can’t be turned off.

On-chain NFT metadata, on the other hand, is not stored on a centralized server — but directly on the blockchain — meaning that the NFT’s image is live-rendered by the smart contract that it’s attached to, giving the requester instructions to create the image right in your browser or mobile phone.

While on-chain rendering is more limited due to the simplicity of blockchain programming languages — like Solidity for Ethereum — this also means that the NFTs are stored entirely “on-chain” without dependencies on external parties, meaning your NFT’s image will exist for as long as the Ethereum blockchain survives.

How does on-chain data storage work?

The blockchain is a decentralized database by nature — meaning that on-chain data is publicly visible and can be seen (but not edited) by anyone. Because on-chain metadata is distributed across many computers (or nodes), there is no single point of failure — meaning it's nearly impossible for your data to be corrupted or lost. On-chain data is also permanent and immutable, meaning that it cannot be tampered with or changed by bad actors.

Data stored on the blockchain has a number of innovations that off-chain data does not, highlighted below:

On-Chain Storage for NFT Metadata: Pros and Cons

Pros

  • Decentralized & secure: Since your data is not stored on a centralized server, controlled by a single organization or entity, it can't be deleted, corrupted, or lost. This also means your data is more secure than it is on other solutions.
  • Censorship-resistant: Same pros that decentralization enables. Your data is immutable and can't be tampered with.
  • Composable & permissionless: Data on the blockchain can be used permissionlessly by other contracts or off-chain software. For example, a web3-enabled application can give exclusive access to features for holders of certain NFTs.
  • Eternal: On-chain data will survive for as long as the underlying blockchain does. This is not guaranteed by cloud storage, or even decentralized storage through IPFS. Since no third party is involved in storing your data, users don't have to pay fees or incur maintenance costs to host their data on-chain. This is also a benefit that cloud storage and IPFS storage don't have (since, for IPFS, your image needs to be "pinned").
  • Transparency: This can be a pro or a con, depending on the type of data. 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.
  • Redundant

Cons

  • Privacy / Transparency: Transparency: This can be a pro or a con, depending on the type of data. 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. However, because the blockchain is decentralized and publicly accessible by anyone, it's not a great solution to store sensitive data like company documents or personal information.
  • Slow upload times
  • Unclear pricing models
  • Management overhead & complexity

Fortunately, thirdweb will handle all of the above for you!

How to Store NFT Metadata On-Chain

You can learn more about how to store NFT metadata, or any other data when building a web3 application, in this guide:

How To Create An NFT Collection With On-Chain Metadata
Learn how to create and deploy an ERC721 NFT Collection with on-chain metadata using Solidity and thirdweb’s ContractKit.

Conclusion: Which is Best for Web3 Storage?

Ultimately, there are various options for storing NFT metadata and the best one will vary based on your needs! There is no one-size-fits-all solution for web3 storage, and there are pros and cons to each method of web3 storage.

We hope this blog post has helped you understand why these primary alternatives all exist for web3 storage, and how they might apply to your use case.

If you have any questions, join 30,000+ other builders on our Discord community — or if you'd like more info on how we can help your business with web3, reach out directly!