ERC20 vs. ERC721: What is the difference?
Even if you’re relatively new to the world of cryptocurrency, there’s a very good chance that you’ve already heard of tokens, or perhaps coins. You will probably also already realise that these tokens are created on the Ethereum blockchain. The erc20 token, in particular, was welcomed as it allowed developers to create new tokens with ease.
Of course, you will find more than just one token type on the Ethereum blockchain. As well as having heard of the erc-20 token, it is quite likely that you’ll have noticed the erc-721 token being mentioned. This token type is not understood particularly well and, as we’ll see, it serves a completely different purpose than an erc20 token.
If you’re feeling a little confused, then you’re in the right place. Read on as we demystify these two tokens and aim to increase your understanding.
Read on to get passed the highlights so that you can dig into the real detail.
What even is a token?
Before we start to fully explore the differences between the erc-20 token and erc-721 tokens, it’s worth having a look at what tokens actually are. While not everyone will need this information, if you’re new to all of this, it’s certainly worth going back to the start.
When considering the Ethereum blockchain, any token type is merely a part of a token contract. Within each token, there is, effectively, a mini database. These databases are there to record who owns what. A token, on a basic level, can be seen as an entry in the token contract. The details of the owner of the token are recorded within the contract.
While you may have your Ethereum address for your wallet, a token is never really in this wallet. Rather than actually being in your wallet, there is just an entry made in the database that we referred to a little earlier. This basically states that your wallet is worth x number of tokens, even though they’re not actually present.
A look at non-fungible vs fungible assets
Fungible assets are relatively straightforward to understand. The easiest way to like at these is as something that can be swapped for one another. Let’s say that in your hand you had a US dollar bill. Someone comes along and takes it from you, but they place another US dollar bill into your other hand. While the behaviour may be questionable, the act itself doesn’t really matter. Why? Well, any US one-dollar bill is worth the same as another. it doesn’t really matter which one you have.
Unlike fungible assets, non-fungible assets can’t be swapped. The reason for this is that they are all unique and will hold different values. Perhaps one example could be looking at your house. Would you do a straight swap with a friend? It is unlikely as each property will have its own unique features and each will have its own value.
Non-fungible and fungible assets in crypto
If you’re looking to transfer tokens on the Ethereum blockchain then you will find that these are grouped in terms of fungibility and non-fungibility. The erc20 token represents fungible assets. These fungible assets represent ownership in things such as projects. They can be viewed as being similar to a gift card that can be used in place of cash to purchase something.
When looking at non-fungible assets, these are represented by erc-721 tokens. These are used as in-game assets, the best example of which can be found in the game CryptoKitties.
The ERC20 token standard
Created by Fabian Vogelsteller in 2015, an erc20 token is a smart contract with code. This code respects the token standard and so the functions of the smart contract also respect the interface, as defined in the erc20 token standard.
When you look a little deeper into the erc-20 token, there are a group of functions that define the metadata of the smart contracts. These include the likes of:
- Decimal places
At the heart of the erc20 token standard is the account system. If you look at a traditional bank, it manages a ledger of account owners and their balances. With erc20, a ledger contains an Ethereum address. In fact, it contains numerous Ethereum addresses and balances.
Another important feature here is the ability to transfer tokens. When looking to transfer tokens, the owner is identified by their Ethereum address. They can then transfer to another Ethereum address and the cryptographic workings of the Ethereum blockchain ensure that the correct person receives these.
ERC-721 token standard
Introduced in 2017, via the game CryptoKitties, erc-721 tokens are a little different. The game, CryptoKitties, sees players collect virtual kitties. Each of these is represented by erc-721 tokens.
Erc-721 tokens simplify ownership. It comes down to the fact that a player either fully owns an asset, or they don’t. There is no way of only half owning a CryptoKitty. This is why the erc-721 token standard is for non-fungible assets.
Aside from this, the token standard is similar to that of an erc20 token. When it comes to being able to transfer tokens, they are practically identical.