A Beginners Guide To ERC-20, ERC-721 & ERC-1155: Ethereum Token Standards

One of the core ideas of Ethereum is to be a general-purpose blockchain. What that means is anyone who wants to build an application (I probably should say DApp), launch a token, etc . can do it on Ethereum in a permissionless manner.

And that’s how today we have many Defi protocols, tokens, Dapps, etc.

So people can still build any kind of token that they want. Do they have to follow any rules?

Not necessarily, but doing so will have some advantages.

Beforing getting to what those rules are, let’s start with ‘Why’?

Why Rules?

First of all those rules are called ‘Token Standards’. These standards dictate the rules (or guidelines) of how a token should be created, and deployed on the blockchain.

Before looking at ‘why rules’, you should know how tokens are created.

They are created from the smart contract which is basically a piece of code that executes on its own when certain conditions are met.

This smart contract helps in creating tokens, managing transactions, and updating the balances of each token holder.

So, if you want to create your own token on Ethereum, you need to write and deploy a smart contract that does all the functions described above.

Now, what’s the key advantage of following the rules? Well, let’s talk about what would happen if you don’t follow the standards.

You can’t interact with all the Defi pools with your token. You can’t swap. Your token can’t fit in the current NFT infrastructure, because all the other tokens are based on ERC-721 (more about that soon).

But why?

Because each exchange has to write a custom code for your token, to make sure it is swappable with others. Each wallet provider (like Metamask and Wallet Connect) has to write custom code to make sure they support your tokens.

So, the lesson here is to always follow a token standard.

Ok, but where do these standards come from? In other words, who creates these standards?

EIPs

EIP stands for Ethereum Improvement Proposal. And anyone can submit an EIP which basically is an idea/suggestion to improve Ethereum on the Ethereum github page.

Once the submitted proposal goes through many reviews and discussions, the community approves it (which is very rare and that is why we have very less token standards).

And all those approved ones are named ERC with a number attached to it. That number is the EIP submission proposal number.

ERC

ERC stands for Ethereum Request for Comments. It’s the term the Ethereum Smart Contract developers use to define ‘rules’.

Different ERCs are created for different purposes. All token standards are based on creating either fungible or non-fungible tokens. (We are gonna talk about what those even mean in the next sections).

And in this article, we are gonna talk about the 3 most commonly used ERC standards.

ERC-20

We talked about how many problems would arise because of the lack of technical standards. So, the community initially approved ERC-20 (which was proposed by Fabian Vogelsteller), which is the first-ever standard on Ethereum.

Note: The number 20 came from the EIP number.

ERC-20 is the technical standard for creating fungible tokens on Ethereum. Fungible means, that one token can be interchangeable with another token.

ETH is the native currency of the Ethereum Blockchain. But not all protocols or Dapps use ETH to exchange value. They create their own.

Uniswap has UNI, which is their governance token.

Decentraland has MANA token using which you can buy land parcels.

And all these tokens were created and deployed based on the ERC-20 standard because the creators wanted these tokens to be fungible.

I can exchange my 10 MANA tokens for your 10 MANA tokens. And 1 MANA = 1 MANA. And moreover, I can swap these 10 MANA tokens and get some $SAND tokens as both are ERC-20.

So, Defi Pools and exchanges don’t have to write a custom code for the above swap, because both tokens are created based on the ERC-20 standard.

Tether USD (USDT), USD Coin (USDC), Shiba Inu (SHIB), DAI (DAI), and MAKER (MKR) are some examples of ERC-20 tokens.

The example used: Enjin (ENJ)

It is because of this standard, you can hold UNI tokens in your Metamask wallet or swap MANA in Binance Exchange for USDC which you can then transfer to Metamask and then send to Coinbase to swap for ETH.

Interoperability at its best!

ERC-721

What if I want to create a token that is very unique? MANA isn’t unique. Because there are 1.85B in circulation.

That’s when ERC-721 came in (from EIP 721), which also lead to the concept of NFTs. This is the token standard to create Non-fungible tokens.

There are 10,000 CryptoPunks. But each has its own unique traits. Some are male. Some are female. A few are aliens. A few smoke cigars.

And all of this data (male, alien, cigar, etc) aka traits are embedded into the metadata of each NFT.

What I am trying to say is that each NFT is unique. A land (non-fungible) that you purchase with MANA (fungible) is an NFT.

Each NFT is different and you can track the ownership of each one separately, unlike ERC-20 tokens, where you can only track the balances of owners.

In other words:

  • ERC-721: Which tokens does he hold?
  • ERC-20: How many tokens does she have?

Or

  • ERC721: You have 2 NFTs and each one is different (CryptoPunk #5822  sold for $23.7 million whereas CryptoPunk #8857 sold for $6.63 Million).
  • ERC-20: I have 10 tokens and each token is the same as the others (10 ETH = 10 * 1ETH. I can only sell each of these tokens for the same price, at a given point in time).

The whole point of NFTs is to prove ownership and this token standard gave birth to that concept.

ERC-1155

Ok, fungibility is cool. Non-fungibility is great.

But what if I want to create both fungible and non-fungible in the same contract? That’s when you’ll have to choose the ERC-1155 standard.

On the other side, it is also considered an improved version of ERC-721, in the sense that one token contract can manage multiple NFT types.

What does that mean?

With ERC-721, during the minting process, Bored Apes are minted via a contract, Punks are minted via contract, etc. All of those are separate contracts. One NFT type, one smart contract.

Now, with ERC-1155, all of these can be minted in a single contract, instead of different contracts for different NFT collections.

That’s not it.

This standard helps manage both fungible and non-fungible tokens in the same contract.

So, coming back again to the Decentraland example, both MANA (native token – fungible) and land parcels (non-fungible) can be a part of the same contract.

And in this token standard, as all the tokens (fungible and non-fungible) are in a single smart contract, batch transfer aka transferring multiple tokens is possible which makes the transaction less gas-intensive.

Simply put, ERC-1155 helps create both fungible and non-fungible tokens without having to create multiple contracts for each token type.

Conclusion

These standardizations of tokens lead to the widespread adoption of cryptocurrencies, tokens, and NFTs. I hope this article gave you a clear idea of what these guidelines are and why they are so important.

Most Popular