How NFTs Work: Metadata, IPFS and On-Chain Royalties Explained
A technical breakdown of non-fungible tokens, detailing the relationship between token IDs, smart contracts, off-chain metadata storage, and the execution of creator royalties.
Key points
- An NFT consists of a smart contract address and a unique token ID recorded on a blockchain ledger.
- Most NFT media and metadata are stored off-chain, using IPFS or centralized servers to avoid high on-chain storage costs.
- Creator royalties are typically enforced by marketplace applications, not hardcoded into the base transfer protocol of standard tokens.
- The ERC-721 standard governs token transfers and ownership tracking on Ethereum and compatible networks.
A non-fungible token is fundamentally a combination of a smart contract address and a unique token identifier recorded on a blockchain. The actual digital asset—such as an image, video, or audio file—is rarely stored on the blockchain itself due to data constraints and network fees. Instead, the token acts as a cryptographic pointer to off-chain data, establishing a record of ownership for that specific pointer 1.
The Anatomy of an NFT: Contracts and Token IDs
At its core, a non-fungible token (NFT) operates through a smart contract, which is a self-executing program deployed on a blockchain like Ethereum ($ETH). The most common technical standard for these tokens is ERC-721, which defines a minimum interface that a smart contract must implement to allow unique tokens to be managed, owned, and traded 1.
When a user mints or acquires an NFT, the blockchain does not record a visual file in the user's wallet. It records a state change in the smart contract. The contract maintains a ledger mapping a specific Token ID (a unique integer) to an owner's blockchain address. Therefore, the identity of an NFT is entirely defined by two elements: the contract address and the token ID. If Alice owns token ID 45 of a specific contract, the blockchain simply reflects that address 0xAlice has control over token 45 within that specific program's internal registry.
Metadata: The Bridge Between Token and Asset
To associate a token ID with a digital artwork or utility, the smart contract utilizes a Uniform Resource Identifier (URI). The URI points to the token's metadata, typically formatted as a JSON (JavaScript Object Notation) file 1. This JSON file contains the descriptive properties of the NFT, including its name, description, traits, and the actual URL where the media file is hosted.
When a marketplace or wallet application displays an NFT, it executes a read function on the smart contract to retrieve the URI. It then fetches the JSON file from that URI, reads the media link within the JSON, and displays the underlying image or asset to the user.
Where the Data Lives: Storage Solutions
The location of the metadata and the media file dictates the permanence and security of the NFT. There are three primary storage paradigms:
- Centralized Servers: The URI points to a traditional web server (e.g., AWS). If the server goes offline or the domain registration expires, the metadata and image vanish, resulting in a "dead" token. The token still exists on the blockchain, but it points to a broken link.
- InterPlanetary File System (IPFS): IPFS is a decentralized, peer-to-peer file sharing network 2. Instead of location-based addressing (finding a file by where it is stored), IPFS uses content-based addressing. When a file is uploaded to IPFS, it is cryptographically hashed to produce a unique Content Identifier (CID). The NFT's URI points to this CID. If a single pixel in the image changes, the CID changes entirely, ensuring the asset cannot be silently altered.
- On-Chain Storage: The metadata and media are encoded directly into the smart contract on the blockchain. This method relies heavily on scalable vector graphics (SVG) or extremely small text files due to block space limits and high transaction costs.
To illustrate the cost barrier of on-chain storage: Storing data on the Ethereum blockchain requires gas. Historically, storing 1 kilobyte of data can cost a fraction of an ETH. If a user attempts to upload a standard 2-megabyte (2,048 kilobytes) JPEG directly to the Ethereum mainnet, the transaction would require millions of units of gas. At a theoretical base fee of 30 gwei, storing that 2MB image would cost roughly 1.8 ETH in gas fees alone. Consequently, pointing to an IPFS hash—which requires storing a string of less than 60 characters on-chain—is the standard industry practice.
Provenance and Verification
The primary utility of the blockchain in this system is establishing provenance. Because the ledger is public and immutable, anyone can trace the ownership history of a specific token ID back to the block where it was minted. Digital signatures verify that transactions are authorized by the owner of the private keys controlling the address 1.
This on-chain record allows buyers and marketplaces to verify that a token originated from the official creator's smart contract. While anyone can right-click and save an image, or even mint a new token pointing to the exact same IPFS CID, the counterfeit token will have a different contract address. Marketplaces differentiate genuine assets from counterfeits by verifying the contract address against the creator's public claims.
The Reality of Royalties
A persistent narrative in the digital asset space is that smart contracts automatically enforce creator royalties on secondary sales. This is largely inaccurate at the base protocol level. The ERC-721 standard handles transfers, not marketplace economics 1.
When an NFT is transferred between wallets, the base contract simply updates the ownership registry. It has no mechanism to determine if the transfer was a sale, a gift, or a wallet consolidation, nor does it know the financial value exchanged off-contract or in a separate marketplace protocol.
Royalties are traditionally enforced at the application level by centralized marketplaces. To standardize this, the ecosystem introduced EIP-2981, the NFT Royalty Standard 3. EIP-2981 adds a function to the smart contract that allows marketplaces to query the contract for a royalty percentage and a receiver address based on a specific sale price. However, EIP-2981 is merely a signaling standard; it relies entirely on the third-party marketplace to honor the calculation and execute the payment. If a buyer and seller trade the token through a decentralized exchange that ignores EIP-2981, or transfer it peer-to-peer, no royalty is paid.
Common Misconceptions
- Ownership of the copyright: Holding a token ID does not inherently grant intellectual property rights or copyright to the underlying media. Unless explicitly outlined in a binding legal license attached to the contract, the purchaser acquires only the cryptographic token, not the commercial rights to the artwork.
- On-chain permanence guarantees: Because most media lives off-chain, the permanence of the image relies on the hosting infrastructure. Even IPFS requires "pinning"—where a node actively chooses to host the data. If all nodes stop pinning an IPFS CID, the data becomes irretrievable.
- Protocol-level royalties: As detailed above, creator fees are not hardcoded into the base transfer function of standard NFTs. They are honored voluntarily by marketplace applications.
What to Watch
The infrastructure surrounding digital ownership continues to evolve beyond static images. Developers are exploring dynamic metadata, where the JSON file updates based on on-chain events or external data feeds. Additionally, new contract standards attempt to bridge the gap between base-layer transfers and marketplace enforcement, seeking ways to embed royalty logic directly into decentralized exchange protocols.
Regulatory scrutiny is also increasing. Jurisdictions like the European Union under the Markets in Crypto-Assets (MiCA) regulation distinguish between truly unique, non-fungible assets and fractionalized or serialized collections, which may be treated as financial instruments depending on their structure and issuance 4. As the technology matures, expect a shift toward more complex utility, such as the ARCOS Unveils Modular State-Machine Framework to Expand NFT Ownership Rights, which aims to standardize how tokens interact with decentralized applications beyond simple ownership transfers.
Questions this story raises
- Is the image stored on the blockchain?
- Usually, no. Due to block size limits and high transaction fees, most NFTs store only a URI on-chain, which points to metadata and an image hosted on off-chain servers or decentralized networks like IPFS.
- What is an IPFS CID?
- A Content Identifier (CID) is a unique cryptographic hash generated by the InterPlanetary File System based on a file's contents. If the file is altered, the CID changes, preventing silent modifications to off-chain NFT media.
- Do smart contracts guarantee royalties?
- No. The base protocol for NFTs (like ERC-721) manages transfers, not trades. Royalty standards like EIP-2981 signal a creator's fee preference, but enforcement relies on the marketplace executing the transaction.
References
- [1] Content Addressing on IPFS — Protocol Labs
- [2] EIP-2981: NFT Royalty Standard — Ethereum Improvement Proposals
- [3] ERC-721 Non-Fungible Token Standard — Ethereum Foundation
- [4] Markets in Crypto-Assets Regulation (MiCA) — European Securities and Markets Authority
Evergreen explainer written by Basis Desk's system and checked by an independent model pass for factual errors and advice language. Figures, fees and rules change — the references above are where to verify current specifics. Market figures marked "at the time of writing" come from live exchange data. Report an error: corrections@basisdesk.news · corrections policy.
The Daily Brief, in your inbox at 07:00 ET
Five stories, the numbers that moved, what to watch. Three minutes. No hype, no advice, unsubscribe in one click.
Get the big crypto stories first
A few alerts a day at most: major breaking news and the morning brief. Switch off anytime.
Not financial advice. Basis Desk publishes information, not recommendations. Crypto assets are volatile and you can lose what you invest.