NFT On-Chain vs. Off-Chain Data
Mar 2, 2023
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 Sales Mechanisms | ||
|---|---|---|
Ownership and Transfers | Payments | Auction Mechanism |
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.
| Public payment history. Viewable on-chain. Anyone can verify the value of the NFT through its lifetime.
| Public bidding. Participants can verify actual auction activity. (Secret bidding is also possible using a commit/reveal or a zero-knowlege transaction.)
|
CONS | Possibly too much transparency. Anyone can find the ownership of the NFT by looking through a block explorer like Etherscan.
| 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.
|
NOTES | Zora is one implementation of an on-chain auction market. | ||
Off-Chain | |||
|---|---|---|---|
Ownership and Transfers | Payments | Auction Mechanism | |
PROS | Private.
| Familiar payment methods. Can pay with traditional methods like credit cards.
| Fully customizable. Easier to customize the auction mechanism to include secret bidding, sealed bidding, or advanced bidding.
|
CONS | Not verifiable. A private ledger is not a publicly verifiable blockchain. Requires participants to trust the host.
| 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 Transfer | 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.
| 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 |
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 flexibility. The type and parameters of Metadata can be easy to change over time. | Low storage costs.
| 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.
| 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:
| ||
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.
| 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.
| Complicated implementation. Since the blockchain is public, the data would have to be encrypted.
|
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.
| ||
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. | ||
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.
