Lab: free tools · size first · stock scanner · crypto scanner · journal

General

ERC-20 Token Standard

ERC-20 is the Ethereum token standard defining a common interface for fungible tokens, where every unit is identical and interchangeable. It specifies six mandatory functions (transfer, approve, allowance, balanceOf, totalSupply, transferFrom) that every compliant token contract must implement, enabling wallets, exchanges, and DeFi protocols to interact with any ERC-20 token using a single standard interface.

ERC-20 is the standard interface for fungible tokens on Ethereum and EVM chains. It defines basic functions like transfer, balanceOf and approve, which is why wallets and exchanges can support new tokens without custom code. The approve function is also a common risk: unlimited approvals to a contract that later gets exploited can let an attacker drain those tokens. Reviewing and revoking old approvals is basic hygiene.

What the standard defines

ERC-20 was proposed in November 2015 by Fabian Vogelsteller and Vitalik Buterin, and its status is Final. The core functions are totalSupply, balanceOf, transfer, transferFrom, approve and allowance, along with Transfer and Approval events that wallets and block explorers watch. Name, symbol and decimals are optional extras. Decimals only change how a balance is displayed: with 8 decimals, a raw balance of 100000000 shows as 1 token.

How approve and transferFrom work together

A contract can't simply take tokens out of your wallet. First you call approve to let a spender, say a DEX router, move up to a set amount. The router then calls transferFrom when you trade. The allowance stays in place until it's used up or you change it, even years later. The standard itself warns about an attack when changing an existing allowance, and suggests wallets set it to zero before setting a new amount. Uniswap's Permit2 lets one signature cover approvals for several tokens. That saves transactions, and it means a signature request deserves the same care as an approval.

Tokens that bend the rules

Not every token behaves the way a protocol expects. Circle can freeze USDC held at a given address, and Tether can freeze USDT. Rebasing tokens such as stETH change balances on their own, and some protocols have miscalculated interest or collateral because of it. Before depositing a token into a DeFi protocol, check that the protocol actually supports how that particular token behaves.