What Are ERC-20 Tokens
In today’s article I am going expand on my previous one, Smart Contracts: Code Is Law, and take a look into the world of ERC-20 tokens. This should be a short and sweet article, as there is not a lot to them, but they are a pretty valuable resources.
For the usual disclosure, I am not a financial advisor, I don’t even work in finance at all. My day job is as a telecommunications software engineer. Treat everything you read here as some educational resources and not financial advise. Some of the links you find on here will also be affiliate links, so using them will benefit the both of us.
Tokenized Crypto Currency
An ERC-20 token is simply a crypto currency that exists from a smart contract on the Ethereum (ETH) network, as opposed to it’s own blockchain. The ERC-20 standard was created to make it easy for anything that wants to interface with a token to be able to interface with any token.
Take an exchange such as Binance. If it needed to build a special interface for every single crypto that it supported on it’s platform, that would be an ungodly mess of code and interfaces, and I would not want to be the development team in charge of maintaining and adding to that.
Since the ERC-20 standard, you know, standardizes how the interface with the smart contract works, one set of code makes it possible to interface with every ERC-20 token that is out there.
The ERC-20 Standard
The ERC-20 standard defines a few optional and mandatory methods that make the token ERC-20 compliant.
The first ones are optional, but I mean, why wouldn’t you want to define at least the first two:
name() — Defines the name of the currency
symbol() — Defines the currency’s symbol
decimals() — Defines how small a piece each token can be divided into
Next up we have the mandatory methods:
totalSupply() — Returns the total supply of tokens
balanceOf() — Returns the balance of a given address
transfer() — Transfers a quantity of tokens to an address
transferFrom() — Transfers a quantity of tokens from one address to another
approve() — Approves a spender to take a quantity of tokens from your wallet
allowance() — Returns the total amount that the spender is allowed to withdraw from a wallet
There are also two events defined in the standard that fire for various things:
Transfer — This event fires when tokens are transferred from one address to another
Approval — This event triggers after a successful call to the approve() method
And that’s about it as far as the standard defines. Obviously a bit more code needs to go into the smart contract to make it all work properly, but as far as the interface it needs to provide, that’s all there is to it.
Why Use ERC-20 Tokens
ERC-20 tokens are quite often used because it wouldn’t necessarily make sense for a crypto to have it’s own blockchain to support it. Or sometimes a project will do it’s first release of it’s currency using a token and later migrate to it’s own chain, much like EOS (EOS) did.
They are fast and easy to create and manage. Hell, there are websites out there that you can pay a fee on and they will generate the smart contract and do all of the heavy lifting for it. It also makes it easier to have support for a token, as if something supports one ERC-20 token, it can support them all, so by using a token, you increase the supportability of your currency greatly.
Sometimes it just makes more sense to create a token instead of creating a full blown mainnet for a crypto.
Big Project Using ERC-20 Tokens
If you want some examples of what are released as ECR-20 tokens, well these have a wide range. Stablecoins are a big category of ERC-20 tokens, as it makes it easier to manage the pegging to the real world currency. This would be things like Tether (USDT) or USD Coin (USDC).
Another big category are Decentralized Finance (DeFi) tokens such as Compound (COMP) and Uniswap (UNI). This is a big category, and a lot of the top ERC-20 tokens by market cap reside in this category.
There are a lot of utility tokens that fall into this category. This would include things like the Basic Attention Token (BAT), which if you remember from one of my previous posts — Getting Some Free Starter Crypto — this is actually something you can earn for free just by clicking some ads periodically. And who doesn’t love free crypto.
As you can see, ECR-20 tokens are quite a useful thing, and very easy to create and deploy. I hope you found this post helpful in getting an understanding of what they are and how they are used.
If you enjoyed this content, come back every Monday through Thursday for fresh Crypto content. If you have any comments or questions, feel free to email me a email@example.com, use the Contact form, or hit me up on Twitter, Facebook, Instagram or Telegram.
You can also sign up for my weekly newsletter to receive fresh new crypto content to your inbox every Friday!
Missed some of the earlier posts, here are some related ones I think you’d enjoy: