ERC-721 is a free, open standard that describes how to build non-fungible or unique tokens on the Ethereum blockchain. While most tokens are fungible (every token is the same as every other token), ERC-721 tokens are all unique.
Each NFT is identified through an
uint256 ID. They may be transferred through two different funcions:
- A safe transfer function
safeTransferFrom()which verifies that the
msg.sender,i.e. the user that triggered the function, is the owner of the token or an authorized user allowed to transfer the token.
- A non-secure trasfer
transferFrom(), where there is no preliminary authorization verification. The token developer is responsible for implementing a piece of code in this function that verifies that the responsible for calling the function is authorized to do so. In this function, the user calling it must also verify that the receiver is entitle for receiving the token. If these verifications are not performed, the tokens could be lost forever.
ERC721 tokens must implement the proposed ERC165 interface. This standard allows the detection of the interfaces implemented by a contract. This is really useful, as it allows to detect the interface that a token implements and, consequently, adapt the method/code to interact with it.
What does “fungible” mean?!
If an item is fungible, then it can be substituted or exchanged for any similar item. Fiat currencies, like the US dollar, contain fungible units. One dollar bill can be exchanged for any other dollar bill. Cryptocurrency tokens like Bitcoin, Ethereum, and MANA are all fungible because one token can be exchanged for any other token. The only thing that changes is a record on the blockchain registering the transaction.
It must follow that two non-fungible tokens are not interchangeable. So what is it about non-fungible tokens (NFTs) that gives them this quality? The answer lies in the data or information stored within NFTs.
We can compare two real-world examples of fungible and non-fungible items that most people should be familiar with: dollars and movie tickets.
These are obviously fungible, if I have a dollar and you have a dollar, we can trade the two and neither of us will be any richer or poorer than we were before.
NFTs are the digital manifestation of items like movie tickets, in that they can contain information in addition to just the owner, lending them all sorts of uses and unforeseen value. Put simply: you could have a movie ticket for Star Wars whereas I could have a movie ticket for Avengers. These tickets are not equal in properties or value which makes them non-fungible.
ERC721 was written to standardize non-fungible tokens. By standardizing NFTs, the developer community ushered in a new ecosystem of digital content, games, and applications that use NFTs. Thanks to ERC721, we have things like Decentraland, CryptoBeasties, Etheremon, and CryptoKitties.