Content
Introduction
What is meant by the ERC-20 standard?
Brief recap of Ethereum tokens
How are ERC-20 tokens created?
What are the benefits of ERC-20 tokens?
Stablecoin
Security tokens
Utility tokens
Can ERC-20 tokens be mined?
Pros and cons of ERC-20 tokens
Pros of ERC-20 tokens
Cons of ERC-20 tokens
ERC-20, ERC-1155, ERC-223, ERC-721 – what are the differences?
Conclusion
Introduction
Ethereum was founded by Vitalik Buterin in 2014, positioning itself as an open-source platform for launching decentralized applications or decentralized applications (DApps). Many of Buterin's motivations for creating a new blockchain stem from the lack of flexibility in the Bitcoin protocol.
Since its emergence, the Ethereum blockchain has attracted interest from developers, businesses, and entrepreneurs, spawning a thriving industry where its users launch smart contracts and distributed applications.
In this article, we will look at the ERC-20 standard, an important framework in creating tokens. Although it specifically exists only on the Ethereum network, this framework has also inspired other blockchain standards, such as BEP-2 on Binance Chain.
What is meant by the ERC-20 standard?
In Ethereum, ERC stands for Ethereum Request for Comments. It is a technical document that outlines programming standards on Ethereum. ERC is different from Ethereum Improvement Proposal (EIP), which, like Bitcoin's BIP, serves to suggest improvements to the protocol itself. In contrast, ERC aims to create conventions that simplify how applications and contracts interact with each other.
Created by Vitalik Buterin and Fabian Vogelsteller in 2015, ERC-20 proposes a relatively simple format for Ethereum-based tokens. By following its outline, developers do not need to spend time starting from scratch. Instead, they can build on a foundation that has already been used across the network.
Newly issued ERC-20 tokens can automatically operate with services and software that support the ERC-20 standard (software wallets, hardware wallets, exchanges, etc.).
It is worth noting that the ERC-20 standard was developed into EIP (specifically, EIP-20). This occurred a few years after the original proposal due to its widespread use. However, even years later, the name 'ERC-20' still sticks.
A brief recap of Ethereum tokens
Unlike ETH (the native cryptocurrency of Ethereum), ERC-20 tokens are not owned by accounts. These tokens only exist within contracts, a kind of self-contained database. The contract defines the rules for the tokens (such as name, symbol, divisibility) and maintains a list mapping user balances to their respective Ethereum addresses.
To transfer tokens, users must send a transaction to the contract and request that the contract allocate a portion of their balance elsewhere. For example, if Alice wants to send 5,000 BinanceAcademyToken to Bob, she calls a function within the BinanceAcademyToken smart contract that requests the contract to carry out the intended transaction.

The function used by Alice will appear as a regular Ethereum transaction that pays 0 ETH to the token contract. This function is included in the additional field in the transaction, indicating what Alice wants to do – in this case, transfer tokens to Bob.
Although Alice does not send ether, she still has to pay a fee in that currency for her transaction to be included in a block. If she doesn't have ETH, she needs to provide it before transferring tokens.
Here is a real example from the above case on Etherscan: someone made a call to the BUSD contract. You can see the tokens transferred, and fees have been paid, even though the Value column indicates that 0 ETH has been sent.
Now that we have learned a bit about the basic concepts, let’s delve deeper to understand the structure of a typical ERC-20 contract.
How are ERC-20 tokens created?

To comply with ERC-20, your contract must include six mandatory functions: totalSupply, balanceOf, transfer, transferFrom, approve, and allowance. Additionally, you can define optional functions, such as name, symbol, and decimal. From their names, it may be clear to you what these functions do. If not, don't worry – we will break it down one by one.
Below are the functions that appear in the Solidity language specifically created on Ethereum.
totalSupply
function totalSupply() public view returns (uint256)When called by a user, the above function returns the total supply of tokens held by the contract.
balanceOf
function balanceOf(address _owner) public view returns (uint256 balance)Unlike totalSupply, balanceOf takes a parameter (address). When called, this function returns the token balance of that address. Remember that accounts on the Ethereum network are public, so you can query the balance of any user as long as you know their address.
transfer
function transfer(address _to, uint256 _value) public returns (bool success)The transfer function precisely transfers tokens from one user to another. Here, you provide the address you want to send to and the amount to be transferred.
When called, transfer triggers something called an event (or transfer event), which basically tells the blockchain to include a reference.
transferFrom
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success)The transferFrom function is an alternative to transfer, allowing for a bit more programming flexibility in decentralized applications. Like transfer, this function is used to move tokens, but the tokens in question do not have to belong to the party calling the contract.
In other words, you can authorize someone – or another contract – to transfer funds on your behalf. Its real-world use could be payments for subscription-based services, where you don’t want to send payments manually every day/week/month. Instead, a program will do it for you.
This function triggers the same event as transfer.
approve
function approve(address _spender, uint256 _value) public returns (bool success)Approve is another useful function from a programming perspective. With this function, you can limit the number of tokens that a smart contract can withdraw from your balance. Without this function, you risk losing all your funds (or getting exploited) due to a contract malfunction.
Take the previously mentioned subscription model as an example. Suppose you have a large number of BinanceAcademyToken and want to set up weekly recurring payments to a streaming DApp. You’re busy consuming content from Binance Academy day and night, so you don’t want to spend time every week manually creating transactions.
You have a substantial balance of BinanceAcademyToken, far exceeding what is needed to pay the subscription fee. To prevent the DApp from draining all your balance, you can set a limit with approve. If your subscription fee is one BinanceAcademyToken per week, and you limit the approved value to twenty tokens, then your subscription can be paid automatically for five months.
The worst that could happen, if the DApp tries to withdraw all your funds or if a bug is found, is that you only lose twenty tokens. This may not be ideal, but it is certainly better than losing all your assets.
When called, approve triggers the approval event. Like the transfer event, this event writes data to the blockchain.
allowance
function allowance(address _owner, address _spender) public view returns (uint256 remaining)Allowance can be used in conjunction with approve. If the contract is authorized to manage tokens, you can use this function to check how much can still be withdrawn. For example, if your subscription has used twelve of the twenty tokens you approved, calling the allowance function will return a total of eight.
Optional functions
The functions we discussed above are mandatory. On the other hand, the functions name, symbol, and decimal do not need to be included, but they can make your ERC-20 contract a bit prettier. Each of these functions allows you to add a human-readable name, set a symbol (like ETH, BTC, BNB), and specify how many decimal places can be used to divide the token. For example, tokens used as currency may benefit more if they can be divided than tokens that represent ownership of property.
See the following example on GitHub to see these elements in a real contract.
What are the benefits of ERC-20 tokens?

By combining all the above functions, we get the ERC-20 contract. We can request the total supply, check balances, transfer funds, and grant permission to other DApps to manage our tokens.
The biggest appeal of ERC-20 tokens is their flexibility. The established conventions do not restrict development, allowing parties to implement additional features and set specific parameters tailored to their needs.
Stablecoin
Stablecoins (tokens pegged to fiat currencies) often use the ERC-20 token standard. Transactions to the aforementioned BUSD contract are one example, and most major stablecoins are also available in this format.
For fiat-backed stablecoins, issuers hold reserves of euros, dollars, etc. Then, for each unit in that reserve, they issue tokens. This means that if $10,000 is locked in a vault, the issuer can create 10,000 tokens, each redeemable for $1.
Technically, this is relatively easy to implement in Ethereum. Issuers simply deploy a contract with 10,000 tokens. Then, they will distribute it to users with the promise that the tokens can later be redeemed for a proportional amount of fiat currency.
Users can do a number of things with these tokens – they can buy goods and services, or use them in DApps. Alternatively, they can request that the issuer redeem them immediately. In this case, the issuer will burn the returned tokens (making them unusable) and withdraw fiat in the same amount from their reserves.
The contracts governing this system, as mentioned above, are relatively simple. However, launching a stablecoin requires a lot of work on the external side, such as logistics work, complying with local government regulations, etc.
Security tokens
Security tokens are similar to stablecoins. At the contract level, both can even be identical as they function in the same way. The difference is seen at the issuer level. Security tokens represent securities, such as stocks, bonds, or physical assets. Often (though not always), this type of token gives some form of equity in the business or goods to its owner.
Utility tokens
Utility tokens may be the most commonly found type of token today. Unlike the previous two types, this type of token is not backed by anything. If asset-backed tokens are likened to stocks in an airline, utility tokens are like frequent-flyer programs: these tokens have a function but do not have external value. Utility tokens serve a wide array of uses, acting as currency in games, fuel for decentralized applications, loyalty points, and much more.
➠ Want to own cryptocurrency? Buy ether on Binance!
Can ERC-20 tokens be mined?
You can mine ether (ETH), but tokens cannot be mined – these tokens are minted to create new ones. When the contract is deployed, developers distribute the supply according to a plan and roadmap.
Typically, distribution is done through an Initial Coin Offering (ICO), Initial Exchange Offering (IEO), or Security Token Offering (STO). You may have heard various acronyms, but the concept is very similar. Investors send ether to the contract address, and in return, receive new tokens. The funds raised are used to finance further project development. Users hope to use their tokens (either immediately or later), or resell them for profit as the project grows.
Token distribution does not need to be automated. Many crowdfunding efforts allow users to pay with various different digital currencies (like BNB, BTC, ETH, and USDT). Balances are then allocated to addresses provided by users.
Pros and cons of ERC-20 tokens
Pros of ERC-20 tokens
Fungible
ERC-20 tokens are fungible – each unit can be exchanged for another unit. If you have BinanceAcademyToken, it doesn't matter which token you have, you can exchange it for someone else's BinanceAcademyToken, and these tokens remain functionally identical, just like cash or gold.
This is very ideal if your token aims to be some kind of currency. You don’t want every unit to have different properties, which would make them non-fungible. Non-fungible properties can cause some tokens to be more – or less – valuable than others.
Flexible
As we discussed in the previous section, ERC-20 tokens can be easily customized and can be designed for various applications. For example, they can be used as currency in games, in loyalty point programs, as digital collectibles, or even to represent rights in art and ownership.
Popular
The popularity of ERC-20 in the cryptocurrency industry is a strong reason for using it as a blueprint. Many exchanges, wallets, and smart contracts are already compatible with newly launched ERC-20 tokens. Furthermore, developer support and documentation are abundant.
Cons of ERC-20 tokens
Scalability
Like many other cryptocurrency networks, Ethereum is not immune to the growing pains that come with expansion. Currently, the network faces scalability issues – trying to send transactions during busy times results in high fees and delays. If you launch an ERC-20 token during a congested network, its usability could be affected.
This issue is not unique to Ethereum. Rather, it is a necessary trade-off to achieve a secure and distributed system. The community plans to address this issue by migrating to Ethereum 2.0, which will implement upgrades like Ethereum Plasma and Ethereum Casper.
Learn more about scalability issues in Blockchain Scalability: Sidechains and Payment Channels.
Fraud
Although it is not a technology-related issue, the ease of launching tokens can be seen as detrimental. It is very easy to create a simple ERC-20 token, which means anyone can do it – for good or ill intentions.
Therefore, you should be cautious with your investments. There are a number of pyramid and Ponzi schemes masquerading as blockchain projects. Do your own research before investing, to conclude whether the opportunities you see are legitimate or fraudulent.
ERC-20, ERC-1155, ERC-223, ERC-721 – what are the differences?
ERC-20 is the first Ethereum token standard (and, to date, the most popular), but it is not the only one. Over the years, many other standards have emerged, either proposing improvements to ERC-20 or having completely different purposes.
Some less common standards are those used in non-fungible tokens (NFTs). Sometimes, there is also an advantage to having unique tokens with different attributes. If you want to tokenize artwork, in-game assets, etc., one of these types of contracts may be more suitable.
The ERC-721 standard, for example, is used in the very popular CryptoKitties DApp. This type of contract provides an API for users to mint their own non-fungible tokens, which are non-fungible, to encode metadata (images, descriptions, etc.).
The ERC-1155 standard can be viewed as an improvement over ERC-721 and ERC-20. It creates a standard that supports both fungible and non-fungible tokens within the same contract.
Other options like ERC-223 or ERC-621 aim to enhance usability. ERC-223 implements safeguards to prevent accidental token transfers. ERC-621 adds extra functions to increase and decrease token supply.
For further discussion on NFTs, be sure to check out the Crypto Collectible and Non-Fungible Token (NFT) Guide.
Conclusion
The ERC-20 standard has dominated the cryptocurrency asset world for years, and the reasons are quite logical. Relatively easily, anyone can use a simple contract to fulfill various uses (utility tokens, stablecoins, etc.). Thus, it can be said that ERC-20 still outperforms other token standards. We will just have to wait and see if the next type of contract can replace it.
