Mastering ERC-20 Tokens on Ethereum: A Comprehensive Guide

Mastering ERC-20 Tokens on Ethereum: A Comprehensive Guide

ERC-20 is the technical standard for creating fungible tokens on the Ethereum blockchain: a fixed set of functions and events that a token’s smart contract must implement. Fungible means every unit is interchangeable with every other unit. ERC-20 is not a separate network and not the same thing as ether (ETH). It is a rulebook that lets wallets, exchanges and applications handle thousands of different Ethereum tokens with the same code. When an exchange labels a deposit option “ERC-20,” it means the token moves on the Ethereum network under that rulebook.

What the name ERC-20 means

ERC is short for Ethereum Request for Comment, the format Ethereum developers use to propose and document application-level standards. The number is an identifier: developer Fabian Vogelsteller’s 2015 proposal received number 20, so the token standard became ERC-20.

In the ERC-20 context, a token is a smart contract on Ethereum that implements the standard’s required interface. It can represent a currency, a voting right, a claim on an off-chain asset or a unit of in-app credit. What it represents is up to whoever created it.

How the standard came about

By 2015, developers were already issuing tokens through Ethereum smart contracts, but with no agreed structure. Each project named functions, stored balances and handled transfers its own way. Wallets and exchanges had to write custom code for every new token, and tokens from different projects could not easily be used together.

Vogelsteller submitted the proposal on the Ethereum project’s GitHub. After community review it was finalized in 2017 as EIP-20, but the industry already called it ERC-20, so both names refer to the same standard.

How an ERC-20 token actually works

Tokens do not sit “inside” a wallet the way files sit on a hard drive. An ERC-20 token is a smart contract deployed at a fixed address on Ethereum, with an internal ledger mapping each holder’s address to a balance. Sending tokens asks the contract to subtract an amount from your entry and add it to someone else’s. Your wallet reads the contract and displays the result.

ERC-20 defines the shape of that contract: which functions it exposes and which events it emits.

Required functions

The standard calls these “methods.” Every compliant token must implement:

  • totalSupply: returns the total number of tokens in existence under the contract.
  • balanceOf: returns the token balance held by a given address.
  • transfer: moves a specified amount of tokens from the caller’s address to another address.
  • transferFrom: moves a specified amount from one address to another on behalf of the owner, provided the caller has been authorized.
  • approve: authorizes a spender address to withdraw up to a set amount from the caller’s balance.
  • allowance: returns how much a spender is still authorized to withdraw from an owner’s balance.

Because every token uses the same function signatures in Solidity, Ethereum’s main smart contract language, a wallet can query the balance of any ERC-20 token without knowing anything else about it.

Required events

Events are log entries the contract records on the blockchain when something happens:

  • Transfer: emitted when tokens move from one address to another, including when new tokens are created.
  • Approval: emitted when an owner authorizes a spender.

Block explorers, wallets and accounting tools read these logs to build transaction histories. That is why a token transfer shows up on an Ethereum explorer even though no ETH changed hands.

Optional metadata

Three functions are optional but almost always included, because they make a token readable to people:

  • name: the full name, such as “USD Coin.”
  • symbol: the ticker, such as “USDC.”
  • decimals: how many decimal places the token uses.

Decimals matter more than they look. The contract stores balances as whole numbers, and the decimals value tells software where to place the decimal point. For a token with 6 decimals, a stored balance of 2,500,000 displays as 2.5 tokens. With 18 decimals, the same amount would be stored as 2,500,000,000,000,000,000. USDC and USDT on Ethereum use 6 decimals, while many other tokens use 18. Software that assumes the wrong figure misreports amounts by orders of magnitude.

A name and symbol are not unique or protected. Anyone can deploy a contract called “Tether USD” with the symbol “USDT.” The contract address is what identifies a token, not its ticker.

Approvals: the part users most often overlook

The approve and transferFrom pair lets decentralized applications work with tokens. A decentralized exchange cannot reach into your balance on its own. You first call approve to set an allowance for its contract, which then calls transferFrom to pull the tokens when you trade.

Here is a hypothetical example. You approve a trading contract to spend 500 tokens, then swap 200. The allowance function would now return 300, and the contract can pull up to 300 more without asking again.

Many applications request a very large or “unlimited” allowance so users don’t have to approve, and pay gas for, every trade. The authorization persists until you change it, so if that contract is later exploited or turns out to be malicious, it can move your approved tokens. Setting the allowance to zero revokes it, and several wallets and explorers offer tools to review and revoke approvals.

The original specification also flagged a technical weakness. Changing an existing nonzero allowance directly to another nonzero value can let a spender use both the old and new amounts if it acts at the right moment. The recommended practice is to set the allowance to zero first, then to the new value.

ERC-20 tokens vs. ETH

ETH is the native currency of Ethereum, built into the protocol rather than issued by a contract, and used to pay gas, the fee for computation on the network. ETH does not follow the ERC-20 interface. That is why wrapped ether (WETH) exists: an ERC-20 token redeemable one for one with ETH, so ether can be used in applications that expect the standard interface.

ERC-20 tokens are contract-based assets that anyone can create. Every ERC-20 transaction is an Ethereum transaction, so moving tokens costs gas paid in ETH. Holding 1,000 USDT on Ethereum with zero ETH in the same address means you cannot send that USDT until you add some ETH for fees.

What an ERC-20 transaction looks like

When you send an ERC-20 token, the transaction your wallet signs is not addressed to the recipient. It is addressed to the token contract, and it carries an instruction to call transfer with the recipient’s address and the amount. On a block explorer, the ETH value of such a transaction is usually zero. The token movement appears separately, decoded from the Transfer event.

This explains a few common points of confusion:

  • The “to” field on the raw transaction shows the token contract, not your recipient.
  • The fee is in ETH and depends on network demand and the contract’s complexity, not on how many tokens you send.
  • A failed token transfer can still consume gas, because the network did computational work before the call failed.

Choosing the right network when depositing or withdrawing

Many tokens exist on several blockchains. USDT, for example, is issued on Ethereum and on other networks such as Tron, where the comparable standard is TRC-20. These are separate token contracts on separate chains that cannot be sent directly to each other’s networks; moving between them requires an exchange or a bridge. When an exchange asks you to pick a network for USDT, “ERC-20” means the Ethereum version.

Selecting a network has practical consequences:

  • Sending and receiving networks must match. Tokens sent on Ethereum arrive only on Ethereum. If the receiving platform does not support that network for that token, recovery may be impossible or may depend on the platform’s support team.
  • Fees differ by network. Ethereum gas is paid in ETH, and other chains charge their own fees in their own native assets.
  • Address formats can look identical. Ethereum-compatible chains such as BNB Smart Chain use the same address format as Ethereum. A valid-looking address does not confirm you have chosen the right network.

How ERC-20 compares with other token standards

BEP-2 was the token standard for Binance Chain, the blockchain launched by the Binance exchange. It served the same purpose as ERC-20, but the chain did not run the Ethereum Virtual Machine, so BEP-2 tokens were not directly compatible with Ethereum tools.

BEP-20 is the standard on BNB Smart Chain (originally Binance Smart Chain), which supports the Ethereum Virtual Machine. BEP-20 closely mirrors ERC-20, so Ethereum-style wallets and contracts work on it and tokens can be bridged between the chains. A BEP-20 token is still a different asset on a different chain from its ERC-20 counterpart.

ERC-721 is Ethereum’s standard for non-fungible tokens (NFTs), where each token has a unique ID and is not interchangeable with others. ERC-1155 lets a single contract manage both fungible and non-fungible tokens. ERC-20 is the fungible case only: one unit of a given token is identical to any other unit.

What ERC-20 tokens are used for

ERC-20 tokens show up wherever an interchangeable digital unit is useful:

  • Stablecoins: dollar-referenced tokens such as USDC, issued by Circle, along with USDT and DAI.
  • Governance tokens: tokens like MKR that give holders voting rights over a protocol’s parameters.
  • Tokenized assets: on-chain representations of financial assets, commodities or real estate, where the token stands for a claim recorded off-chain.
  • In-app and in-game currencies: units of value used inside a specific application.
  • Speculative and community tokens: meme tokens such as SHIB, whose value rests on market demand rather than a claim on an underlying asset.

What the standard does not guarantee

ERC-20 compliance is a statement about interface, not about quality, value or safety. A token can be fully compliant and still:

  • Have no backing, no use case and no liquid market.
  • Include extra functions beyond the standard, such as letting the issuer mint new supply, freeze addresses or pause transfers. Some major stablecoin contracts include freeze and blacklist capabilities.
  • Be a copy using a well-known name and symbol to mislead buyers.

The standard also has a known usability flaw. A plain transfer to a contract that was not built to handle tokens will succeed, but the tokens may be stuck there permanently. Later proposals tried to address this, but ERC-20 itself does not prevent it.

Before buying or accepting a token, check its contract address against the issuer’s published address, the extra functions the contract contains and who controls them. The ERC-20 label only tells you the token will work with Ethereum wallets and applications.

About this page

Written by Crypto Desk

The Crypto Desk covers crypto exchanges, coins, market data pages and crypto guides.

Published
Last updated

Spotted an error? Tell the editors. This page is general information, not financial advice.