- NFTs have become the hottest thing in crypto in a very short time.
- NFT = Non-Fungible Tokens
- “Non-fungibility” is the property that makes an asset unique and irreplaceable.
- ERC-721 is one of the most well-known token standards that imparts non-fungibility.
- ERC-721 defines the functions that help in “establishing token ownership” and “transfer of ownership.”
Everyone is talking about NFTs. By the way, that’s not an exaggeration.
With Beeple selling his art for $69 million in the prestigious Christie’s auction house, to Lindsay Lohan and Paris Hilton selling their digital art, NFTs have quickly become a household term. Marketplaces like OpenSea and Rarible have made NFTs more accessible than ever before.
So, what exactly are NFTs? Well…let’s start with the most obvious question first.
What does “Non-Fungible” mean?
NFT stands for Non-Fungible Tokens. To understand what that’s supposed to mean, let’s first learn about the differences between fungibility and non-fungibility.
Fungibility is the property of an asset that makes it interchangeable with another asset of the same type. To understand this, let’s take an example of the most popular fungible assets– money. Imagine you borrowed a $100 note from your friend. When you pay back, you don’t need to give her back that exact same note. You can pay her back with:
- Another $100 note.
- Two $50 notes.
- Ten $10 notes.
The reason being, fiat currency is fungible. You can easily replace one note with another (of the same type and value). You can also break it down and pay it back with smaller denominations. This fungible property of currency allows the citizens of a country to unanimously accept it as a valuable and reliable entity. Every unit of that currency is worth the same no matter which unit is being spent.
Now, let’s look at the other side of the equation. Imagine you borrowed your wife’s car for the weekend.
What do you think will happen if you return it piece-by-piece? What if instead of a car, you give her a seat, an engine, and a tailpipe?
Well, if that does happen, you might as well get comfortable sleeping on the couch!
Cars are an example of a non-fungible asset. You can’t break it down into smaller units. In fact, you can’t even replace it with another car, even if it is of the same make and model.
A non-fungible token gets its value from the very fact that it is unique and irreplaceable. NFTs can represent digital files such as art, audio, videos, items in video games, and other forms of creative work.
Ethereum Token Standards: ERC-20 vs ERC-721
Now, if you have been around the crypto-space, you must have heard the terms “ERC-20” and “ERC-721” thrown around quite a bit. “ERC” stands for “Ethereum Request for Comment,” while 20 and 721 are the numbers assigned to the requests. The ERCs are used to create a token standard that the developers use in their smart contracts.
So, why is this necessary?
Imagine that you are walking down the street with 4 different shops accepting 4 different currencies. Can you imagine how much of a nightmare that will be? Not only do you need to have all four currencies, but these shops need to find out ways to work with each other and constantly keep an eye out for currency exchange rates.
Now, extend the same logic to Ethereum.
For Ethereum to be a healthy ecosystem, the dApps built on top of it need to be as interoperable as possible. We can’t have Project A with its own unique token and Project B with another unique token. The tokens need to follow a set of rules to ensure that they can easily move in and out of different apps within the ecosystem.
This is why the ERC-20 standard was adopted for fungible tokens and ERC-721 was adopted for non-fungible tokens.
ERC-721 – The Non-Fungible Token Standards
In this section, let us run through the different features of the ERC-721 standard, which allows it to create non-fungible tokens. The ownership functions defined in the standard are as follows:
- ownerOf(): The function keeps track of the token owner’s address. This way the NFT is continually mapped to the owner.
- approve(): The function permits another entity to transfer the token on the owner’s behalf. So, if you own an NFT, you can transfer it to a friend by calling this function.
- takeOwnership(): This function acts as a withdrawal function wherein an outside party can call it to take tokens out of another user’s account. When a user has been approved to own a certain amount of tokens, they can call this function to withdraw the tokens from the user’s balance.
- transfer(): This function allows the owner to send the token to another user. This function can only be executed if the receiver has already been approved to own the token by the sender.
- tokenOfOwnerByIndex(): Think of this function as a database that keeps track of all the NFT tokens owned by the user.
As defined by ERC-721, the functions explained above get triggered when one of these two events occurs – Ownership Transfer and Transfer Approval.
Event #1: Ownership Transfer
This event gets fired every time a token’s ownership changes hands. During this transfer of ownership, the functions detail the following data –
- The account that sent the token
- The account that received the token
- The token ID that was transferred
Event #2: Transfer Approval
The second event is the transfer approval, wherein a user allows another user to take ownership of a particular token.
The Rise and Rise Of NFTs
While DeFi may be the most innovative space in crypto, NFTs have carved out a niche for themselves by appealing to the masses. Slowly and surely, “NFTs” has become the defining narrative of 2021, not just in the crypto space but also overall. ERC-721 is the token standard that has made this revolution happen.