Stand with Ukraine and Donate here

Introduction to ERC-20 Tokens


The Ethereum blockchain was founded by Vitalik Buterin in 2014 as an open-source platform for running decentralized applications. The protocol of the first cryptocurrency Bitcoin had serious problems with flexibility and adaptability, thus Buterin decided to make a much more fluid platform.

The new blockchain was quickly appreciated by both developers and potential investors, due to which a full-fledged industry was formed very quickly, operating based on distributed applications and smart contracts.

One of its most important components is the ERC-20 framework, which is used to create new tokens or tokens that can interact with Ethereum. Interestingly, this adaptive mechanism inspired Bitcoin developers to create a similar standard - BEP-2.

What is ERC-20?

ERC is "Ethereum Request for Comments". It is a kind of technical document that describes the programming standard in this blockchain. They should not be confused with Ethereum Improvement Proposals (EIPs), which, like Bitcoin BIPs, involve improvements and changes to the underlying protocol. ERC works differently - by establishing agreements that facilitate and facilitate interactions between individual applications and smart contracts.

Vitalik Buterin and Fabian Vogelsteller proposed a simple ERC-20 format back in 2015. According to their idea, this was necessary so that the developers did not invent their methods of interaction, but used a ready-made and universal foundation.

Therefore, each new ERC-20 token automatically receives the right to interact with services and software that comply with the ERC-20 standard. These include various cryptocurrency software and hardware wallets, exchanges, and other projects.

It should be noted that the ERC-20 was soon replaced by the more efficient EIP-20. But in the couple of years that it took, the developers got used to the old term, so it has become a household name, even though most new applications use its augmented and expanded version.

General principles of creating tokens on Ethereum

Unlike Ether, the backbone of Ethereum, ERC-20 tokens are not stored in accounts. They only exist inside a smart contract that acts as a standalone database. Also, Ethereum defines the basic rules for them (name, symbol, divisibility, other features) and maintains a list in which the balance of each user is compared with his address in Ethereum.

To move their tokens somewhere, the user must send a transaction request to the smart contract. In its form, this is identical to a regular request, in which 0 ETH is entered into a smart contract, but with an additional field, which indicates additional actions. In our case, the transfer of tokens to a new owner.

In this case, the commission will still have to be paid, since this is the only way to achieve the inclusion of the transaction in the block. And if there is no ether, then it will not work with ERC-20 tokens.

Now let's try to understand the structure of a typical ERC-20 smart contract.

What is the basis of ERC-20 tokens?

To comply with this standard, the contract must contain 6 main functions - totalSupply, balanceOf, transfer, transferFrom, approve, and allowance. There may also be others - name, symbol, and decimal, but they are not so important anymore. All of these features work within the framework of the programming language underlying Ethereum.


function totalSupply () public view returns (uint256)

When called, it displays the total amount of tokens contained in the smart contract.


function balanceOf (address _owner) public view returns (uint256 balance)

Requests a specific address and issues the balance of tokens on it. Since all records in Ethereum are publicly available, you can see the balance of any user if you know his address.


function transfer (address _to, uint256 _value) public returns (bool success)

Requests the address for transfer and the amount, then - carries out the transaction. When called, it launches "Event transfer", the record of which must already be added to the blockchain.


function transferFrom (address _from, address _to, uint256 _value) public returns (bool success)

An efficient alternative to transfer, which provides the ability to customize the process, especially in the framework of decentralized applications. Also used to move tokens, but they do not have to be owned by the caller of this function.

You give the smart contract the right to transfer funds on your behalf. For example, as part of a subscription to certain services, so that you do not enter data personally each time. As with a regular transfer, a record of this event must be added to the blockchain.


function approve (address _spender, uint256 _value) public returns (bool success)

An extremely useful function from a programming point of view. With its help, you can limit the number of tokens that a smart contract can withdraw from your account. Doing so increases the risk that you will lose your funds due to abuse or technical error.

Let's take a subscription to a service as an example. Suppose we have a large number of assets like EXBASETOKENs and we want to arrange weekly recurring payments for some DAPP application. And we need to somehow automate this so as not to waste our time on unnecessary actions.

The amount of EXBASETOKENs in our account significantly exceeds the cost of a subscription. Therefore, you run the APPROVE function and set the constraint. Let's say a subscription costs 1 token per week, and you specified a limit of 20 tokens. Now, every week for 5 months, funds will be debited from you regularly.

And if the DAPP app starts to act maliciously or gets hacked, you still won't lose more than 20 tokens. This is certainly not the perfect defense, but much better than nothing.

Calling this function, like transfer, triggers an event that needs to be added to the blockchain.


function allowance (address _owner, address _spender) public view returns (uint256 remaining)

Works great in conjunction with approving. If you have given some smart contract the right to manage part of your tokens, then using this function you can see how much more it can withdraw. Let's take the same example. You are allowed to write off 20 tokens as part of the weekly payment. 12 weeks have passed, you remembered about it and decided to see what other reserves you have left. The allowance function should give you a value of 8.

Additional features

The above features are required to comply with the ERC-20 standard. On the other hand, name, symbol, and decimal are optional, but they make the smart contract a little nicer and easier to read. They make it possible to add a human-readable name, set a symbol (ETH, BTC, or other), and specify how many decimal places to indicate when responding to a request. This can be important because tokens used for quick payment can be more divisible than those that represent ownership of a particular property.

What can be done with ERC-20 tokens?

By combining all the functions listed above, we get a full-fledged ERC-20 contract. We can find out the total number of assets, check our balance, transfer funds, or permit other decentralized applications to manage our tokens within a certainly given framework.

However, this is not all. Developers can implement their functions and set additional parameters based on their needs. This makes ERC-20 contracts so flexible.


Stablecoins - coins pegged to various fiat currencies very often use the ERC-20 standard. Especially the largest and most famous.

It looks like this. A typical fiat stablecoin issuer holds a certain amount in reserve in euros, dollars, or another currency. Then - issues an equivalent amount of tokens. So, for example, if you have a reserve of $ 10,000, you can issue $ 10,000 stablecoins.

This is very easy to implement within Ethereum. It is enough just to launch a smart contract with this amount, and then start distributing tokens among users with the promise that they will be able to redeem the corresponding amount of fiat currency using them at any time.

How users will dispose of tokens is their own business. They can pay for goods and services, or they can use them under DAPPs. Or return them to the issuer with an exchange request. In this case, fiat from reserves is transferred to users' accounts, and tokens are burned.

All of this works through fairly simple smart contracts. However, this requires a lot of work with external factors - logistics, regulatory compliance, and other things typical for fiat currency.

Security Tokens

In many ways they resemble stablecoins. So much so that smart contracts can be identical between them, since they function the same. The difference starts at the issuer level. Security tokens are various securities such as stocks, bonds, or ownership of physical assets. But otherwise, the differences are practically not observed.

Service tokens

Perhaps the most common at the moment. Unlike those described above, they are not backed by real assets. By analogy, stablecoins and Security tokens are like shares of a large airline, and Utility tokens are special “preferential” programs for frequent flyers. They have a certain internal function, but there is no external value. Examples include numerous in-game currencies, "fuel" for decentralized applications, loyalty points, and much more. And it all goes well with smart contracts.

Is there ERC-20 token mining?

In short, no. Tokens are "minted" or issued at the time of launching a smart contract, based on the plans of the developers and the "roadmap" of the project. And then they are distributed between investors and users.

Typically, as part of an Initial Coin Offering (ICO), Initial Exchange Offering - Initial Exchange Offering (IEO) and Security Token Offering (STO). Fortunately, the essence of these methods is very similar. Investors send ether to smart contracts and receive new tokens in return. ETH goes to further funding and development of the project, and users decide for themselves what to do with the received tokens. Most often, they resell them at a higher price if the project develops successfully.

But this allocation does not have to be automatic. Some crowdfunding projects themselves distribute tokens between investors and users, based on their activity and participation in the development of the idea.

Advantages and disadvantages

Let's start with the advantages.

  • Interchangeability. All units are interchangeable. If you have an EXBASETOKEN token, then you don't care who owned it before you. In any case, they will be identical in functionality - like gold or cash. Due to this, it turns out to achieve the same value for all units, which is especially useful if the token has the potential to develop into a kind of currency.
  • Adaptability. ERC-20 tokens are extremely easy to customize and adapt to a variety of needs. They can easily be used as in-game currency, as part of loyalty programs, as digital collectibles, and as rights to own objects of art.
  • Popularity. Especially in the cryptocurrency industry. Many exchanges, wallets, and smart contracts are by default able to work even with just launched tokens, which makes their distribution much easier. In addition, well-developed documentation and experienced developers are available.

But there are also disadvantages.

  • Scalability. The Ethereum blockchain is not immune to typical growth problems. Even now, they are already actively interfering. Attempting to send a transaction at peak times is fraught with either a long wait or an increase in fees. And all this directly concerns ERC-20 tokens, which, as we remember, are required to send information about transfers to the blockchain. However, they are actively working on this problem. And in the transition to Ethereum 2.0, according to the community, it will be possible to cope with it.
  • Scams. This, of course, is not a problem of technology, but it is impossible not to remember about it. The fact that anyone can create an ERC-20 token, promise a bunch of things, get ether as part of an ICO, and then disappear in an unknown direction is somewhat annoying. And you can also remember various projects based on financial pyramids and Ponzi schemes, which are disguised as classic blockchain projects. So before investing, it is better to conduct your own market analysis and understand what exactly is in front of you - a scam or a real idea.

ERC-20, ERC-1155, ERC-223, ERC-721 - what is the difference between them?

ERC-20 was the first and is still the most popular Ethereum blockchain token standard. But he is far from the only one. Over the years of development, new ones have appeared, either improving it or proposing fundamentally new goals and approaches.

Some of these standards are used in non-fungible tokens (NFTs) - non-replaceable tokens. They work especially well in situations where it is necessary to tokenize a one-of-a-kind asset.

An example is the ERC-721 standard. Used in the CryptoKitties DApp application, provides users with an API for minting their own tokens and encoding metadata (image, description, etc.)

The ERC-1155 standard is an improvement on both ERC-20 and ERC-721. It allows both interchangeable and non-interchangeable units to be described in the same contract.

ERC-223 and ERC-621 aim to improve usability. The first adds precautions against an accidental transfer of tokens, the second adds additional functions to increase or decrease the supply of tokens.


For many years, the ERC-20 standard has dominated the world of cryptocurrencies - and this is quite natural. Anyone with even a little coding knowledge could launch their own smart contract with a wide range of use cases. However, this standard is not perfect - it lacks many important features integrated into later development times. But will they be able to supplant ERC-20? So far, experts do not have a consensus on this matter.