ERC20 vs ERC721 – What's the difference?

Region: Europe
Jun 10, 2021, 2:00:00 PM Published By Wirex Team

We know what you’re thinking – what on earth do these things even mean? At first glance, it may look like a bunch of letters and numbers jumbled together. However, they’re quite significant factors when it comes to blockchain.

So, the question is – what are they, what do they do and what’s the difference between them?

What is ERC20?

ERC20 was created by Fabian Vogelsteller in 2015. Its purpose is to allow the implementation of a standard API (Application Programming Interface) for tokens within smart contracts.

In other words, it is essentially a standard protocol on the Ethereum blockchain. It carries out a set of rules so that new tokens can be shared, exchanged or transferred to a crypto wallet.

Moreover, an ERC20 standard only defines the API of a smart contract, but not its implementation. So, when you have a smart contract, you have groups of code known as “functions”. At the front, the interface details what a smart contract’s function should do.

Then, behind the scenes, there’s the implementation. This is the actual code of these functions.

The standards of an ERC20 token include:

  • Token name
  • Symbol
  • Decimal (up to 18)
  • totalSupply
  • balanceOf
  • transfer
  • transferFrom
  • approve
  • Allowance

The first three of these standards are optional, but the rest are mandatory. For instance, an ERC20 token must have a transfer function, which is where transfer and trasferFrom come in.

The transfer function enables the token owner (identified by their Ethereum address) to transfer the tokens to another Ethereum address. The transferFrom function is used for a third-party Ethereum address to transfer tokens on behalf of the owner.

What is ERC721?

ERC721 was created by William Entriken, Dieter Shirley, Jacob Evans and Natassia Sachs in 2018.

ERC721 tokens are more commonly known as Non-Fungible tokens (NFTs), which allows developers to tokenize ownership of any arbitrary data. Each NFT token is linked to different owners, making them unique. So, when several tokens are created within a single smart contract, each of them holds a different value.

Like with ERC20 standards, ERC721 also has an outline of rules that require certain features of a token.

These include:

  • How ownership is decided
  • How tokens are created
  • How tokens are transferred
  • How tokens are burned

What’s the difference?

The primary difference between ERC20 and ERC721 is that ERC20 tokens are fungible, whereas ERC721 tokens are not (hence why they’re called NFTs).

ERC20 tokens are also interchangeable and represent a single asset, whereas ERC721 represents a class of assets. Additionally, ERC721 is not dividable.

A popular example of this is CryptoKitties. The purpose of the game is for users to breed, buy and sell virtual cats. When you play CryptoKitties, you fully own an asset in the form of this virtual cat – each of which are unique and cannot be shared with anyone else.

The game quickly became a success – so much so that gaming on blockchain could become widely adopted in future. Read more about gaming on the blockchain here.

As for ERC20 tokens, they are completely dividable. This means you can give 0.1 of your tokens to someone else.

Do they have any problems?

In terms of issues, ERC20 faces the challenge of tokens being lost when being transferred to other wallets or smart contracts that don’t support ERC20 tokens. However, ERC223 and ERC777 were created as a solution to this problem.

ERC721’s main challenge is that transferring numerous assets can become expensive, hence why we have the ERC721 standard.

There are several differences between the two, and each offer something unique to its users. While they don’t come without their challenges, they’re always striving for improvement.