ERC-20 tokens are specifically created to work on the Ethereum blockchain platform. ERC-20 is a common standard that allows ERC-20 smart contract tokens to be easily created, shared, exchanged, and transferred to a compatible crypto wallet.
As the cryptocurrency world continues to evolve at a rapid pace and an ever greater number of developers and crypto entrepreneurs invent new dapps (decentralised apps) it has become increasingly important to find a way to maintain a standard level of interoperability and compatibility.
The original cryptocurrency Bitcoin is relatively basic when we look at the entire crypto world of today. The primary purpose of Bitcoin is the holding, sending and receiving of value in a digital world. That's pretty much it. When Ethereum arrived on the scene in 2015 it opened up a great deal more possibilities beyond simply being another cryptocurrency. Ethereum created an exciting new crypto eco-system where new decentralised applications (Dapps) and innovative use cases could be developed and the result has been, well, astounding.
How is Ethereum different from Bitcoin?
Before going into any detail about what ERC-20 is we really need to first grasp what Ethereum is and how it fits into the overall crypto world.
Bitcoin is the cryptocurrency that started it all. The vision being a universal, decentralised digital currency that nobody controls, this means no government, corporation or central banking organisation. Bitcoin fused cryptography and something called blockchain technology to provide the foundation on which Bitcoin operates. As with almost all new technologies, they are relatively basic when compared to later arrivals. Look at the first automobiles that arrived on the scene, whilst revolutionary and certainly paving the way for better cars, they were in relative terms of course way more basic compared to today's cars. Of course, they still perform the same core function, autonomous transportation, however, cars today are way faster, more efficient and superior in just about every way. In the world of crypto something similar happened and is still happening. Bitcoin spawned an entire industry and some bright people saw a bigger future. One of these people was Vitalik Buterin, the creator of Ethereum. Think of Ethereum as v2 of the automobile. Vitalik saw a use case beyond that of a digital currency and instead saw a platform or eco-system where blockchain technology and smart contracts could be put to use for an almost limitless amount of uses. Ethereum was born and has played a pivotal role in the world of crypto ever since and is now the second most valuable cryptocurrency after Bitcoin.
Ethereum and smart contracts
In essence, Ethereum is a blockchain that can record transactions and also a virtual machine that can produce smart contracts. Smart contracts were a game-changer in crypto!
Smart contracts are in very simple terms code that performs certain very specific functions whenever an action takes place. A very simple way to imagine a smart contract is a vending machine. The vending machine is programmed to release the specific item the user wants after they have inserted the correct amount of money. If the correct amount of money has been inserted the vending machine releases the product. It will even be programmed to give back the correct amount of change. A smart contract works in pretty much the same way. It is designed to perform certain functions when certain actions take place, for example, a person pays X in the correct amount of cryptocurrency and the smart contract releases Y to the person, like the deeds to a house or a piece of valuable artwork. Of course, smart contracts are way more complex but you get a general idea.
Going back to Bitcoin, there are no smart contracts. It is purely a means of storing and transferring value digitally.
Now, the two core functions of Ethereum, the blockchain and the ability to create smart contracts means that Ethereum is able to support an almost unlimited amount of dapps (decentralised apps) and this is where the ERC-20 token standard comes in very handy.
Depending on the intended use, DAPPs might create ERC-20 tokens to function as an in-game currency, points in a loyalty program, or even ownership of an actual real-world asset like gold, silver, artwork or the deeds to a property.
This is exactly what happened and before long all sorts of new tokens were invented for different purposes. As of the end of August 2021, there are nearly 450,000 different ERC-20 tokens according to the Etherscan website
ERC-20, a standard that developers can use to ensure quick and easy compatibility
With so many ERC-20 tokens around and way more to come, some kind of standard or framework was going to be needed before long.
During the very early days, if two different types of tokens, token A and token B wanted to work with each other, interoperate, they could each manually write their code to work with the other tokens code and token A and token B could technically work with each other. This was okay when there were just a handful of tokens, however, it became unmanageable pretty fast as the number of new tokens being launched on Ethereum exploded. A standard was desperately needed that developers could use as a common framework.
In answer to this, the Ethereum community developed a common standard or specification called ERC-20 to which all compatible tokens must adhere and comply. ERC standards for Ethereum Request for Comment.
Before we get into the technicalities of what ERC-20 is, let's look at a couple of simple analogies to get an understanding of why ERC-20 was needed and what it actually does in practical terms.
Let's begin by Imagining a casino environment full of all manner of different gaming machines from different manufacturers. So far so good. Now imagine that when you enter the casino, you need to exchange your Euros or Dollars for 20 or 30 different types and shapes of tokens as not every machine uses the same type of token. That would be completely impractical and frustrating. In answer to this problem, the casino would tell all the gaming machine manufacturers that in order to have their machines in the casino their machines would have to have a certain size and shape of the coin so that the same coin could work across all the machines. When you get paid out from one machine, you can take those tokens and put them into any other machine or convert all the remaining coins back to a fiat currency at the end of the day. This clearly makes things a lot easier and in very simple terms this is what Ethereum created with ERC-20, a specific standard that all compatible tokens have to adhere to in order to be able to interoperate and also be easily and quickly listed on exchanges.
Another way to imagine the ERC-20 standard would be to think about how debit and credit cards work. We as consumers can in most cases take any brand of debit card or credit card from any bank to a store and buy whatever we need. Each card conforms to a standard and contains some core information. Now if every card used a completely different standard it would be chaotic in store, imagine how many different machines or systems would be needed let alone the delays and confusion. Thankfully this isn't the case and we can very easily swipe or touch the card on a machine and in the majority of cases we're good to go due to a framework of common payment processing standards.
Now, the above are very simple examples just to demonstrate the problem and solution. Crypto tokens are way more complex than a casino coin or a debit or credit card and can perform a multitude of tasks and hold a whole host of values for different use cases from being a currency to owning a piece of art.
At its core. ERC-20 contains 3 optional and 6 mandatory rules that every token must be compliant with.
The three optional rules
- Token Name - This is the name of the token
- Symbol - This is the symbol of the token, a bit like a stock symbol like
- Decimal (up to 18) - this the divisibility of the token, 0 would mean it's not divisible, the decimal value can basically determine how small the fractions of a token can get
The six mandatory rules
- TotalSupply - This holds information about the total supply of the token
- BalanceOf - This holds information about the account balance of the holder's account
- Transfer - This executes the transfer of a specific number of tokens to a specific address
- TransferFrom - This executes the transfer of a specific number of tokens from a specific address
- Approve - This allows a user to withdraw a certain amount of tokens from a specific account
- Allowance - This allows a user to return a certain amount of tokens to a specific account
In addition to the above, these functions will trigger up to two events. This would be the transfer event that takes place whenever tokens are transferred and the approval/validation event that takes place whenever approval is required.
ERC-20 tokens have played a big part in the ICO craze and growth in the Ethereum platform of recent years
ERC-20 tokens have played a huge role in the massive amount of ICOs (initial coin offering) that have taken place over the last few years to help developers get funding for their projects. As ERC-20 tokens are relatively easy to create and are designed to work on the Ethereum platform they have helped to fuel the IPO boom.
What about the downsides of ERC-20?
Whilst ERC-20 has played a crucial part in the growth of the Ethereum platform and made things much easier for developers and ultimately users, ERC-20 isn't perfect. There are some issues that the ERC-20 token standard does not address.
One of these is that tokens could be unintentionally destroyed when they are accidentally used as payment for a smart contract application instead of correctly using ETH, the native currency of Ethereum. An estimated $3 million dollars of value has been lost due to this weakness. To resolve this problem, the Ethereum community is working on a new standard, ERC-223, however, this standard is not compatible with ERC-20, the dominant standard today so developers are still working primarily with ERC-20 until compatibility exists.
Another issue is what is known as the “batch overflow” bug that could allow an attacker to illegally potentially possess a huge amount of tokens by exploiting a weakness called the classic integer overflow issue. We are not going to get into this here but needless to say, it's a potentially huge security weakness in ERC-20.
As with almost all industries and major technological breakthroughs, there is a constant evolution, weaknesses are found, new use cases are discovered and innovation takes place every day. In the crypto world, the primary and not to be underestimated breakthrough was Bitcoin and the blockchain technology it uses. Bitcoin and blockchain technology paved the way for the likes of Ethereum where a broader use of crypto came about like DeFi (decentralised finance) and much more. ERC-20 is a standard that the Ethereum community introduced to provide a standardised means of compliance and ERC-20 has helped to propel Ethereum as a major crypto platform and ecosystem. ERC-20 isn't without its flaws and will no doubt be superseded in time. However, for now, at least it plays a major part in facilitating the creation of compatible tokens that are easy and quick to create, transfer and hold incompatible crypto wallets. ERC-20 helped to fuel the ICOs that helped generate huge amounts of startup capital which in turn has helped Ethereum and the broader crypto world get to where it is today.