What is a Non-Fungible Token(NFT) ?

What is a non-fungible token?

The Non-Fungible-Token Image

Non-fungible tokens (NFTs) are unique, digital items with blockchain-managed ownership. Examples include collectibles, game items, digital art, event tickets, domain names, and even ownership records for physical assets.

Non-fungible assets are just normal stuff. Fungible assets are the odd ones out!

Most discussions about non-fungible tokens begin by introducing the idea of fungibility, which is defined as “able to replace or be replaced by another identical item”. We think this overcomplicates things. To get a better sense of what might constitute a non-fungible asset, just think about most of the stuff you own. The chair you’re sitting in, your phone, your laptop, anything you could go and sell on eBay. All of these fall under the category of non-fungible things.

It turns out that fungible assets are actually the odd ones out. A currency is a classic example of a fungible asset. Five dollars is always five dollars no matter the serial number on the specific five-dollar bill, or whether its five dollars sitting in your bank account. The ability to replace a five-dollar bill with another five-dollar bill (or five ones, for that matter) is what makes currency fungible.

Note that fungibility is relative; it really only applies when comparing multiple things. Consider business class, economy class, and first-class flight tickets. Each ticket is roughly fungible within its class, but you couldn’t fairly swap a first-class ticket for a business class ticket. Even the chair you’re sitting in is roughly fungible with a chair of the same model, unless you’ve developed a special attachment to your particular chair.

Interestingly, fungibility can also be subjective. Back to the flight ticket example: a person that cares about sitting in a window seat vs. an aisle seat might not consider two economy class tickets interchangeable. Similarly, a rare penny might be worth 1 cent to me but worth much more to a coin collector. We’ll see that some of these nuances become important when representing these items on blockchains.

Blockchain-based non-fungible tokens

Just as we had digital currencies (think airline points, in-game currencies) before cryptocurrencies emerged, we’ve had non-fungible digital assets since the dawn of the internet. Domain names, event tickets, in-game items, even handles on social networks like Twitter or Facebook, are all non-fungible digital assets; they just vary in their tradeability, liquidity, and interoperability.

So it’s clear we already have tons of digital stuff. But to what extent do we “own” these digital things? If digital ownership only means that an item belongs to you and not someone else, then you own them in some sense. But if digital ownership is more like ownership in the physical world (the freedom to hold and transfer indefinitely), this doesn’t always seem to be the case with digital assets. Rather, you own these assets in specific contexts, which may or may not make moving them around easy. Try to sell a Fortnite skin on eBay, and you’ll discover the difficulty of moving digital assets from one person to another.

This is where blockchains come in! Blockchains provide a coordination layer for digital assets, giving users ownership and management permission. Blockchains add several unique properties to non-fungible assets that change the user and developer relationships with these assets.

Standardization

Traditional digital assets—from event tickets to domain names—have no unified representation in the digital world. A game likely represents its in-game collectibles in an entirely different way than an event ticketing system. By representing non-fungible tokens on public blockchains, developers can build common, reusable, inheritable standards relevant to all non-fungible tokens. These include such basic primitives as ownership, transfer, and simple access control. Additional standards (specifications for how to display an NFT, for example) can be layered on top for rich display inside of applications.

These are analogous to other building blocks of the digital world, like the JPEG or PNG file format for images, HTTP for requests between computers, and HTML / CSS for displaying content on the web. Blockchains add a layer on top that gives developers a brand new set of stateful primitives on which to build applications.

Interoperability

Non-fungible token standards allow non-fungible tokens to move easily across multiple ecosystems. When a developer launches a new NFT project, these NFTs are immediately viewable inside dozens of different wallet providers, tradeable on marketplaces, and, most recently, displayable inside of virtual worlds. This is possible because open standards provide a clear, consistent, reliable, and permissioned API for reading and writing data.

Tradeability

The most compelling feature enabled by interoperability is free trade on open marketplaces. For the first time, users can move items outside of their original environments and into a marketplace where they can take advantage of sophisticated trading capabilities

For game developers specifically, tradeability of assets represents a transition from a closed economy to an open, free-market economy. Game developers no longer have to manage every piece of their economy: from the supply of resources to pricing to capital controls. Instead, they can let free markets do the heavy lifting!

Liquidity

Instant tradeability of non-fungible tokens will lead to higher liquidity. NFT marketplaces can cater to a variety of audiences—from hardcore traders to more novice players—allowing for greater exposure of the assets to a wider pool of buyers. In the same way that the ICO boom of 2017 gave birth to a new asset class driven by instantly liquid tokens, NFTs expand the market for unique digital assets.

Immutability and provable scarcity

Smart contracts allow developers to place hard caps on the supply of non-fungible tokens and enforce persistent properties that cannot be modified after the NFTs are issued. For example, a developer can enforce programmatically that only a specific number of a specific rare item can be created, while keeping the supply of more common items infinite. Developers can also enforce that specific properties do not change over time by encoding them on-chain. This is particularly interesting for art, which relies heavily on the provable scarcity of an original piece.

Programmability

Of course, like traditional digital assets, NFTs are fully programmable. CryptoKitties (which we’ll talk about later) baked in a breeding mechanic directly into the contract that represents the digital cats. Many of today’s NFTs have more complex mechanics, like forging, crafting, redeeming, random generation, etc. The design space is full of possibilities.

Non-fungible token standards

Standards are part of what makes non-fungible tokens powerful. They give developers the guarantee that assets will behave in a specific way and describe exactly how to interact with the basic functionality of the assets.

 

ERC721

Pioneered by CryptoKitties, ERC721 was the first standard for representing non-fungible digital assets. ERC721 is an inheritable Solidity smart contract standard, meaning that developers can easily create new ERC721-compliant contracts by importing it from the OpenZeppelin library ERC721 is actually relatively simple: it provides a mapping of unique identifiers (each of which represents a single asset) to addresses, which represent the owner of that identifier. ERC721 also provides a permissioned way to transfer these assets, using the transferFrom method.

interface ERC721 {
  function ownerOf(uint256 _tokenId) external view returns (address);
  function transferFrom(address _from, address _to, uint256 _tokenId) external payable;
}

If you think about it, these two methods are really all you need to represent an NFT: a way to check who owns what and a way to move things around. There are a few other bells and whistles to the standard (some of which turn out to be very important for NFT marketplaces), but the core of ERC721 is quite basic.

ERC1155

ERC1155, pioneered by the Enjin team, brings the idea of semi-fungibility to the NFT world. With ERC1155, IDs represent not single assets but classes of assets. For example, an ID might represent “swords”, and a wallet could own 1,000 of these swords. In this case, the balanceOf method would return the number of swords owned by a wallet, and a user can transfer any number of these swords by calling transferFrom with the “sword” ID.

interface ERC1155 {
  function balanceOf(address _owner, uint256 _id) external view returns (address);
  function transferFrom(address _from, address _to, uint256 _id, uint256 quantity) external payable;
}

One advantage of this type of system is efficiency: with ERC721, if a user wanted to transfer 1,000 swords, they would need to modify the smart contract’s state (by calling the transferFrom method) for 1,000 unique tokens. With ERC1155, the developer need only call transferFrom with quantity 1,000 and perform a single transfer operation. This increased efficiency, of course, comes with the loss of information: we can no longer trace the history of an individual sword.

Note also that ERC1155 provides a superset of ERC721 functionality, meaning that an ERC721 asset could be built using ERC1155 (you’d simply have a separate ID and quantity 1 for each asset). Due to these advantages, we’ve recently witnessed growing adoption of the ERC1155 standard. OpenSea recently developed a repository on Github for getting started with the ERC1155 standard.

Composables

Composables, led by the ERC-998 standard, provide a template by which NFTs can own both non-fungible and fungible assets. There have only been several composable NFTs deployed on mainnet, but we think there are incredibly exciting opportunities to put them to use!

Non-Ethereum standards

While Ethereum is where most of the action is currently happening, there are several other NFT standards emerging on other chains

 

Non-fungible token metadata

As mentioned, the ownerOf method provides a way to look up the owner of an NFT.

On-chain vs. off-chain

On-chain Metadata

The benefits of representing metadata on-chain are:

1) it permanently resides with the token, persisting beyond the lifecycle of any given application.

2) it can change in accordance with on-chain logic. Point #1 is important if assets are intended to have long-lasting value far beyond their original creation. For example, a piece of digital art is expected to persist throughout the ages, regardless of whether the original website that was used to create the art is still around. It therefore is important that its metadata persist alongside the lifecycle of the token identifier.

Off-chain Metadata

Despite these benefits, most projects store their metadata off-chain simply due to the current storage limitations of the Ethereum blockchain. The ERC721 standard, therefore, includes a method called tokenURI that developers can implement to tell applications where to find the metadata for a given item.

function tokenURI(uint256 _tokenId) public view returns (string)

The tokenURI method returns a public URL. This, in turn, returns a JSON dictionary of data, something like the example dictionary for the CryptoKitty above. This metadata should conform to the official ERC721 metadata standard for it to be picked up by applications like OpenSea. At OpenSea, we want to give developers the ability to build rich metadata that can be displayed inside of our marketplace, so we’ve added extensions to the ERC721 metadata standard that allows developers to include things like traits, animations, and background colors.