6. NFTs and Token Standards#

This tutorial is an introduction to NFTs. We will first look at the Bored Ape Yacht Club collection of NFTs and use this as an examination of what NFTs are. We will then discuss how to create your own NFT through OpenSea. Next, we discuss NFT usecases other than art. Finally, we will learn about different Ethereum token standards.

What are NFTs?#

Let’s revisit Bitcoin for a moment: in the Bitcoin architecture, cash is equivalent to money. You can track the history of every individual “bill” or UTXO (Unspent Transaction Output) to see where it has been spent. Now, shifting our focus to Ethereum, it operates with accounts where all the funds in any account are considered fungible. In other words, in your account, 2 ETH is always 2 ETH, rather than consisting of, say, 2 bills of 1 ETH each or one bill of 1.5 ETH and another of 0.5 ETH. How does this relate to NFTs? NFTs essentially introduce the concept of unique “bills” to Ethereum. From a computer science standpoint, no two NFTs are exactly the same, even if they are meant to represent the same thing in practical terms. Since the Ethereum ecosystem already has Ether as its native currency, NFTs are not primarily used for transactions; instead, they serve various purposes, such as art ownership, in-game assets, proof of attendance at events, and online identity verification.

To illustrate this, consider the Bored Ape Yacht Club collection, where the most expensive Bored Ape was sold for $3,408,000.

Image

The Bored Ape Yacht Club was the first collection of digital art that really took off. Each image of a Bored Ape is like a unique bill, in spite of the fact that the same source and share many design features. Let’s consider stablecoins again, like DAI. Every DAI in existence originates from a single contract that “mints” DAI. However, any two DAI tokens are indistinguishable from each other. In contrast, when it comes to Bored Apes and NFTs in general, each token minted is unique and distinguishable from all others. In other words, NFTs are non-fungible. Below is the contract responsible for minting Bored Apes.

Alone, it’s nothing special, but this little piece of code has made some people fabulously rich. Since quite a few other NFT collections have copied the Bored Ape Yacht Club contract code for their own NFTs, let’s examine what buying a Bored Ape NFT actually gives you. Figuring this out takes a bit of knowledge about the Ethereum programming language, Solidity, and how to read smart contracts, which is outside the scope of this tutorial, but if you are interested, there are a lot of good tutorials on how to write code in Solidity out there - for instance, CryptoZombies.io.

What does an NFT contain?#

First of all, NFTs use the Ethereum technical standard ERC-721. In contrast, fungible tokens use the ERC-20 standard. The main pieces of information that an NFT requires that a normal fungible token does not are the following two functions.

function tokenByIndex(uint256 _index) external view returns (uint256);
function tokenURI(uint256 _tokenId) external view returns (string);

The first function “tokenByIndex” keeps track of all NFTs. For example, if you mint 100 different NFTs, each of them will have a unique index - NFT 4 will be different from NFT 24. This is different from normal tokens, where if you create 100 tokens they will all be exactly the same. This already makes the NFT unique. However, I am not sure anyone would be willing to pay $3,408,000 for a serial number.

This is where the tokenURI plays a crucial role. It stores metadata about the NFT. If we delve deeper into the contract, we encounter a variable known as ‘baseURI,’ which can be modified by calling the ‘setBaseURI()’ function. This means that the contract owner has the ability to change the baseURI, which can be somewhat problematic. To illustrate this, if we navigate to the contract’s transactions on Etherscan and examine the earliest transactions, we can see that the baseURI was only set in the third transaction.

tempsnip.png

Now what is this “baseURI”? Well, if “tokenURI” was the metadata of one token, then the “baseURI” is the metadata for all tokens together. If we dig a bit deeper, we see that the baseURI is “ipfs://QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/” which is part of an internet protocol for file hosting. We can access it in our browser with the following URI:

/ipfs/QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/

Image

Now this might not look like much, but this is actually the directory where all the metadata for Bored Apes is stored. Each file is one ape. For example if we click on Bored Ape 1001. We get the following MetaData.

{"image":"ipfs://QmZpfxHaiASnGQk3E6Dxikr1k1mekapPDo8d5zWP6n4pd7","attributes":
	[{"trait_type":"Background","value":"Orange"},{"trait_type":"Hat","value":"Fez"},
	{"trait_type":"Mouth","value":"Bored Unshaven"},{"trait_type":"Eyes","value":"Robot"},
	{"trait_type":"Fur","value":"Brown"}]
}

We can read out that it is an ape mounted on an orange background, wearing a fez hat, that has ‘robot eyes’, brown fur and a ‘bored’ and unshaven mouth. Quite the picture indeed. Now let’s see if it actually looks like that by following the URI from the “image” tag.

Image

This is Bored Ape 1001. If we want to know who owns this NFT, the easiest way is through an NFT marketplace like OpenSea.

OpenSea, the largest NFT marketplace

We can search for the Bored Ape Yacht Club NFT series.

Image

and from there, search for Ape #1001

Image

Which gives us the owner as user “342BDC”.

Image

We can click on their name, and look their address up on Etherscan. We can then navigate to their token holdings:

tempsnip.png

we find that they do indeed have the Bored Ape in their NFT collection, along with a bunch of other NFTs. My personal favourite is the cat from ‘Stinky’s Art Gallery’, and I have some concerns about this user’s ‘Fantasy Wafu’.

Image

What do you actually own with an NFT?#

The big question with NFTs is, what do you actually own? When digital art and NFTs first came out, a lot of people on the internet, who had bought NFTs, were annoyed that others were posting pictures of NFT art that they “owned”. However, as of Q4 2023 there is no specific regulation pertaining to NFTs and copyright - it is perfectly legal to screenshot an NFT and repost the image online.

What makes things a bit complicated is that companies, such as Bored Ape Yacht Club can design their own licence in such a way that you do have ownership rights over the art. Although as of August 2023, this has not been tested in court to the best of the authors knowledge. Yet this highlights the point even more that the ownership of an NFT becomes complicated and can often times be down to the exact wording of some commercial licence.

Nonetheless, having an NFT in your wallet is not a priori the same as owning it. In terms of data on the blockchain, if you own an NFT, what you own is the metadata. Although anyone else can also see it, or post it on the internet, only you can say that the NFT attached to this metadata is held in a wallet that you control. Now once an NFT has been minted, you cannot change its “tokenURI” - the URI where the token’s metadata is stored on the web (very far away from anything blockchain) - but what’s in the URI can change. For example, the address 55 Rue du Faubourg Saint-Honoré, 75008 Paris, refers to a specific spot, but the building at that spot can change, so the address (or URI) is no longer an indicator of what it was, yet it does not cease to exist. This challenge is somewhat addressed by the IPFS (InterPlanetary File System) internet protocol, which significantly enhances the immutability of the data. However, the key issue remains that only a reference to the data is stored on the blockchain.

So why isn’t all the information about NFTs stored directly on the blockchain? The primary reason is cost. Storing data on the blockchain can be expensive, with each kilobyte of data costing a significant amount in cryptocurrency. For instance, a 200-kilobyte JPEG image, such as the Bored Ape 1001, could cost approximately 6.4 ETH to store on-chain. Considering that there are 10,000 Bored Apes in the collection, this would amount to a staggering 64,000 ETH, equivalent to around 10,000 euros for minting a single NFT or approximately one hundred million euros for the entire collection at the time of writing. This cost factor makes storing large volumes of data directly on-chain impractical and financially prohibitive.

How OpenSea creates your NFTs#

One can of course create their own NFT by first deploying their own smart contract, and then calling functions on that smart contract to create a list of NFTs. As you can imagine, that requires more than trivial computer networking and programming skills. Thankfully, OpeanSea makes minting an NFT straightforward. Below is a tutorial on how do so:

How do I create an NFT?

If you go through this process one thing you might notice is that it doesn’t cost anything to mint with them. This is due to OpenSea’s use of a technique known as ‘lazy minting.’ In this approach, the NFT creator only establishes the template for the NFT, and it’s the buyer of the NFT who, upon completing the transaction to purchase the NFT, actually initiates the minting process and adds it to the blockchain. Importantly, this also means that it’s the buyer who bears the associated minting costs.

Other NFT usecases#

NFTs aren’t exclusively limited to art; another prevalent use case is the creation of unique in-game items. A notable genre of games that has emerged within the cryptocurrency realm is known as ‘play-to-earn’ games. In these games, players accumulate items represented as NFTs, which they can later sell to other players. While these games may not serve as a primary source of income, they can provide a welcome supplement, enabling players to earn an additional 20 euros or so per week from their gameplay.

One such example is ‘Gods Unchained’, which is a strategy card game similar to Heathstone. In Gods Unchained, every card is an NFT and can be sold on an in-game marketplace to other players.

Gods Unchained TCG

A much more famous game is Crypto-Kitties, where players get to collect virtual cats and breed them with other cats, to get desirable traits and then swap said cats with each other. This is sort of like the Crypto version of Tamagochi. Although it is not as popular as it once was, it’s still a popular game. The most expensive Crypto-Kitty was sold for 600 ETH, which at the time was 1.3 million USD, and is called Dragon (pictured below).

CryptoKitties | Collect and breed digital cats!

Image

A more Facebook Metaverse-esque take on crypto games is ‘Decentraland’. In ‘Decentraland’, players can develop and trade virtual pieces of land. Assets which can be used to build on your own plot of land, such as plants or pieces of a house, can be bought on the games marketplace for a cryptotoken called MANA.

Welcome to Decentraland

Decentraland

NFTs can also be used for distributing event proof of attendance tokens. A lot of tech and other conferences in recent history have started sending attendees NFTs to prove to others that they attended. These are called POAPs or Proof Of Attendance Protocols.

Another recent interesting use case of NFTs is loyalty programmes, for example Air Baltic, an airline from Latvia, has come up with a series of NFTs called Planies, which give loyalty points for free every month and other benefits ontop.

Planies NFT - an innovative loyalty experience | airBaltic

Token standards#

Now that we’ve covered NFTs and we’ve also touched upon tokens like stablecoins or governance tokens. So what makes a token?

Ethereum has different token standards for different tokens, with different capabilities. For example, by following standard ERC-721, you make an NFT. While the classic cryptocurrency token is often an ERC-20 token, with stablecoins and governance tokens as prominent examples following the ERC-20 token standard, it’s worth noting that anyone can propose a new token standard and add additional functionality through an ERC proposal. The term ‘ERC’ stands for ‘Ethereum Request for Comment,’ and despite the large number of ERCs, there are currently only nine established token standards.

The ERC-20 token standard serves as the foundational token type on Ethereum, characterized by its fungibility and simplicity. Popular coins like USDC, USDT, DAI, and BUSD adhere to the ERC-20 Token standard.

The second most common standard is ERC-721, which is the basic NFT token standard, used for the vast majority of NFTs, but containing a few inefficiencies in terms of the gas cost of creating one.

The ERC-777 standard is an extension of the ERC-20 Token standard, and is fully backwards compatible with it. The improvement over ERC-20 is that ERC-777 tokens can be sent on behalf of another user, with the consent of the owner, of course.

Among the token standards, ERC-1633 stands out as it represents a Re-fungible token or RFT. In simpler terms, this is an NFT that enables shared ownership among different addresses.

The other token standards are more technically oriented. ERC-1155 allows a single smart contract to incorporate both ERC-20 and ERC-721 token standards. ERC-918 serves as a framework for creating alternatives to Initial Coin Offerings (ICOs) by enabling contracts to distribute tokens through a ‘mining’ process. ERC-1178 extends a programming paradigm to tokens. ERC-1203 builds upon ERC-1178 and ERC-20. Finally, ERC-3754 offers an alternative to the NFT token standard, presenting a more abstract representation of an NFT.

Conclusion#

In summary, the insights shared within these tutorials are supposed to offer a comprehensive journey through the ever-evolving cryptocurrency and blockchain domain. It’s worth noting that since the creation of these tutorials, the field may have evolved further - we’ve covered the ways in which it remains cutting-edge, and ever changing (for better, and sometimes worse!). The primary objective of this tutorial series is to shed light on the ongoing trade-offs among scalability, security, and decentralisation within blockchain networks, where Layer 2 solutions like Arbitrum and Polygon show promise, albeit with their unique challenges. Finally, the exploration of NFTs underscores the versatility of crypto systems, dispelling the notion that they are confined to art, especially in the realm of pay-to-earn gaming. This tutorial also underscores the interconnected nature of the crypto world. These combined insights depict the dynamic blockchain landscape, illustrating its potential for innovation and disruption across various industries. With this foundational knowledge, I encourage you to embark on your investigations, while remaining cautious.