Back to top
Published on -
March 2nd, 2023
Written by:

NFT On-Chain vs. Off-Chain Data

The data and mechanisms associated with a Non-Fungible Token and where they are stored.

What is an NFT?

NFT stands for Non-Fungible Token, a digital asset which is unique and indivisible. Non-fungible tokens are digital certificates of ownership for things like collectibles, artworks, or items inside of video games. The NFT is stored on the blockchain, and essential fields of information stored on-chain include the NFT name, description, date created, and the address of the creator. The on-chain data will also typically include an image URL pointing to where the visual content is stored, and custom property information like rarity, collection name, and license information. The fee associated with minting and transferring ownership of an NFT increases with the amount of information stored on-chain. As a result, many NFT’s keep information off-chain in decentralized storage like InterPlanetary File Storage (IPFS) or in a typical cloud service like Microsoft Azure or Amazon S3, and include a link or hash of this data on-chain. 

Each NFT is tracked by a smart contract, which defines the ownership of the NFT and the ability to transfer it. It is the code written onto the blockchain. ERC-721 is the most common token standard for writing NFT smart contracts. ERC-721 specifies some minimum functions and events that must be included in any smart contract to be compliant with the standard. The most popular implementation of the ERC-721 standard is from OpenZeppelin, which is open-source and can be copied freely as a preset or with modification. As implied in the name, the NFT is a token, or certificate of ownership, made possible by a publicly verifiable and timestamped transaction on the blockchain, and is not the media itself. This distinction causes confusion for many people, sparking the “right-click, save-as” meme. The combination of the smart contract, metadata, and media, comprise the token that you hold.

On-Chain vs. Off-Chain

When developing an NFT project, you have some choices about what data is written to the blockchain itself, and what remains off the chain and is instead referenced within the NFT smart contract. Below is a chart which lays out the pros and cons of operating a few key mechanisms and NFT data either on or off the blockchain. It is organized first by describing transfers and ownership, payments and auctions; followed by token metadata, media, and token-gated media.

NFT Ownership and Sale Mechanisms
Ownership and Transfers Payments Auction Mechanism
DESCRIPTION: The main smart contract or alternative. The record of who owns the NFT at the current time, and the history of ownership since minting. How and where does payment for an NFT sale take place. All the typical functionality of an auction, including a starting bid, minimum bid increments, and duration etc.
On Chain
Ownership and Transfers Payments Auction Mechanism
PROS - Public and auditable. The publicly verifiable and timestamped certificate of ownership is the value proposition of the NFT.
- Secure and reliable. Major blockchains are secure databases with no single point of failure. Breaches of the security of the network itself are nearly non-existent for blockchains like Ethereum and Bitcoin.
- Large potential audience. Ethereum has over 6 million monthly active adresses (Glassnode).
- 100% uptime.
- Side-chains. E.g. Polygon is a popular Ethereum sidechain for increased transaction speed and throughput with lower fees. Bridges with Ethereum to benefit from its security.
- Layer 2. E.g. Optimism and Abritrum are layer 2 solutions which batch transactions and submit them "rolled up" as a single transaction on the Ethereum blockchain. Layer 2's are a fraction of the cost and execute faster. Final settlement occurs on the Layer 1 blockchain.
- Public payment history. Viewable on-chain. Anyone can verify the value of the NFT through its lifetime.
- Escrow possible. The NFT can be placed in an escrow contract. The buyer sends payment to the contract on-chain, and the NFT is automatically transferred to the address where the payment came from once the owner accepts payment to their address.
- Public bidding. Participants can verify actual auction activity. (Secret bidding is also possible using a commit/reveal or a zero-knowlege transaction.)
- Guaranteed escrow. Both buyer and seller do not have to worry that the sale will be cheated, unfunded, renegged upon, or unable to complete.
CONS - Possibly too much transparency. Anyone can find the ownership of the NFT by looking through a block explorer like Etherscan.
- Inability to reverse. Blockchain transactions cannot be reversed. Care must be taken to ensure all information is correct before finalizing the transaction.
- Difficulty of automating actions. A transaction must be signed with a private key at the time of transfer requiring special models for security.
- Requires some user knowlege. Buyers and sellers must have crypto wallets set up and have transferred funds into them in order to transact directly on the blockchain.
- Speed. Chains like Ethereum take time to confirm settlement, between minutes and hours. (Though other chains like Polygon and Avalanche optimize for faster transaction times.)
- Lack of buyer privacy. Some owners or sellers may not want others to know how much they paid for an NFT. - Cost for high activity. In an active auction, every bid would incur a transaction cost.
- Visible. All bids are visible by default.
- Difficult to do secret bidding. Compared with existing off-chain solutions.
NOTES Zora is one implementation of an on-chain auction market.
Off Chain
Ownership and Transfers Payments Auction Mechanism
PROS - Private.
- Total control. The ledger would be a closed ecosystem.
- No transaction fees.
- High speed. Or can be scaled with investment.
- Familiar payment methods. Can pay with traditional methods like credit cards.
- No buyer knowlege required. Easier onboarding.
- Reversible payments.
- Fully customizable. Easier to customize the auction mechanism to include secret bidding, sealed bidding, or advanced bidding.
- Low Fees. In a highly active auction, being off-chain can save substantially on the gas fees required to submit bids.
CONS - Not verifiable. A private ledger is not a publicly verifiable blockchain. Requires participants to trust the host.
- Single point of failure. Which is vulnerable to attack and service downtime.
- Significant responsibility for security. Costs to maintain and monitor a digital marketplace.
- Non-transferable. The NFTs cannot be moved outside of the ecosystem.
- No guarantee of longevity. If the provider goes away, the NFTs are lost. This reduces trust in the initial purchase.
- Requires trust. Requires buyer to trust the seller or marketplace. - Requires trust. Buyers have to trust both the auction house and the owner of the NFT.
NOTES A private ledger or database can contain the data and a list of transactions.
Both On and Off Chain
Ownership and Transfers Payments Auction Mechanism
PROS - Privacy. If NFTs remain on a private network they remain confidential, with an option for users to transfer onto a public blockchain network. - Flexibility. Users who prefer the security and settlement of the blockchain have the option, and users who prefer traditional payments can still purchase an NFT. - Best for platforms which support multiple auction types.
CONS - Complexity. Managing transfers of ownership between both on and off-chain systems requires active management. - Complexity. Syncing inventory between two payment systems adds an additional layer of product management. - Developing an auction platform that functions both on and off-chain duplicates significant amounts of time and effort.
NOTES Transactions should not be duplicated. A record of transactions could be stored off-chain as a backup.
- Possibilities include: Off-chain system, but allow transfers out of the private network. Start off-chain but plan to migrate on-chain. Certain types of NFTs remain off-chain but others on, due to legal or privacy restrictions.
Offering both on-chain and off-chain payment methods is possible. Payments off-chain does not even require the buyer to hold cryptocrrency. - Simplest bidding done on-chain, while advanced functionality remains off-chain.
Current Recommendation
Ownership and Transfers Payments Auction Mechanism
RECOMMENDATION ON CHAIN BOTH ON AND OFF CHAIN OFF CHAIN
NOTES The timestamped signature that proves ownership publicly and verifiably is the core innovation of the NFT. Flexibility for users unfamiliar with the blockchain, while maintaining security and final settlement by being on-chain. In a highly active auction, being off-chain can save substantially on the gas fees required to submit bids.
NFT Data and Associated Mechanisms
Metadata Media Token-Gated Media
DESCRIPTION: Information like name, description, date created, and the address of the creator as well as custom property information like rarity, collection name, and license information. The data of the image, video, or other media. Media or something else where only holders of the NFT have access.
Off Chain
Metadata Media Token-Gated Media
PROS - High flexiblity. The type and parameters of Metadata can be easy to change over time. - Low storage costs.
- High speed. The speed of data retrieval (seeing your NFT art or collectible) is only limited by the connection to a cloud server.
- High flexiblity. Many types of data could be stored on IPFS or cloud storage in various configuations.
- Simpler. Holder uses their wallet credentials to gain access. After that it would be like any private site.
CONS - Mutability. Any information stored off-chain could be edited. Buyers have less confidence that their NFTs' attributes are secure. - Security and Reliability. If the file storage system shuts down, or if the file is moved years in the future, the URL stored on-chain would not point to any data.
- Centralized point of failure. This does not apply to decentralized storage like IPFS. Centralized storage solutions are vulnerable to attacks, but the most popular options have extremely robust security standards.
- Integrity Vulnerability. Data stored with a third-party is at risk of being altered or removed.
- Membership limited to one marketplace. NFT's benefit from interoperability between companies and services. The "members-only" club on-chain works as long as the chain and media are accessible. An off-chain exclusive area is limited to a single marketplace or company.
NOTES Options:

- Cloud storage systems like Microsoft Azure and Amazon S3 are often used for centralised solutions and are definitely used for caching data.
- Private storage with a virtual private server are possible as well.
On Chain
Metadata Media Token-Gated Media
PROS - Tamper-proof. Once the data is on-chain, you know it is true and verifiable. - High security and reliability. All the security, reliability, and tamper-proof benefits of the blockchain apply to the media.
- Simpler concept. No external links to data.
- Provable presence. If the data is on chain the buyer can be sure there is special media available for the owner.
CONS - Higher fees. The more data stored on-chain, the more expensive an NFT is to mint and transfer. Metadata varies in size and complexity. - Really high fees / not possible. Usually prohibitively expensive.
- Limited size. Media could be stored on chain but would have to be quite small.
- Lower speed or higher complexity. Blockchain tools are generally not designed around handling large amounts of data.
- Complicated implementation. Since the blockchain is public, the data would have to be encrypted.
- If compromised cannot be removed. If the key for the token-gated data is compromised, it could be difficult to make the unavailable again.
NOTES Media can theoretically be stored on a blockchain but practically the amount of information makes the cost prohibitive. Could be on-chain and encrypted however this is not a standard practice.
IPFS
Metadata Media Token-Gated Media
PROS - Secure, verifiable, and recoverable with backups.
- Low cost. Benefits from decentralization similar to a blockchain but without the expensive transaction fees.
CONS - Security. IPFS does not benefit from the Proof-of-Work or Proof-of-Stake security that blockchains employ. - Public. Sensitive documents could be encrypted but this adds complexity and you lose some of the benefit of an open system. - By definition IPFS is public. Would be complex to encrypt files and gate access on IPFS.
NOTES - InterPlanetary File System (IPFS) is a common and decentralized way to store NFT data. It has similarities to blockchain storage. IPFS uses a peer-to-peer network of nodes to store files. Anyone can run a node and connect to the network.

Metadata and media fall in a special category where a hybrid approach is recommended:

On-Chain NFT => IPFS Metadata and Media => Cached / mirrored on cloud infrastructure
Current Recommendation
Metadata Media Token-Gated Media
RECOMMENDATION DECENTRALIZED USING IPFS DECENTRALIZED USING IPFS OFF CHAIN
NOTES Save cost by keeping additional metadata on IPFS, and critical data fields on-chain. IPFS is the de-facto standard for decentralized and cost-effective file storage. Easiest way to privately gate media for your specific project.

Striking a Balance

In general, the on-chain/off-chain tradeoff is always between security, reliability, and verifiability; vs. cost, flexibility, and speed. However, some types of data (as illustrated in the chart above) are more suited to being stored off-chain to reduce the size and complexity of the NFT smart contract. One possible strategy would be as follows:

  • Keep NFT ownership and transfers on-chain.
  • Allow payments to be made both on and off-chain. 
  • Any mechanisms for auctioning NFTs and storing token-gated media can remain off-chain for cost-savings and ease of operation. 
  • Token metadata and the media itself can be stored off-chain in a decentralized storage system like IPFS, with backups on a cloud storage provider. 

This setup optimizes the benefits of both on-chain and off-chain solutions. Of course, this is just one way of structuring an NFT project, and thousands of successful platforms use a wide range of tactics. The strategy is developed with the Ethereum Mainnet in mind, where gas fees and minting costs can be prohibitively expensive. More token metadata could be written directly onto the on-chain smart contract if using a blockchain with lower fees like Avalanche, or a side-chain/layer 2 like Polygon or Optimism. 

Additionally, the amount of data that should be stored on-chain depends on the goals and complexity of your NFT project. If you don’t know where to start, we can help. Get in touch about using our blockchain application server MultiBaas to help build a customized NFT project, or if you want to start selling NFTs right away on Shopify, take a look at our NFTeapot Shopify App.