ERC-20 tokens are cryptocurrencies that work on the Ethereum blockchain. They are fueled by smart contracts of the Ethereum network, use it to conduct transactions and interact with its addresses and wallets. At the same time, ERC 20 tokens have their own tickers, supply rates, price, and other parameters. For example, although EOS is an Ethereum token, it has a market cap of $11.5 billion, which is more than can be said about the majority of cryptocurrencies obtained by mining.
Thanks to the accessibility of the ERC20 architecture, it’s fairly easy to make and deploy your own token and distribute it (e.g. during an ICO). Within ICOs and other types of offerings, presales are held in order to attract funding from investors. The process of creating tokens is called TGE, short for Token Generation Event. Projects issue a certain number of ERC 20 tokens and sell them to all participants of a presale for bitcoins or ETH.
It should be noted that although ERC-20 tokens are fully-fledged cryptocurrencies that can end up on popular crypto exchanges, it doesn’t necessarily mean that they will. An erc20 token may take the crypto world by storm or forever remain on the balance of its creator.
Practical Uses of ERC20
At first, tokens were used during the initial fundraising for the development of the company. They were digital assets with fixed obligations. Tokens were purchased directly from developers and could not be sold or bought anywhere else.
The Ethereum ICO took place in 2014 and raised more than $16 million. Ethereum has drawn the attention of representatives of many industries, as it can be used to optimize and digitize inefficient business processes in the future.
An ERC-20 token can be considered cryptocurrency if it can be traded on crypto exchanges. ERC20-tokens can also evolve into entire ecosystems with their own blockchains. Some examples of ERC20 tokens that have created their own blockchain are Tron and EOS. Tron created its own blockchain because of its vision: blockchain games are becoming more popular every day. EOS is a competitor to Ethereum, mainly used for decentralized exchanges and gambling.
An Ethereum token can be used as an asset and a form of money; it can also represent valuables of any kind and grant memberships in a program or serve as a means of confirming ownership. Any real-world asset, physical or otherwise, can be tokenized and traded on crypto exchanges.
The Most Popular ERC-20 Tokens
The Ethereum blockchain is the de-facto home of crypto, hosting most of today’s biggest altcoins. The most famous tokens are ERC20 tokens, and most DApps in the crypto ecosystem are built on the Ethereum network. Some ERC20 standard stablecoins are known to dominate the cryptocurrency market.
Apart from Tether’s USDT, one of the biggest ERC20 stablecoins in the Ethereum network is USDC.
Launched by Coinbase in collaboration with Circle, USDC is commonly viewed as a more trustworthy alternative to USDT by those with a critical stance on Tether.
Binance’s BEP20 standard is hosted on the Binance Smart Chain, which in turn derives from the Ethereum network. Therefore, Binance’s two native tokens – BNB and BUSD – can also be technically considered to be Ethereum tokens.
A single standard, ease of creation and compatibility with platforms have led to the widespread distribution of ERC20 tokens. Below are some examples of popular tokens using the ERC20 protocol.
A USD-pegged stablecoin USDT was issued by Tether Limited in 2015. Based on the ERC 20 standard, it has since become the go-to stablecoin for most crypto traders and exchanges worldwide. The value of USDT Tether is backed up by US dollars on the company’s accounts.
Other fiat currencies have their own stablecoins. For example, Binance GBP is backed by the British pound, and STASIS is backed by the euro.
The old system was based on the Omni protocol based on the Bitcoin blockchain. Due to high fees and long confirmation time, the company decided to migrate to the Ethereum blockchain.
Wrapped Bitcoin & Wrapped Ether
ETH, or ether, is the base currency of Ethereum. WETH is “wrapped ETH” or “Ether in a shell”. It was introduced because ETH appeared before the adoption of the ERC20 standard and therefore did not comply with it.
Decentralized platforms based on Ethereum exchange tokens between users based on smart contracts. In order for an exchange to happen, the tokens must belong to the same standard.
WETH is used to exchange ETH tokens for the corresponding ERC20 protocol.
Numerous network users, including large corporations with capital, are interested in the development of the base currency.
the Wrapped Ether system, which owns more than 2 million ETH worth $ 380 million;
one of the leading cryptocurrency exchanges, Binance, $ 370 million;
Bitfinex exchange, less than 2 million ETH.
Bitcoin also has a wrapped ERC20 version called WBTC. The original BTC is the native token of the Bitcoin blockchain and isn’t Ethereum-friendly. Like WETH, WBTC is meant to fix that: it’s always pegged to the price of Bitcoin and is fully compatible with the Ethereum network. Wrapped tokens are most often used to transfer tokens between different networks that aren’t mutually compatible.
LocalCoinSwap is a decentralized platform that provides users with the opportunity to directly purchase and sell cryptocurrency using any of the available payment methods.
LCS allows you to find a buyer or seller of currency and make a transaction without involving websites and wallets. The platform uses a traditional deposit system, which stores cryptocurrency funds that can be exchanged. When the payment is confirmed by the buyer and seller, the system sends coins to the buyer. The platform gives the right to receive dividends in a ratio of 1 to 1 at the end of the quarter.
Etherscan: The Home of ERC 20 Tokens
ERC20 token contracts can be viewed on Etherscan.io — the native tracker of the Ethereum network.
Along with their tickers and brief descriptions, you can monitor their total supply figures, market cap (on-chain and circulating), number of holders, and price and price change figures.
To view all ERC20 token contracts on the Ethereum network, you need to click Tokens in the upper right and then select ERC20 tokens. Every new token with a more or less competitive market cap will be listed here.
At the time of this writing, there are at least 625,000 ERC20 Token Contracts deployed on the Ethereum network. You can also view other Ethereum token standards here – ERC721 for non-fungible tokens (NFTs) and ERC155 for multi tokens.
The Technical Side of an ERC 20 Token
Essentially, ERC-20 tokens are smart contracts on the Ethereum blockchain. ERC-20 is a unified standard, including a set of ground rules for a contract to follow. The standard ensures the compatibility of all tokens within the network.
ERC stands for “Ethereum Request for Comments”, and 20 is its identifier number.
ERC-20 was envisioned back in 2015 and went worldwide in 2017. Before it, all smart contracts were fairly heterogeneous, causing compatibility issues between them, and wallets would have to deal with heaps of code to recognize each specific token.
ERC20 Tokens and EVM
EVM (Ethereum Virtual Machine) is a virtual computing environment, a distributed computer responsible for executing algorithms on the Ethereum network (smart contracts).
The EVM is considered Turing-complete, which means it is theoretically capable of handling any computational task that can be done on computers (given enough resources).
As a payment for the execution of smart contracts, the EVM uses “gas”, measured in ‘gwei’, the smallest possible fraction of ETH; gas is included in the cost of the transaction. The specific amount of gas that the user must pay depends on the complexity of the calculations performed and the current workload of the Ethereum blockchain.
Smart contracts that follow a defined data structure on the EVM are used to create ERC-20 tokens. This data structure controls the naming, distribution, supply amount and monitoring of the token.
ERC20 = Code?
Many wonder if ERC 20 can be considered code. The answer is not exactly: an ERC20 token serves more as a set of guidelines aimed to outline the ground rules for operating within the Ethereum network.
The standard serves a number of purposes, including keeping track of all the transactions, a user’s current token balance, the token’s ticker and total supply rates; the ERC 20 token standard also ensures compatibility of different DApps (Decentralized Apps) in the network.
Inside an ERC 20 Token Contract
The ERC20 standard outlines six mandatory and three optional functions that must be followed for a smart contract to work properly.
Every token must have a name and a token symbol (also known as the ticker). It also has to specify its decimals, i.e. how many times it can be divided by 10. Below, you will find a set of the mandatory functions, which some might find a bit hard to grasp at first:
function () public view returns (uint256); function balanceOf(address tokenOwner) public view returns (uint); function allowance(address tokenOwner, address spender) public view returns (uint); function transfer(address to, uint tokens) public returns (bool); function approve(address spender, uint tokens) public returns (bool); function transferFrom(address from, address to, uint tokens) public returns (bool);
Here’s what these functions represent:
TotalSupply: The total number of tokens that will ever be issued;
BalanceOf: The account balance of a token owner’s account;
Transfer: Automatically executes transfers of a specified number of tokens to a specified address for transactions using the token;
TransferFrom: Automatically executes transfers of a specified number of tokens from a specified address using the token;
Approve: Allows a spender to withdraw a set number of tokens from a specified account, up to a specific amount;
Allowance: Returns a set number of tokens from a spender to the owner;
Transfer: An event triggered when a transfer is successful (an event);
Approval: A log of an approved event (an event).
With proper authorization, the functions of ERC20 allow an external entity, e.g. a crypto-wallet app, to see its balance and transfer tokens between users.
There are two event types recognized by the smart contract:
event Approval(address indexed tokenOwner, address indexed spender, uint tokens); event Transfer(address indexed from, address indexed to, uint tokens);
The events can be:
Either one happens once an Ethereum account has granted someone rights to withdraw tokens from it and after the tokens have actually been transferred. As per the standard, ‘function transfer’ must emit the Transfer event on a successful transfer of tokens.
function allowance(address owner, address spender) external view returns (uint256);2
The ERC-20 standard allows an address to give an allowance to another address to be able to retrieve tokens from it. This getter returns the remaining number of tokens that the spender will be allowed to spend on behalf of the owner. This function is a getter and does not modify the state of the contract, and should return 0 by default.
Making an ERC 20 Token
Сhoose a name, for example, Best Coin
Сhoose, a symbol, let’s make it BEC
Decide on the total supply
Decide whether the tokens will be divisible, and if so, how many decimal places will be the maximum
Deploy the Token
Enter the following data into the smart contract available by the link. Download both .sol files. Go to the remix editor. Download both files.
Files are loaded with the Load(Open) button. Select both files.
Open NewToken.sol, put the necessary values in <brackets> instead of the variables:
totalSupply — total number of tokens
name — the full name of the token
decimal — the number of zacks after the decimal point. The fact is that in contracts, everything is stored only in integers. Therefore, you should specify the number of characters if you want to be able to credit a non-integer number of tokens.
Symbol — a symbol for exchanges
It should turn out something like this:
Save it. It remains to upload the contract to the network. For example, install it in the Ropsten test net. Any client will be required for the deployment. Let’s use MetaMask — it does not know how to compile smart contracts on Solidity, so we will compile first.
In the right part of the remix editor, open the compile tab. By default, the contract is compiled automatically. By selecting your contract in select and clicking Details, you can view the bytecode and other information.
To deploy, click Run, select Injected Web3, and select the Account that we will deploy (it should load automatically if you have MetaMask installed in the browser). Enter the necessary information in the fields (gas, value), and click Create.
MetaMask picks up the action from the page.
Click Submit. Your contract is sealed. The dispatch is confirmed in MetaMask by an icon with a document (it leads to the transaction page) and the inscription “Contract published”.
A sealed smart contract is a token.
Ethereum-based token transactions require two wallets — the one that already has them (by default, the contract creator, the ERC20 standard) and the one that needs to transfer them.
Perform operations with our token (transfer it, for example). We can either on the etherscan smart contract page (link in MetaMask) or on the remix page.
Blue here — read operations, pink — write operations.
To transfer ERC-20 tokens, enter the recipient’s address and quantity. After that (and entering data into the blockchain, of course), you can check your balance or the balance of the recipient of the tokens with the operation balanceOf.
The Issues With the ERC 20 Token Standard
There are two layers of the ERC 20 token issues. There are two layers: the user end and the developer end.
For Token Users
For common users, the most widespread inconveniences include:
Low throughput – The Ethereum network has been clogged up when dapps have experienced high demand, such as CryptoKitties (which has since moved to its own Flow blockchain). When this happens, the network slows down, and transactions become more expensive.
Slow transactions – The block time is around 14 seconds, so transactions can take up to a minute to process. This may be adequate for some uses or too slow for others.
ETH for gas payments – When transactions are made involving ERC-20 tokens, a second cryptocurrency is needed to pay for the transaction fees. This can add both time and cost, as it can result in accumulating a ‘dust’ balance on different platforms.
For Token Developers
ERC20 tokens have two critical issues that are known to cause monetary losses. They are:
Lack of transaction handling.
There are two ways of performing a transaction in ERC20 tokens:
approve + transferFrom mechanism.
Token balance is just a variable inside the token contract.
Transaction of a token is an alteration in the internal variables of the smart contract (the current balance of the sender will be decreased, and that of the recipient will be increased).
The transfer function will not notify the recipient that a transaction has been carried out. The recipient cannot recognize the incoming transaction! This may lead to unhandled transactions and monetary losses.
As a result, if the recipient is a smart contract, users must transfer their erc20 tokens using the approve +transferFrom algorithm. If the recipient is an externally owned account address, users must transfer their tokens via the transfer function.
If a user makes a mistake and chooses the wrong function, then the token will get stuck inside the smart contract, and the transaction will not be recognized. The stuck erc20 tokens will therefore be impossible to retrieve.
At least $400 000 has been lost because of this issue.
The approve + transferFrom mechanism is potentially insecure
The approve + transferFrom mechanism is known to allow double-spending.
This is not relevant unless there will be a possibility to create custom token-exchanges like target=”_blank”> target=”_blank”> Bancor token changer.
The solution to this is the ERC223 token standard.
The ERC #223 token standard was developed specifically to solve the issues of the ERC 20 token standard.
Every token developer should pay attention to this. Developing a token that will lead to monetary losses for your users is not a good solution. Please be responsible for the developments that you are conducting.
How This Works in Practice
Alice has 10 ERC20 tokens. She wants to send 3 tokens to Bob.
It may seem that Alice has some tokens “on her account balance” for ordinary users, but the balance of the token is just a variable inside the token contract.
Alice is initiating a transaction. Every token transaction is a call of a token contract, in fact.
Alice is asking the token contract to reduce her balance by 3 and to increase Bob’s balance by 3 at the same time.
After the transaction is mined, the internal variables of this ERC 20 token contract will be changed. No one will tell the receiver (Bob, in this case) that the transaction occurred.
This is fine for externally owned accounts (i.e. owned by humans). Alice can tell Bob that she sent him tokens. Bob can look at his balance and realize that it actually happened.
This is a critical issue for contracts, and it results in lost tokens. Contracts that are not designed to work with tokens must reject incoming token transactions. Otherwise, each contract becomes a potential token trap due to the inability to reject improper token transfers.
ERC here, in technical terms, is called the ‘public constant symbol’. Ethereum Request for Comments is the name of the document describing the rules for creating tokens on the blockchain.
Legal Implications of ERC20
From the legal standpoint, the situation around ERC 20 tokens is even vaguer than that of cryptocurrencies.
The regulatory climate around this area in most countries of the world either does not exist at all or is inclined towards a “ban”. This is due to a number of factors, including:
A large amount of ERC 20 token-related fraud. Since the essence of the token became most widespread in connection with the ICO, many of which were outright or hidden scams, this left a negative imprint on the concept.
Cryptocurrency is a relatively young field. Blockchain technology has made serious innovations in the world of financial technologies. First of all, this is the complexity of regulating this sphere in connection with the use of decentralization technologies and fake anonymity. Secondly, it is a new field in the global economy.
ERC 20 Token = Security?
There’s a lot of argument going on around recognizing ERC 20 tokens as securities. Especially that concerns those seeking to create and distribute their own tokens within an ICO etc. The fact is that ERC 20 tokens (“shares that would give owners returns”) would be subject to the securities laws in the U.S. and most other places. You don’t even have to hit the complex Howey test. The Landreth Timber and other similar tests do the trick – a profit interest in an enterprise will be considered security anyway.
The fact that a token is a security doesn’t mean you can’t sell it. People buy and sell securities all the time (think Silicon Valley start-ups). But to do so, you have to comply with one of the private placement exemptions for securities set forth in the securities laws. That typically means not offering it to the general public, not advertising it, etc. – in other words, the opposite of what most token sales are doing.
Or you could go the Reg A+ route and offer the token to the public, but capped at a $50 million raise and getting SEC approval first and with some ongoing reporting (not as bad as the reporting required for a full-blown Exchange-Act-reporting company). There are some other mix-and-match options within the same general zone of securities laws.