Open In App

What is ERC721 Token?

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:

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. 

It have the following functions:

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. 

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. 

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.  

Workflow of Smart Contract

What Can You Do With ERC-721 NFTs?

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

Popular NFTs

Example of ERC-721 Token:




// 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);
    }
}


Article Tags :