Article
April 17, 2023
ERC20 vs ERC721 vs ERC1155: What’s the difference?
What are non-fungible tokens? What is a smart contract? What are the differences between various tokens?
What are tokens?
The Web3 ecosystem is fundamentally based upon holding and transferring different types of digital assets on decentralized networks known as blockchains. Blockchain technology allows users to buy, sell, own, transfer, and trade different digital currencies, unique collectibles, and a wide range of other digital items.
These assets are represented by different types of “tokens” on blockchain networks, and each token type has different properties established by the “smart contract” (i.e. code on the blockchain) from which they were created. As the scope of smart contracts is quite technical and broad, let’s narrow it down to two popular blockchains that use the Ethereum Virtual Machine (EVM) - Ethereum and Polygon.
One of the main distinguishing properties of tokens is their “fungibility.” I.e. if every token is the same, and can be exchanged for one another (similar to fiat currencies) or if each token is uniquely distinguishable from the next (similar to trading cards). Here is a breakdown of these two broad categories:
Fungible tokens – Each token is identical to the next. Fungible tokens are most often used to represent cryptocurrencies, and function similarly to money. For example, if I have a dollar and you have a dollar, and we trade, we each still have $1.
Non-fungible tokens (NFTs) – Each token is unique and verifiably distinguishable from the next. NFTs represent ownership of digital assets and are most commonly used as digital collectibles. For example, if I have a baseball card of one player, and you have a card of a different player, if we trade, we now have different cards. Depending on a variety of factors (rarity, demand, etc.), each card can have a different value.
What is ERC?
Tokens are created from pieces of code on the blockchain known as smart contracts. These smart contracts designate what properties each token will have and what you can do with them. You may have already seen abbreviations starting with “ERC”… What do these mean?
“ERC” stands for “Ethereum Request for Comment,” and is a standard format for asking for input on the properties of new proposals for tokens. The Ethereum community contributes to these requests and establishes new token standards regularly.
Here are the three most popular token standards:
ERC20 – This standard is for creating fungible tokens.
ERC721 – This standard is the most popular for creating NFTs.
ERC1155 – This new standard can be used to create fungible tokens, NFTs, and “semi-fungible” tokens, and even to create all three types on the same contract.
What are Token IDs?
Before we get into the specific differences between these two standards, let’s address the primary underlying difference in how they work:
Token IDs – Numbers used to identify different tokens from the same smart contract.
ERC20
Tokens created from an ERC20 smart contract do not have Token IDs. This is because every token is the same and can be exchanged for any other token.
ERC721
Tokens created from an ERC721 smart contract each have a unique Token ID. For example, the CryptoPunk with Token ID 1 has a different picture than the CryptoPunk with TokenID 2, and they can be distinguished by checking their Token IDs on the blockchain.
ERC1155
With an ERC1155 smart contract, multiple tokens can be created for each Token ID. For example, for Token ID 1, you could create anywhere from 1 to infinity tokens. This allows 3 types of tokens to be created from ERC1155 smart contracts:
- Fungible – If you create 1 Token ID with multiple tokens (e.g. Token ID 1: 10,000x), these would be similar to those from an ERC20 smart contract (i.e. each could be exchanged for the next).
- Non-fungible – If you create 1 token for each Token ID (e.g. Token ID 1: 1x, Token ID 2: 1x, Token ID 3: 1x, etc.), these tokens would be similar to those created from an ERC721 smart contract. Each token would be unique and distinguishable from the next based on its Token ID.
- Semi-fungible – If you were to create, for example, 10 tokens for several Token IDs (e.g. Token ID 1: 10x, Token ID 2: 10x, Token ID 3: 10x, etc.) each token with the same Token ID would be fungible with each other (each one could be exchanged for another with the same Token ID). However, tokens with different Token IDs would still be distinguishable from tokens from the same smart contract with different Token IDs. In this case, these tokens would be considered “semi-fungible.”
What can you use each type of token for?
These different levels of fungibility make each standard suitable for different purposes. However, it’s important to note, ERC1155 smart contracts can fulfill any use case of ERC20 or ERC721 smart contracts as well.
ERC20
As we’ve mentioned, ERC20 tokens are most commonly used as cryptocurrencies. They can also be used for creating in-game currencies and utility tokens for a wide range of purposes.
ERC721
ERC 721 are most commonly used to create digital collectibles and allow users to buy NFTs: digital art, music, profile pictures, and digital trading cards. Any NFT collection that must be uniquely distinguishable from one another can be well served with ERC721.
ERC1155
ERC1155 smart contracts can be used to create tokens for both types of use cases outlined above. However, let’s consider a use case that is specific to the flexibility of ERC1155:
In real-estate tokenization, each property can be represented by a Token ID, and each Token ID can have, for example, 1,000 tokens. Each individual token represents one share of the property value and receives one share of the rent. A token holder with more tokens will own a greater share of the property and earn a greater share of the rent.
ERC 1155: Newer standard, more features
In addition to the above-mentioned flexibility, ERC1155 offers other features not found in the other types of smart contracts:
Batch transfers – The updated code of ERC1155 smart contracts allows for the transfer of multiple tokens in much more efficient ways than ERC721 tokens. This results in lower gas fees (blockchain transaction fees) and can potentially save huge amounts of money for everyone involved.
Transfer security – With both ERC721 and ERC1155 tokens, if you accidentally transfer them to the wrong address, you can potentially lose your tokens forever, as transfers cannot be reverted. However, ERC1155 contracts contain a "safe transfer" function that ensures tokens are only sent to addresses that are capable of handling them, by checking if the recipient address implements a specific function. This added security measure helps prevent the accidental loss of tokens due to incorrect recipient addresses.
Which token standard is right for your project?
We hope this helps you better understand these three common token standards and how they can be used. If you'd like to know more about different smart contracts, check out this article, and if you're not sure about the differences between OpenSea "collections" and using your own smart contract, have a look at our article on the topic.
If you’re still not sure which one would be best for your Web3 project, feel free to get in touch, and we’d be happy to help you figure it out.
If you’d like to take things further, Artiffine also provides custom smart contract and Web3 app development services, along with legal consultation, strategic consultation, and marketing services. Reach out to launch your project into the stratosphere!
FAQs
When should I use ERC20? When should I use ERC721?
Use ERC20 when you need fungible tokens, where each token is identical and interchangeable with another. This standard is ideal for creating cryptocurrencies, digital currencies for use within platforms or ecosystems, and utility tokens that serve specific functions within applications.
Choose ERC721 for non-fungible tokens (NFTs), where each token is unique and holds distinct properties or values. This standard suits digital collectibles, unique digital assets like artworks, in-game items, and other digital goods where individuality and proof of ownership are essential.
How can I attach images and other properties to my NFTs?
Usually, the images and token attributes are not stored on chain. The most common implementation is that the NFT contains a link to a metadata .json file, which is stored on the Interplanetary File System – IPFS (a popular distributed file storage network). This metadata schema contains the traits of the NFT (hair color, ears, eyes, etc.) and another link to the image file (artwork), also stored on the IPFS network.
Read more in our article "What is NFT metadata"
What are the advantages of using ERC1155 for real-estate tokenization compared to other standards?
ERC1155 offers significant advantages for real-estate tokenization through its flexibility and efficiency. By allowing multiple tokens to be created under each Token ID, ERC1155 can represent ownership shares in real estate, where each token corresponds to a portion of the property's value and rent revenue. This capability facilitates fractional ownership and simplifies the distribution of dividends to token holders. Additionally, ERC1155's support for batch transfers reduces transaction costs (gas fees) and enhances the efficiency of transferring multiple tokens, making it an ideal standard for the complex requirements of real-estate tokenization.
April 17, 2023