Most explanations of NFTs include the phrase “on the blockchain”. Explainers typically describe that NFTs are “nonfungible” because unlike oth

How are NFTs stored? It’s probably not how you think.

submited by
Style Pass
2022-06-22 16:30:14

Most explanations of NFTs include the phrase “on the blockchain”. Explainers typically describe that NFTs are “nonfungible” because unlike other cryptocurrency tokens such as Bitcoins, which are all equivalent to each other, each NFT is unique. Explainers may muse that the reason NFTs are so valuable (many have sold for tens of millions of dollars) is because blockchains can enforce scarcity of tokens, so NFT images can be proven to be rare. A reasonable reader of such explanations might believe that an NFT’s image, or at least a way to determine its rarity, is stored on a blockchain.

Instead, an NFT’s representation on its blockchain is almost always just a pointer to some other location off the blockchain. All data about the NFT is stored at that location.

To demonstrate this, I’ll explain at a high level how NFTs are constructed. NFTs live on blockchains that support “smart contracts”, which is code that is stored on the blockchain. A category of NFTs such as “Bored Apes” is almost always a single smart contract that tracks all of the tokens in that category. For example, Bored Ape #1234 is not its own smart contract, but instead an element in an array in the Bored Ape smart contract. To illustrate, here’s a very simplified pseudocode version of typical NFT smart contract code (a standard called ERC-721, which the vast majority of popular NFTs conform to):

Leave a Comment