Blockchain Semantics Insights
Business Case | Deep Tech | Announcements | Blockchain Glossary |
What is ERC721 Token?By Krishna Vishwakarma | Sept. 5, 2018, 3:21 p.m. GMT
The ERC-721 standard was introduced by Dieter Shirley of Axiom Zen; it is a more advanced token that is “non-fungible”. Think of ERC-20 as the token type for things that are money (any $5 bill is worth the same as the other $5 bill, usually) and ERC-721 as the token type for collectibles (it’s the Ethereum equivalent of Pokémon collectible cards).
In ERC-721, each token is unique and non-interchangeable with other tokens. Another example of this is pets. There may be many dogs in the world but THEIR dog is theirs and they will not accept some other dog as a substitute. You can compare ERC-721 tokens to those dogs and their ownership.
The dawn of ERC-721
The initial purpose of the standard was to make CryptoKitties, a distinctive collectible digital artwork of cats. You may not solely own a unique collection of CryptoKitties, however, you can additionally breed the cats to form new CryptoKitties.
This opens avenues of potential revenue where you'll be able to create new cats and sell them. If you've got a particularly fascinating CryptoKitty that others would love to breed with theirs, you may earn cash by charging stud fees.
The ERC-721 consists of a set of events and behaviors that the token contract can perform; these involve the movement, ownership, and information about non-fungible items like Pokémon collectible cards, pets, and other items where ownership of specific unique items is needed.
If you are making some type of game on Ethereum, this is probably what you are looking for in most of the cases. Cryptokitties, weapons, Pokémon collectible cards, etc.; this is how they would be represented in Ethereum.
How are ERC721 tokens defined?
The code of the ERC-721 token standard is a contract that defines functions and events.
The general explanations of the code serve here and the detailed technical information exists on the official website of ERC-721.The programmers should administer 3 events: Transfer(), Approval(), and ApprovalForAll().
The Transfer() function triggers when ownership changes. The Approval() function triggers when the approved address for a Non-Fungible Token (NFT) is changed or reaffirmed. TheApprovalForAll() function triggers when an operator enables or disables an owner.
The functions the programmers must implement are:
- balanceOf(): This function is used to count all NFT’s assigned to an owner.
- ownerOf(): This function used to find the owner of allNFT’s.
- safeTransferFrom(): This function used to transfer the ownership of an NFT from one address to another and throws exceptions if the parameters have any issues.
- transferFrom(): This function used to transfer ownership of an NFT.
- approve(): This function used to set or reaffirm the approved address for an NFT.
- setApprovalForAll(): This function used to enable or disable approval of a third party (“operator”) to manage all of msg.sender’s assets.
- getApproved(): This function returns the approved address either for this NFT or the zero address if there is none.
- isApprovedForAll(): This function returns true if the operator is an approved operator for the owner, otherwise it returns false.
- supportsInterface(): This function returns true if the contract implements a valid interface ID, otherwise returns false.
Here are some of the projects that were built during the ERC-721 beta: