Site icon Chainstack

Token standards introduction: ERC-20, ERC-777, ERC-721, and ERC-1155

erc token standards
Token Standards 1024x542 logo

Introduction

With the rise in popularity of blockchain technologies and cryptocurrencies, we are seeing many more tokens being created. But what are they, exactly? This post will go over some of the most common types of crypto tokens: ERC-20, ERC-777, ERC-721, and ERC-1155.

What are tokens?

Tokens are digital assets built on a cryptocurrency’s blockchain. They differ from coins because while a coin is built on its native blockchain, a token is built on an existing blockchain.

For example, ETH is the official coin for the Ethereum blockchain, while Basic Attention Token (BAT), Chainlink (LINK), or OmiseGo (OMG) are tokens built on Ethereum.

Tokens are often a quicker way to leverage the existing standards of a successful and popular blockchain while building digital assets. Their most common use case is smart contracts on decentralized applications (DApps).

Difference between fungible and non-fungible tokens

Tokens generally fall under two categories: fungible tokens and non-fungible tokens.

Fungible tokens are divisible digital assets that you can swap for other assets of the same type. No single unit is worth more or less than another. Think about how a dollar bill is similar to another one and can be easily exchanged.

On the other hand, non-fungible tokens (also known as NFTs) are digital assets that you cannot easily exchange for other assets due to their uniqueness. For example, consider an artwork that holds a particular value for its owner and would be difficult to exchange for another artwork because their perceived values are different.

What are token standards? ERCs and EIPs

Before the adoption of token standards, blockchain developers often created tokens according to personal preferences, causing token ecosystems to experience difficulties when interacting with each other and limiting interoperability.

To solve this problem, Ethereum developers now create ERCs (Ethereum Request for Comments) and EIPs (Ethereum Improvement Proposals). These help to define the rules and required functions for tokens created on the Ethereum blockchain, making integrations and interactions much more accessible.

What are ERC-20 tokens?

ERC-20 is a protocol that defines standard APIs for creating fungible tokens in a smart contract. It was created in 2015 by Fabian Vogelsteller.

Its main methods include:

All these methods are strictly required in an ERC-20 smart contract, apart from the first three marked (optional) which help to improve usability.

An ERC-20 also has two events—Transfer (which triggers when tokens are transferred) and Approved (which triggers on any successful call to the approve() method).

Examples of ERC-20 tokens are USDC, a stablecoin pegged to the dollar, or UNI, the governance token used in Uniswap to vote on changes on the platform.

Many projects use ERC-20 tokens during their fundraising period (known as ICO – Initial Coin Offering). They are also widely used for trading purposes—some exchanges only support trading in tokens that adhere to this standard due to their popularity among investors and traders.

What are ERC-777 tokens?

The ERC-777 standard offers improvements in how users interact with fungible tokens in a smart contract while remaining backward compatible with ERC-20. It was created in 2017 by Jacques Dafflon, Jordi Baylina, and Thomas Shabibi.

Some of its improvements include clearing the confusion around decimals in a smart contract and introducing hooks that allow your smart contract to react when you send or receive tokens. These help to prevent tokens from getting locked forever or lost when sent to the wrong address.

ERC-777 contains methods like:

What are ERC-721 tokens?

ERC-721 is a standard for creating non-fungible tokens (NFTs) on Ethereum. It was created in 2018 by Dieter Shirley, Jacob Evans, Natassia Sachs, and William Entriken.

A few examples include rare collectibles (e.g., CryptoKitties and Gods Unchained), or limited edition items like sneakers and art prints.

They can also signify membership in a community, like Developer DAO.

A basic ERC-721 smart contract contains methods like:

It also contains events like Transfer (which triggers when ownership of any NFT changes) and Approval (which activates when the approved address for an NFT is changed).

ERC-721 has multiple extensions split across different contracts.

Here are two such extensions.

What are ERC721Enumerable?

The ERC721Enumerable contains all the methods available in the original ERC721 and three extra methods:

This extension is often not implemented because enumerating tokens on the blockchain could significantly spike gas costs.

What is ERC721A?

ERC721A is an extension of ERC-721 that aims to significantly reduce transaction fees by allowing users to mint multiple unique NFTs in a single transaction.

It was created by the Azuki team in 2022 and is currently used by projects like Dastardly Ducks and Zero Gravity Club.

In addition to the original ERC721 methods, it contains extra methods like:

What are ERC-1155 tokens?

The ERC1155 protocol combines the abilities of ERC-20 and ERC-721, allowing tokens to have fungible and non-fungible characteristics. It was created by Witek Radomski and made public in 2019.

ERC-1155 provides a way to model assets and their ownership, as well as a way to create, transfer, and settle those assets. With these capabilities, you can trade fungible assets like gold bullion, or collectibles such as art, baseball cards, loyalty points, etc., using the same smart contract.

In an ERC-1155 smart contract, the balanceOf() method contains an id argument to identify the token you want to query its balance.

It also contains other methods like:

Conclusion

The first step in creating a smart contract is deciding the right tool for the job. You can choose to create a simple fungible token based on ERC-20, improve its features based on ERC-777, create NFTs with ERC-721, or hybrid smart contracts with ERC-1155.

Other token standards exist with their specific use-cases, like ERC-4626 for tokenized vaults and you can learn more about crypto tokens through our blog or these resources listed below.

Resources

Have you already explored what you can achieve with Chainstack? Get started for free today.

Exit mobile version