Open In App

What is ERC721 Token?

Last Updated : 26 Feb, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

ERC or Ethereum Request for Comments is simply a guideline or a template that all Ethereum-based tokens should follow. Ethereum’s smart contract programmers are accountable for writing ERC-related documents to describe the set of rules that every Ethereum-based Token must follow. 

A token is basically a digital asset that represents something. It can be traded, sold, or bought by a user. It is a kind of virtual currency. They are used for investment purposes, to store value, to make purchases, etc. These are used to facilitate transactions along a blockchain.

There are two types of tokens:

  • Fungible tokens: Fungible tokens are the tokens that are mutable or whose values can be changed.  It can be exchanged with another fungible token because these have the same values. For example, Bitcoin, DAI, and other cryptocurrencies. Dollars, bars of gold, etc are other examples of fungible assets.
  • Non-fungible tokens: These are the tokens that have a unique value, code, and metadata. No two non-fungible tokens can replace another, because the two are unique. For example, digit assets like in-game avatars, digital and non-digital collectibles, and even tickets are all non-fungible.

The following topics will be discussed here:

  1. What is ERC-721?
  2. Who Invented ERC-721?
  3. What’s so special about ERC-721?
  4. How are ERC-721 NFTs produced?
  5. How do you get hold of ERC-721 NFTs?
  6. What can you do with ERC-721 NFTs?
  7. How are ERC-721 transferred?

Let’s start discussing each of these in detail.

What is the ERC-721 token?

ERC-721 is basically a template or a guideline that other developers agree to follow. It is a widely used standard. Being a widely used standard also means being compatible with a  wide range of applications. 

  • ERC-721 is a standard for “non-fungible” tokens. A non-fungible token is the type of token that is unique. These are cryptographic assets on a blockchain that has a unique code and metadata differentiating them from one another. 
  • The ERC-721 standard non-fungible tokens can be seen in blockchain-based games where each asset is unique and players can trade it and sell or buy items with it.
  • One of the examples that use the ERC-721 non-fungible tokens standard is the Cryptokitties game which is basically a game developed on the blockchain which allows users to sell, buy and breed virtual cats. 
  • Some other examples include Ethermon, MyCrypto, Cryptodoggies, etc. The assets bought with a non-fungible token are unique and only belong to the owner. It can’t be traded. It’s like a property that one owns (a house).
  • The ERC-721 standard tokens are created the same way as other kinds of tokens and can be created as many as the user wishes but the only difference is that the tokens have a unique value and unique metadata, making it non-fungible.

It have the following functions:

  • name()
  • symbol()
  • tokenURI()
  • onERC721Received()
  • totalSupply()
  • balanceOf()
  • ownerOf()
  • safeTransferFrom()
  • transferFrom()
  • approve()
  • setApprovalForAll()
  • getApproved()
  • isApprovedForAll()
  • takeOwnership()
  • tokenMetadata()
  • tokenByIndex()
  • tokenOfOwnerByIndex()
  • supportsInterface()

Characteristics of ERC-721 Tokens:

  1. ERC-721 tokens are the standards for non-fungible tokens (NFTs).
  2. These tokens cannot be exchanged for anything of equal value since they are unique in themselves, representing a unique asset.
  3. Each NFT token is linked to different owners and has its own tokenID or metadata that makes them unique.
  4. The most popular application areas of ERC-721 tokens are NFTs in gaming ( such as cryptokitties).

Who Invented ERC-721?

The initial ERC-721 specification was proposed by Dieter Shirley as an Ethereum Improvement Proposal (EIP), which is a process for introducing new standards to Ethereum, in January 2018. 

  • ERC-721 was Ethereum’s first NFT token standard.
  • It laid the groundwork for the uses of NTFs we see today

What’s So Special About ERC-721?

The non-fungible nature of the ERC-721 token makes it special. The fact that ERC-721 is unique, makes it so special. The ERC-721 standard allows creators to issue unique crypto assets like NFTs via smart contracts. 

  • All the ERC-721 tokens hold a different value. 
  • The ERC-721 standard tokens are created the same way as other kinds of tokens and can be created as many as the user wishes but the only difference is that the tokens have a unique value and unique metadata. 
  • It provides many functionalities such as transferring tokens from one account to another, obtaining the current token balance of an account, the owner of a specific token, and also finding out the total supply of the token available on the network. 
  • ERC-721 is a more complex standard than other token standards, with multiple optional extensions. 
  • In addition, it is split across a number of contracts.

How are ERC-721 NFTs Produced?

Tokens are created by smart contracts which is not only responsible for creating tokens but also for handling transactions and keeping track of balances. To get some tokens, you have to send some Ether (Cryptocurrency that lives in Ethereum) to the Smart contract which will then give you some tokens.  

  • An ERC-721 token is created by writing a piece of code in a smart contract programming language like Solidity that follows the same basic template or base code. 
  • Extra functionalities can also be programmed on the NFT by the user.
Production of Tokens - ERC-721

Workflow of Smart Contract

  • ERC-721’s main challenge is that transferring numerous assets can become expensive.

What Can You Do With ERC-721 NFTs?

They can be used to represent both tangible and intangible items. 

  • Music NFTs: Music NFTs have also become popular in a short amount of time. On platforms such as Audius, it is very easy for creators to mint their work with these tokens. 
  • NFT in event ticketing: From art to gaming to music, the NFTs have a lot more used cases. One novel NFT use case which is already being explored is events ticketing, while music venues, cinemas, theaters, and festivals sell a lot of tickets at the door, the largest ones often have to deal with monopolies. 
  • Venue and musician collaboration: It is possible that in the near future venues and musicians could collaborate on unique NFTs that both grant admission to the show but also give concert-goers perks and extras like exclusive artwork or access to other merchandise. In such an arrangement, venues and artists could keep more money and exert more control over the ticketing process.
  • NFT Banking: NFTs can be investment assets that can be treated and sold earning their creator’s residuals over time, but NFTs can also be used as another type of investment. 
  • NFT in the healthcare industry: Even the healthcare industry could use NFT. Some blockchain-based companies are working on allowing patients to pack in their medical data in smart contracts which can be easily and securely forwarded to medical professors. NFT could also be used by people to monitor their health information. Take DNA testing companies for example. They offered to track the genetic history of customers and then use their information however they please in perpetuity with NFTs. DNA testing companies will have to pay customers when they end up selling their data to other companies and customers would be able to easily track those transactions.

Popular NFTs

  • Etherscan NFT Tracker 
  • CryptoKitties game
  • Sorare is a football fantasy game
  • The Ethereum Name Service (ENS) 
  • POAP
  • Unstoppable Domains 
  • Gods Unchained Cards
  • Bored Ape Yacht Club

Example of ERC-721 Token:

Solidity




// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.6 <0.9.0; 
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
/// @title A contract for demonstrate ERC-721 Token
/// @author Jitendra Kumar
/// @notice For now, this contract just show how to create an ERC-721 Token
contract GFGToken is ERC721, ERC721Enumerable, ERC721URIStorage, Ownable {
    using Counters for Counters.Counter;
 
    Counters.Counter private _tokenCountCounter;
 
    //set the NFT name and symbol
    constructor() ERC721("GFGToken", "GFG") {}
    //mint the NFT using Owner Address
    function safeMint(string memory _uri) public onlyOwner {
        uint256 tokenCount = _tokenCountCounter.current();
        _tokenCountCounter.increment();
        _safeMint(msg.sender, tokenCount);
        _setTokenURI(tokenCount, _uri);
    }
     
    function _beforeTokenTransfer(address from, address to, uint256 tokenCount, uint256 batchSize)
        internal
        override(ERC721, ERC721Enumerable)
    {
        super._beforeTokenTransfer(from, to, tokenCount, batchSize);
    }
 
    function _burn(uint256 tokenCount) internal override(ERC721, ERC721URIStorage) {
        super._burn(tokenCount);
    }
 
    function tokenURI(uint256 tokenCount) public view override(ERC721, ERC721URIStorage) returns (string memory)
    {
        return super.tokenURI(tokenCount);
    }
 
    function supportsInterface(bytes4 interfaceId) public view override(ERC721, ERC721Enumerable)returns (bool)
    {
        return super.supportsInterface(interfaceId);
    }
}




Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads