Deciphr Academy
Track 3 · Module 12 · Lesson 2 of 7 · 8 min read

What is an ERC-20 token?

Short answer

ERC-20 is the standard for fungible tokens, where every unit is the same as every other.1 It sets out how to send tokens, check balances, and let someone else spend your tokens up to a limit.2

Mayaholds 2,000 BRDLPayroll contractthe spender1. approve 1,000 BRDL2. transferFrom takes 400 BRDLAllowance left: 1,000 - 400 = 600 BRDLCalling approve again replaces the limit
Fig. 2. Maya approves a spender for 1,000 BRDL. The spender pulls 400 with transferFrom, so 600 is left in the allowance.

Fungible means interchangeable

Fungible means each unit is exactly the same, in type and value, as every other unit.1 An ERC-20 token works like ETH in this way: one token is always equal to any other.1

ERC-20 was created in November 2015 by Fabian Vogelsteller and Vitalik Buterin.2 Its official page shows the status Final.2 ethereum.org's examples of ERC-20 tokens include voting tokens, staking tokens and virtual currencies.3

The functions

An ERC-20 contract has these functions.2,1

Function What it does
name, symbol The token's name, such as "MyToken", and its short symbol. Optional.2
decimals How many decimal places the token uses. Optional.2
totalSupply The total number of tokens.2
balanceOf How many tokens an address holds.2
transfer Sends your tokens to another address.2
approve Lets another address spend your tokens, up to a limit.2
allowance How much that address may still spend.2
transferFrom Moves tokens out of an account, on behalf of its owner.2

It also has two events. Transfer must fire whenever tokens move, even zero tokens. Approval must fire whenever approve succeeds.2

Creating new tokens is called minting.4 ERC-20 says a contract SHOULD show newly created tokens as a Transfer from the address 0x0.2

Decimals: whole numbers in disguise

Solidity and the EVM only work with whole numbers. You cannot send 1.5 of anything.5 So a token stores larger whole numbers, and decimals says where the decimal point goes.5,2

To get the amount people see, divide the stored number by 10 to the power of decimals.5 ERC-20's own example: with 8 decimals, divide by 100,000,000.2 Decimals only changes how amounts are shown. The contract still does all its maths in whole numbers.5

OpenZeppelin's contract library uses 18 decimals by default. It says this matches Ether and most ERC-20 tokens.5 So sending 5 tokens with 18 decimals really means sending 5 × 10^18.5

Converting by hand
  • Stored number ÷ 10^decimals = tokens people see.
  • Tokens × 10^decimals = stored number.
  • Example: a stored balance of 2,500,000 with 6 decimals is 2.5 tokens.

Approve and allowance

An allowance is permission for someone else to spend your tokens, up to a limit. You set it with approve.2 The spender can then take tokens from your account several times, until the limit is used up.2 Calling approve again does not add to the old limit. It replaces it.2

The spender moves tokens with transferFrom. It lets a contract move tokens on your behalf, for example to charge fees.2 ethereum.org says approve followed by transferFrom is the pattern used to deposit tokens into a contract.1

Two known risks

Unlimited approvals. Some apps ask to spend an unlimited amount of your tokens.6 A harmful app can then take all of them, with no way to get them back.6 Permissions do not expire, and disconnecting your wallet does not cancel them.6 ethereum.org advises approving only what you need and revoking old permissions.6

Tokens sent to the wrong contract. ERC-20 has no way to tell a receiving contract that tokens arrived.1 Tokens sent to a contract not built to handle them can be lost for good.1 ethereum.org says at least $83,656,418 of ERC-20 tokens had been lost this way by 20 June 2024.1

Our viewAn unlimited approval trades safety for a little convenience. For a company treasury, approving exact amounts and checking old permissions each month is cheap insurance.
Sources
  1. ERC-20 Token Standard. ethereum.org developer docs, page updated 9 July 2026.
  2. ERC-20: Token Standard. Ethereum Improvement Proposals (Fabian Vogelsteller, Vitalik Buterin), created 19 November 2015, status Final.
  3. Ethereum development standards. ethereum.org developer docs, page updated 26 September 2025.
  4. Token Program. Solana Program Library documentation (spl.solana.com/token now redirects here).
  5. ERC-20 (A Note on decimals). OpenZeppelin Contracts 5.x documentation.
  6. How to revoke smart contract access to your crypto funds. ethereum.org guides, page updated 6 June 2026.

General education built from the publicly available sources listed above. Not financial, legal, tax or investment advice. Naming a company, project or regulator is not an endorsement either way. Last checked 2026-10-22. Terms and disclaimer.