Skip to content

What is ERC-20? Tokens and approvals

ERC-20 is the standard that makes fungible tokens behave the same way everywhere. It defines balances, transfers and approvals, so any wallet can use a token.

evmquery team6 min readEthereum, explained, part 4 of 13

What is ERC-20?

ERC-20 defines the functions every fungible token contract must offer, so wallets and apps handle any such token the same way. “Fungible” means one unit is as good as another, like dollars. Stablecoins such as StablecoinA stablecoin is a token designed to hold a steady value, usually one US dollar.See it in the glossaryRead the explainer follow it.

It is one of the application-level standards described in the EIP vs ERC guide. A collectible, where each item is unique, uses a different standard (see ERC-721 vs ERC-1155).

The standard is small on purpose. It does not say what the token is for, who can create it or what it costs. It fixes only how you ask a contract about balances and how tokens move. That is enough for a wallet to support a token it has never seen.

How ERC-20 tokens work

An ERC-20 token is a table inside a Smart contractA smart contract is a program stored at an address on the blockchain that anyone can call and that runs exactly as written.See it in the glossaryRead the explainer, with an AddressAn address is the public identifier of a wallet or contract on Ethereum, a long string starting with 0x.See it in the glossary on one side and a number on the other. Your WalletA wallet is the app or device that holds your keys and lets you sign transactions and view your assets.See it in the glossary holds your keys, and the contract holds your balance.

A table inside a token contract with names next to balances: Alice 1,200.00, Bob 35.50 and Corner Shop 8,764.50. A note says balanceOf reads one row and totalSupply adds up all rows. Example numbers.
The token is the ledger. Sending tokens means the contract edits two rows.

The standard requires six functions: totalSupply, balanceOf, transfer, approve, allowance and transferFrom. It also requires two events, Transfer and Approval.

When you send tokens, you call transfer. The contract checks that your row has enough, lowers it and raises the recipient’s row. It also records a Transfer event so explorers and apps can follow along.

balanceOf(address) returns one row of the ledger, and totalSupply() returns all rows added up. The standard leaves some things open, such as who can create new tokens, and the contract’s author decides them. Look at a token before you trust it.

Approve and transferFrom

approve lets another address spend tokens from your balance, and transferFrom is how it does so. The standard calls the amount an AllowanceAn allowance is the amount of your tokens that an app is permitted to move on your behalf.See it in the glossaryRead the explainer. An approval works like a permission slip: you sign that a specific app may take up to a set amount from you.

You, the owner, give a permission slip to a shop app, the spender, for up to 100 USDC, the allowance. A caution box warns that an unlimited approval has no cap and stays until you cancel it.
An approval names who may spend and how much. Unlimited approvals remove the cap.

On a swap site, you first call approve on the token, naming the site’s contract as spender and an amount. That costs a small fee and moves no tokens. Then you call the swap, and the site’s contract calls transferFrom to pull what the trade needs. A contract cannot reach into your wallet to take payment, so the permission has to live in the token contract.

Many apps ask for an unlimited approval so you approve only once. That is the largest number the token can store, written 2^256 - 1. The spender can then pull any amount, at any time, until you set the allowance back to zero. If the app is later exploited, the approval is still there.

  • Approve the amount you need when the app lets you choose.
  • Treat “unlimited” as a trust decision about the app.
  • Review your approvals now and then, and revoke the ones you no longer use. Revoking is an approve call that sets the amount to zero.

Some newer apps add a second layer: you approve one shared contract, and it hands out time-limited permissions to apps. Permit2 works this way, so an approval check has two places to look.

Decimals: why 5,000 can look like 5000000000

Tokens store whole numbers only, and DecimalsDecimals tell you how many digits of a token amount sit after the decimal point, because contracts store whole numbers only.See it in the glossaryRead the explainer tells you how many of the rightmost digits are the fractional part. A token with 6 decimals stores one unit as 1,000,000. Without adjusting, that raw number looks a million times too large.

USDC stores its total supply as the whole number 45611535323608550. Divide by 10 to the power 6, since USDC has 6 decimals, to get 45,611,535,323.61 USDC. Saved snapshot from 2026-11-11 at block 26,391,458.
The contract stores the integer. The decimals value tells apps where to put the point.

Contracts do not do fractions, so every amount is a whole number of the smallest unit. A price stored in cents and shown in dollars works the same way.

Decimals differ per token. USDC and USDT use 6, and many other tokens use 18, which matches ETH. Read decimals() from the token instead of assuming the shift, because most display bugs in dashboards and spreadsheets come from skipping that step.

The figure is a saved snapshot from 2026-11-11 at block 26,391,458, so it does not update. The live card below shows the current supply.

What ERC-20 does not give you

The standard is a minimum, so a few things are left to each token. Names, symbols and decimals are optional parts of it, though nearly every token includes them. It does not guarantee that a token is safe, backed or honest.

A fake token can copy a real token’s name and symbol, so the contract address identifies a token, not the label. Some tokens add rules of their own, such as the ability to freeze an address. Many popular tokens are upgradeable proxies, so the logic behind the address can change. Neither is a flaw in ERC-20: a standard fixes the interface, not the behaviour behind it.

See it on a real contract

The card below reads the USDC total supply live, already divided by its decimals.

USDC in circulation on Ethereum

Reading live from Ethereum

Inspect USDC in the ERC-20 Inspector

Show the queryformatUnits(usdc.totalSupply(), usdc.decimals())

Paste 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 into the ERC-20 Inspector on Ethereum to see the name, symbol, decimals and raw supply. To check your own exposure, the Token Allowance Checker shows how much a spender may still take and flags unlimited approvals. A result of zero means the spender has no permission.

Common mix-ups

  • “My tokens live in my wallet.” The ledger lives in the token’s contract, and your wallet shows the row for your address.
  • “Approving a swap sends my tokens.” An approval moves nothing. It sets how much a spender may take later.
  • “A balance of 5000000000 means I am rich.” The contract stores whole numbers. Divide by 10 to the power of the token’s decimals before you read it.
  • “Two tokens with the same name are the same token.” The contract address identifies a token. Fakes copy the name and symbol.

Summary

  • ERC-20 is the standard that lets wallets and apps handle any fungible token the same way.
  • A token is a ledger inside its contract, and your wallet only shows your row.
  • An approval lets an app spend up to a set amount from your balance until you revoke it, so review unlimited ones.

For developers

One expression can read a holder’s balance, an allowance and the supply in a single request, scaling each by the token’s own decimals(). See the ERC-20, ERC-721 and ERC-1155 ABI JSON reference for the full function lists.

Share

Read any token's balances and approvals

Create a free API key and read supply, balances and allowances from any ERC-20 with one request.