Select Page

Token standards: ERC20 vs ERC721 vs ERC1155

defi vs cefi

Ethereum was developed to address the limitations of the first-generation blockchain, Bitcoin. Vitalik Bueterin proposed the idea of an open-source blockchain with integrated smart contract functionality to expand the use cases of blockchain across major industries. Hailed as 100% programmable, the Ethereum ecosystem welcomes blockchain enthusiasts worldwide to develop blockchain-powered solutions on the top of its ecosystem and contribute to the growth.

Ethereum token development is one of the prevalent development opportunities, which upholds the whole network and numerous interconnected projects running simultaneously. Ethereum-based tokens can represent the value and service, and innovative companies use these tokens as internal currencies to buy, sell, and trade within the ecosystem.

Now that Ethereum supports token development, its community also sets some standards to ensure that tokens created on Ethereum are compostable with various existing ecosystems and satisfy specific user requirements. You should know that Ethereum also allows users to create a fungible token without the need to abide by any ERC standard.

These types of tokens lack the composability with anything else on Ethereum like Defi exchanges and wallets. Therefore, ERC Token standards are essential to present basic guidelines for building various smart contracts. These standards evolve from time to time and provide a better interface for ERC token development so that businesses can cater to their specific user requirements.

This insight adds an in-depth analysis of Etherum token standards and a deeper examination of the top four ERC token standards leading today- ERC20 vs. ERC721 vs. ERC1155.

What is ERC for Ethereum?

ERC is an acronym for Ethereum Request for Comments. It’s like technical documents that define the methods, behaviors, innovation, and research applicable to a group of developers and users who want to utilize the Ethereum ecosystem.

You might be wondering who has the authority to create and manage the ERC. Ethereum’s smart contract programmers are accountable for writing ERC-related documents to describe the set of rules that every Ethereum-based Token must adhere to. They also frequently review these documents and comment on them for further improvements.

To easily understand ERC, think of an engineering task force that conveys technical notes and rules to the developers that everyone needs to comply with if they want to leverage the benefits of a particular ecosystem.

What are ERC token standards?

ERC token standards explain certain rules for all the ERC tokens built on the Ethereum blockchain. Ethereum’s community duly reviews this set of rules, and amendments are done based on the changing requirements. Moreover, ERC standards are designed to allow ERC tokens to interact seamlessly.

ERC-20, ERC-721, and ERC-1155 appear as the three popular ERC token standards or protocols that have their applications across major industries. The Ethereum community fully approves these token standards, and they differ in terms of specific features and functionalities.

Before knowing what exactly the token standards mean or how it works, we should first understand the essentials of smart contract standards on Ethereum. The following statements define it:

  • Smart contracts describe rules that a smart contract programmer should comply with to leverage the underlying benefit of the Ethereum network.
  • These standards are applicable for blockchains that support the development of smart contracts and decentralized applications (dApps).
  • Smart contract standards contain token standards, library themes & formats, name registries, and related details.

ERC tokens standard is just another name for smart contract standards. The smart contract on Ethereum must obey the standards or rules to enable essential functions such as token creation, transaction processing, spending, etc. By introducing the improved ERC standards, Ethereum unlocks the true potential of its ecosystem and empowers the development of more specific smart contracts, contributing to the network’s growth.

Evolution of Ethereum token standards

Ethereum continues to introduce different ERC token standards to make the ecosystem more accessible and to support various use cases. From ERC-20 to ERC-721 to ERC-1155, the Ethereum community has succeeded in making this blockchain a mainstream protocol, which can never be obsolete.

Below, we have discussed how Ethereum token standards have evolved so far and what different ERC token standards are relevant today. Thereby, we will examine the scope of growth and development opportunities on the Ethereum blockchain for worldwide enterprises and users.

ERC-20 token standards

ERC-20 was first proposed in 2015, and it was finally integrated into the Ethereum ecosystem two years later in 2017. ERC-20 introduces the token standard for creating fungible tokens on the Ethereum blockchain. Simply put, ERC-20 consists of properties that support the development of identical tokens.

For example, an ERC-20 token representing a currency can act like the native currency of Ethereum, Ether. That means 1 token will always be equal to the value of another token and can be interchangeable for each other. ERC 20 token set standards for the development of fungible tokens, but what does fungible can represent virtually? Let’s check them out:

  • Reputation points of any online platform.
  • Lottery tickets and schemes.
  • Financial assets such as shares, dividends, and stocks of a company
  • Fiat currencies, including USD.
  • Gold ounce, and much more…

Ethereum requires a robust standard to bring uniformity across the entire operations to support token development and regulate them on the blockchain network. That’s where ERC-20 comes into the game.

Developers of the decentralized world widely use ERC-20 token standards for different purposes, like developing interoperable token applications that are compatible with the rest of the products and services available in the Ethereum ecosystem.

Characteristics of ERC-20 tokens

  • ERC 20 tokens are another name for ”fungible tokens”.
  • Fungibility defines the ability of an asset or Token to be exchanged for assets of the same value, say two 1 dollar notes.
  • Each ERC-20 Token is strictly equivalent to the same value regardless of its feature and structure.
  • ERC tokens’ most popular application areas are Stablecoins, governance tokens, and ICOs.

ERC-721: Non- fungible tokens

To understand the ERC-721 standards, you must first understand NFTs (non-fungible tokens). Check our detailed insight explaining NFTs and their role in the decentralized world of blockchain.

The founder and CTO of Cryptokitties (the widespread non-fungible tokens), Dieter Shirley, initially proposed developing a new token type to support NFTs. The proposal for approval later in 2018. It’s specialized in NFTs, which means a token developed abiding by the rules of ERC-721 can represent the value of any digital asset that lives on the Ethereum blockchain.

With that, we come to a concluding statement: If ERC-20 are crucial for inventing new cryptocurrencies, ERC-721 is invaluable for digital assets that represent someone’s ownership of those assets. ERC-721 can represent the following:

  • A unique digital artwork
  • Tweets and social media posts
  • In-game collectibles
  • Gaming characters
  • Any cartoon character and millions of other NFTs….

This special type of Token brings amazing possibilities for businesses utilizing NFTs. Likewise, ERC-721 creates challenges for them, and to address these challenges, ERC-721 standards come into play.

Note that each NFTs has a uint256 variable known as tokenId. Hence, for each EBR-721 contract, the pair contract address- uint256 tokenId must be unique.

In addition, dApps should also have a ”converter” to regulate the input and output process of NFTs. For example, the converter considers tokenId as input and outputs non-fungible tokens such as an image of zombies, kills, gaming collectibles, etc.

Characteristics of ERC-721 tokens

  • ERC-721 tokens are the standards for non-fungible tokens (NFTs).
  • These tokens cannot be exchanged for anything of equal value since they are one-of-a-kind.
  • Each ERC-721 represents the value of the respective NFT, which may differ.
  • The most popular application areas of ERC-721 tokens are NFTs in gaming.

ERC-1155: Multi-token Standard

Combining the abilities of ERC-20 and ERC-721, Witek Radomski (the Enjin’s CTO) introduced an all-inclusive token standard for the Ethereum smart contracts. It’s a standard interface that supports the development of fungible, semi-fungible, non-fungible tokens and other configurations with a common smart contact.

Now, you can fulfill all your token development needs and address the problems using a single interface, making ERC-1155 a game-changer. The idea of such a unique token standard was to develop a robust smart contract interface that represents and manages different forms of ERC tokens.

Another best thing about ERC-1155 is that it improves the overall functionality of previous ERC token standards, making the Ethereum ecosystem more efficient and scalable.

Characteristics of ERC-1155 tokens

  • ERC-1155 is a smart contract interface representing fungible, semi-fungible, and non-fungible tokens.
  • ERC-1155 can perform the function of ERC-20 and ERC-721 and even both simultaneously.
  • Each Token can represent a different value based on the nature of the token; fungible, semi-fungible, or non-fungible.
  • ERC-1155 is applicable for creating NFTs, redeemable shopping vouchers, ICOs, and so on.

 

Leverage the benefits of ERC tokens with

End-to-end Ethereum Token Development Services by Leewayhertz

How does the interface of ERC-20, ERC-721, and ERC-1155 look like?

ERC-20

Following is the basic interface of ERC20 that describes the function and event signature of ERC20 contracts, followed by the explanation of each given function:

contract ERC20 {  event Transfer(    address indexed from,    address indexed to,    uint256 value  );    event Approval(    address indexed owner,    address indexed spender,    uint256 value  );  function totalSupply() public view returns(uint256);  function balanceOf(address who) public view returns(uint256);  function transfer(address to, uint256 value) public returns(bool);  function allowance(address owner, address spender)    public view returns (uint256);  function transferFrom(address from, address to, uint256 value)    public returns (bool);  function approve(address spender, uint256 value)    public returns (bool);}

Following are the features and components of the ERC-20 smart contract Interface.

totalsupply

The function totalSupply is public and thus accessible to all. It displays the total number of tokens that are currently in circulation. Since this totalSupply function is labeled with a view modifier, it doesn’t consume gas. Moreover, it updates the internal token value totalSupply_ whenever a new token is minted.

// its value is increased when new tokens are minteduint256 totalSupply_;// access the value of totalSupply_function totalSupply() public view returns (uint256) {  return totalSupply_;}

balanceOf

balanceOf is another public with view modifier that makes it accessible to everyone, and it’s gas-free. It takes the Ethereum address and returns the tokens to the allocated address.

// Updated when tokens are minted or transferredmapping(address => uint256) balances;// Returns tokens held by the address passed as _ownerfunction balanceOf(address _owner)  public view returns (uint256 balance) {  return balances[_owner];}

transfer

Function transfer differs from the above two functions since it requires fas and thus results in significant changes in the Ethereum smart contracts. It transfers tokens from one address to another at the request of respective token holders.

function transfer(address _to, uint256 _value)  public returns (bool) {  // Check for blank addresses  require(_to != address(0));  // Check to ensure valid transfer  require(_value <= balances[msg.sender]);  // SafeMath.sub will throw if there is not enough balance.  balances[msg.sender] = balances[msg.sender].sub(_value);  balances[_to] = balances[_to].add(_value);  // Event transfer defined in the ERC 20 interface above  Transfer(msg.sender, _to, _value);  return true;}

allowance, approve and transferFrom

The last functions allowance, approve, and transferFrom supports advanced functionalities such as authorizing some other Ethereum address to utilize token on behalf of the respective holder.

ERC-721

To understand how ERC-721 works, let’s have a look at its interface added here:

contract ERC721 {  event Transfer(    address indexed _from,    address indexed _to,    uint256 _tokenId  );  event Approval(    address indexed _owner,    address indexed _approved,    uint256 _tokenId  );  function balanceOf(address _owner)     public view returns (uint256 _balance);  function ownerOf(uint256 _tokenId)    public view returns (address _owner);    function transfer(address _to, uint256 _tokenId) public;  function approve(address _to, uint256 _tokenId) public;    function takeOwnership(uint256 _tokenId) public;}

balanceOf

In the below snippet, ownedTokens represents the complete list of token IDs of a particular address. Whereas,balanceOf function returns the number of tokens of that address.

mapping (address => uint256[]) private ownedTokens;function balanceOf(address _owner) public view returns (uint256) {  return ownedTokens[_owner].length;  }

OwnerOf

Mapping token owner takes tokened and outputs the owner of that ID. However, since its visibility is set private, by using the ownerOf function, you can set the value of this mapping as public. It also requires a check against zero addresses before it returns the value.

mapping (uint256 => address) private tokenOwner;function ownerOf(uint256 _tokenId) public view returns (address) {  address owner = tokenOwner[_tokenId];    require(owner != address(0));    return owner;  }

transfer

This transfer function takes in the new owner’s address as _to parameter and _tokenId of the token being transferred, also note that it can only be called by the owner of token. It must include the logic to check whether the transfer clears approval check, required for a transfer. Then comes the logic to remove token’s possession from current owner and add it to the list of tokens owned by new owner.

modifier onlyOwnerOf(uint256 _tokenId) {   require(ownerOf(_tokenId) == msg.sender);    _;  }function transfer(address _to, uint256 _tokenId)   public onlyOwnerOf(_tokenId) {   // Logic to clear approval for token transfer  // Logic to remove token from current token owner  // Logic to add Token to new token owner  }

approve

Approve is another function for another address to claim the ownership on a given token ID. It is restricted by a modifier only OwnerOf, which explains that only the token oners can access this function for a definite reason.

mapping (uint256 => address) private tokenApprovals;modifier onlyOwnerOf(uint256 _tokenId) {   require(ownerOf(_tokenId) == msg.sender);    _;  }function approvedFor(uint256 _tokenId)   public view returns (address) {     return tokenApprovals[_tokenId];  }function approve(address _to, uint256 _tokenId)  public onlyOwnerOf(_tokenId) {    address owner = ownerOf(_tokenId);   require(_to != owner);  if (approvedFor(_tokenId) != 0 || _to != 0) {    tokenApprovals[_tokenId] = _to;    // Event initialised in the interface above    Approval(owner, _to, _tokenId);   }}

takeOwnership

Function takeOwnership takes _tokenId and applies the same check on the message sender. If he passes the check logic similar to the transfer function, he must claim the ownership of the following _tokenID .

function isApprovedFor(address _owner, uint256 _tokenId)   internal view returns (bool) {    return approvedFor(_tokenId) == _owner;  }function takeOwnership(uint256 _tokenId) public {  require(isApprovedFor(msg.sender, _tokenId));  // Logic to clear approval for token transfer  // Logic to remove token from current token owner  // Logic to add Token to new token owner}

ERC-1155

Batch Transfers

The batch transfer is closely similar to regular ERC-20 transfers. Let’s look at ERC-20 transferFrom function:

// ERC-20function transferFrom(address from, address to, uint256 value) external returns (bool);// ERC-1155function safeBatchTransferFrom(address _from,address _to,uint256[] calldata _ids,uint256[] calldata _values,bytes calldata _data) external;

ERC-1155 differs in passing the token value as an array and an array of ids. The transfer results like this:

  • Transfer 200 tokens with id 5 from _from to _to.
  • Transfer 300 tokens with id 7 from _from to _to.
  • Transfer 3 tokens with id 15 from _from to _to.

Apart from utilizing the function of ERC-1155 as transferFrom, no transfer, you can utilize it as regular transfer by setting the form address to the address of calling the function.

Batch Balance

The respective ERC-20 balanceOf call likewise has its partner function with batch support. As a reminder, this is the ERC-20 version:

// ERC-20function balanceOf(address owner) external view returns (uint256);// ERC-1155function balanceOfBatch(address[] calldata _owners,uint256[] calldata _ids) external view returns (uint256[] memory);

Even simpler for the balance call, we can retrieve multiple balances in a single call. We pass the array of owners, followed by the array of token ids.
For example given _ids=[3, 6, 13] and _owners=[0xbeef…, 0x1337…, 0x1111…], the return value will be

[balanceOf(0xbeef...),balanceOf(0x1337...),balanceOf(0x1111...)]

Batch Approval

// ERC-1155function setApprovalForAll(address _operator,bool _approved) external;function isApprovedForAll(address _owner,address _operator) external view returns (bool);

The approvals here are slightly different than ERC-20. You need to set the operator to approved or not approved using setApprovalForAll rather than approving specific amounts.

Receive Hook

function onERC1155BatchReceived(address _operator,address _from,uint256[] calldata _ids,uint256[] calldata _values,bytes calldata _data) external returns(bytes4);

ERC-1155 supports receive hooks only for smart contracts. The hook function must have to return a predefined magic bytes4 value which is as following:

bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))

As soon as receiving contracts returns this value, we assume that the contract can now accept the transfer and it understand how to manage ERC-1155 tokens. That’s done!

ERC20 vs. ERC721 vs. ERC1155- A comparison

If you want to create any kind of token on the Ethereum blockchain, then you must know the difference between ERC-20, ERC721, and ERC. Being able to differentiate these most prevalent ERCs, you can choose the right token standard that perfectly aligns with your business-specific needs.

Technical specifications

ERC-20 ERC-721 ERC-1155

Ease of use

Requires single operation for each transaction

Requires single operation for each transaction

Allows multiple operation in a single transaction

BME (burn-and-mint ) model

Not available

Available

Available

Supported tokens

Fungible tokens

Non-fungible tokens

Fungible and non-fungible tokens

KYC verification

No KYC verification required

In-built KYC/AML

In-built KYC/AML

Example use cases

Bianance Coin, Maker, OmiseGo

Decentraland, Cryptokitties, Ethermon

Reedemable shopping vouchers

Smart contracts

Requires one common smart contract

Requires a unique smart contracts for each tokens

Requires a single smart contract for infinite tokens

Efficiency

Requires more storage

May require more storage space

Requires less storage space

Token transfer

Can transfer 1 or 2 token at once

Supports single token transfer at once

Supports batch transfer of many tokens

Localization

Supports single language

Supports single language

Supports the localization of language

Transfer type

Transfer of value between the users

Transfer of rights

Transfer of value or the rights

ERC-20, ERC-721, ERC-1155, ERC- what’s next?

What are the changes awaiting for Ethereum token standards? To present a befitting answer to this question, let’s briefly overview the upcoming ERC token standard and their potential impact on Ethereum smart contracts.

ERC-3475: Multiple callable bonds

ERC-3475 is the newest smart contract standard rolled down by the Ethereum community to support the creation of tokens that can manage multiple callable or redeemable bonds. Using ERC-3475, enterprises can store collective information about bonds, launch various types of bonds, integrate additional features and functions in the existing bonds, which is crucial for the growth of the decentralized finance market.

How does ERC-3475 work?

  • ERC-20 is the current LP (liquidity provider) token prevalent worldwide, but it requires the deployment of separate smart contracts for each token. Considering this, ERC-3475 provides issuers of bonds with the facility of multiple bond redemption.
  • By doing so, this new ERC standard turns out to be a real breakthrough that helps Ethereum blockchain users to set up a better infrastructure of the existing decentralized bond market.
  • ERC-3475 can efficiently manage multiple redeemable bonds, store huge amounts of data without consuming much gas. Thus, it’s cost-effective.

What are the specific use cases of ERC20, ERC721, or ERC1155?

Even though Ethereum aims to make token development a straightforward process with each new ERC standard, we must agree that all the existing token standards are relevant today and relevant for different industries and their specific user needs. Here are the specific use cases of ERC tokens.

Use cases of ERC-20:

ERC-20 represents the value of fungible assets and is useful to organize crowdfunding campaigns, issue ICOs, and launch more cryptocurrencies in the market.

Use cases of ERC-721:

ERC-721 represents someone’s ownership for digital assets, mainly used as NFTs in the gaming industry, NFT marketplaces, and Metaverse platforms.

Use cases of ERC-1155:

Multi-utility token standard, ERC1155, is often used in online gaming. Games now have fungible elements like life/energy, NFTs like gaming characters, and fungible native currencies to exchange values.

Ethereum development services by LeewayHertz

LeewayHertz offers a wide range of Ethereum development services and solutions such as decentralized application development, smart contract development, and next-generation Ethereum solutions. Check out our complete list of Ethreum development services:

  1. Ethereum blockchain consulting
  2. Ethereum dApps development
  3. Smart contract development and integration
  4. ERC token development
  5. Token migration
  6. Ethereum network launch
  7. App or network maintenance

Closing thoughts

The motive of Ethereum unleashing new token standards is to cope with the evolving changeovers in the blockchain world. The unique features of each ERC token standard work as a benefit for different enterprises and developers looking to leverage Ethereum. The three tokens- ERC20, ERC721, and ERC1155 are currently highly efficient and inclusive in the digital ecosystem. However, the constant evolution of Ethereum token standards is likely to bring radical advancement of blockchain in the next few years.

If you are looking for Ethereum development services, we are happy to connect with you. We offer blockchain solutions for various purposes, including crowdfunding, bidding, and dApps.

Webinar Details

Author’s Bio

Akash Takyar
Akash Takyar
CEO LeewayHertz
Akash Takyar is the founder and CEO at LeewayHertz. The experience of building over 100+ platforms for startups and enterprises allows Akash to rapidly architect and design solutions that are scalable and beautiful.
Akash's ability to build enterprise-grade technology solutions has attracted over 30 Fortune 500 companies, including Siemens, 3M, P&G and Hershey’s. Akash is an early adopter of new technology, a passionate technology enthusiast, and an investor in AI and IoT startups.

Start a conversation by filling the form

Once you let us know your requirement, our technical expert will schedule a call and discuss your idea in detail post sign of an NDA.

All information will be kept confidential.

 Send me the signed Non-Disclosure Agreement (NDA)

Insights

Metaverse in education

Metaverse in education

The metaverse will undoubtedly revamp the education system, accelerate learning and restructure the existing system into a more advanced, innovative and relevant one.

read more
MetaFi: What is it all about?

MetaFi: What is it all about?

MetaFi is a concept that unifies all blockchain-related projects, such as metaverse, GameFi, SocialFi, Web3 and NFTs, by offering advanced and complex DeFi Infrastructure under one roof – MetaFi.

read more
Schedule a Meeting