ERC-20 Best Practices: Ship Tokens That Hold Up
ERC-20 best practices cover tested templates, tight approvals, capped minting and an audit before launch. They separate tokens that hold up from ones that break.
On this page
Short answer
ERC-20 best practices are the rules that keep a token contract safe after launch: start from a tested template, keep approvals exact, cap minting under more than one key, plan for upgrades and emergencies, and audit before deploying. They matter because a deployed contract is hard to change, so a mistake in the code can become a permanent loss.
What are ERC-20 best practices?
ERC-20 best practices are the working rules for building and running a token on the ERC-20 standard without losing funds to a bug, a bad approval or a single lost key. They cover the contract code, the controls around minting and upgrades, and what the team does after launch. A token that follows them is not guaranteed safe, but it avoids the failures that sink most new tokens.
The standard itself only defines how a token moves: transfer, approve, transferFrom, balanceOf and allowance, plus name, symbol, decimals and totalSupply. Everything else — who can mint, whether transfers can pause, whether the contract can change — is a choice the team makes, and each choice is a place where a mistake can cost holders real money. The table below lists the five areas where those choices matter most.
| Area | Practice that matters most |
|---|---|
| Starting point | Use a tested template, never hand-written code |
| Approvals | Approve exact amounts, revoke old ones |
| Minting | Cap supply, put minting behind more than one key |
| Upgrades | Decide immutable or proxy before launch |
| Launch | Test on a testnet, then audit, then monitor |
The rest of this article works through each area in turn, with the checks a team should run before the token goes live. The ERC-20 explainer covers how the standard itself works, if that part is new to you.
How do you start from a safe template?
Start from a tested implementation of the standard, such as the OpenZeppelin contracts library, instead of writing the token functions by hand. Hand-written token code is where most bugs live, and the standard functions look simple enough to copy — which is exactly why teams get them wrong. A tested template has been reviewed by many eyes and used by many tokens, so its edge cases are already known.
Pin the exact version of the template you use and record it, so the deployed contract matches the code you tested. If the library releases a fix after you deploy, you cannot quietly swap it in — which is why the version record matters for the audit and for anyone reading the contract later.
Verify the deployed source on a block explorer so holders can check what the contract actually does. The token creation guide walks through the build steps this template choice sits inside.
Keep custom code small. Every extra function you add — a fee, a reflection, a special transfer rule — is new code that needs its own tests. If the token needs a feature the template does not offer, add it as one small, named change and test that change on its own before it joins the rest.
How do you keep token approvals safe?
Keep approvals exact. The approve function lets another contract spend tokens on a holder's behalf, and many apps ask for unlimited approval so the holder never has to approve again. An unlimited approval is a standing permission: if the app's contract is later exploited, the attacker's limit is the holder's whole balance. Approve only the amount the transaction needs, and no more.
Revoke approvals you no longer use. A holder who approved an app once and never returned still has that permission open, and old approvals are a common way funds move without warning. Check approvals on a block explorer from time to time and revoke the ones for apps you stopped using. Teams should say this plainly in their docs, because most holders never think to check.
Warn holders before they approve. The interface that asks for approval should show the exact amount and the contract it goes to, in plain words, not just a hex address. A holder who cannot tell what they are approving will approve anything — and that is how lookalike contracts drain wallets. The ERC-20 and ERC-721 comparison explains how approvals differ between token types.
How do you control minting and supply?
Fix the supply or cap it. A contract that lets the owner mint unlimited tokens lets one compromised key dilute every holder to nothing, and holders know it. Set a fixed total supply, or a hard cap that minting can never pass, and write that cap into the contract where anyone can read it. If the token needs new supply later, the cap should still bound how much and how fast.
Put minting behind more than one key. A single address that controls minting is a single point of failure: one lost key locks the function forever, one stolen key mints without limit. Use a multi-signature wallet so that minting needs two or three separate approvals, and keep those keys in different places. Add a time delay between the decision to mint and the mint itself, so a bad mint can be spotted and stopped.
Say who can mint, and how much, in public. Holders should be able to read the contract and answer two questions: who holds the minting keys, and what is the most that can ever be minted. If the answer is unclear, holders will assume the worst — and they are right to. A clear cap and a named set of key holders are worth more than a promise in a white paper.
How do you plan upgrades and emergency stops?
Decide before launch whether the contract can change. An immutable contract cannot be fixed after deployment, which is safe in one way and risky in another: a bug stays a bug forever.
An upgradeable contract, usually built with a proxy, can be fixed — but the upgrade key is then the most powerful key in the system, and whoever holds it can change the rules. There is no right answer, only a choice the team must make on purpose and explain.
If the contract can be upgraded, guard the upgrade key the way you guard minting: more than one signature, a time delay, and a public record of who holds the keys.
Test the upgrade path on a test network before launch, because an upgrade that fails mid-way can freeze the token. Never leave the upgrade key in a single developer's wallet.
Add a pause for emergencies, and say who can pull it. A pause function lets the team stop transfers while a bug is fixed, which limits the damage from an exploit. But a pause is also a power: it must need more than one signature, and the team must say in advance when it will be used.
A pause that one person can trigger at will is a different kind of risk. The ERC-721 best practices cover the same upgrade and pause choices for NFTs.
How do you test and audit before launch?
Test on a test network first, with a fixed set of checks. Deploy the contract, then run every function — transfer, approve, transferFrom, mint, burn and pause — including the cases that should fail. A transfer above the balance must fail, an approval for zero must work, and a mint past the cap must fail. Run the same set after every change, so a fix in one place cannot quietly break another.
Get an audit before deployment, not after a problem appears. An audit is a review by people who did not write the contract, and it finds the bugs the team is blind to — especially in minting, approval and upgrade logic.
Give the auditors the exact code that will deploy, with the version pinned, and fix what they find. An audit finds some bugs, not all, and says nothing about the token's economics — treat it as one check, not a guarantee.
- Deploy to a test network. run the full check set.
- Fix what fails. then re-run the checks.
- Freeze the code. record the exact version that will go live.
- Send that code for audit. fix the findings before launch.
- Move the keys. put minting and upgrade control in a multi-signature wallet.
- Deploy and verify. publish the source, then announce the contract address.
Only when all six steps are done should real value move through the token. That sequence costs time, but it costs far less than fixing a live contract.
How do you run the token after launch?
Watch the token after launch. Monitoring is not optional: someone should check transfers, holder counts and the minting keys every week, and know what normal looks like so abnormal stands out. A sudden large mint, a new holder with a large share, or a transfer pattern that does not match the product are all worth a look the same day.
Have an incident plan written down before you need it. The plan should name who can pause the contract, who talks to holders, and what happens to trading while the problem is fixed. A team that writes this plan during an incident will be slow and will say the wrong thing; a team that wrote it in advance can act in minutes.
Review approvals and keys on a schedule. Old approvals, unused admin keys and stale multi-signature members pile up quietly, and each one is a door that no longer needs to be open. A monthly review — revoke what is unused, replace keys that changed hands, confirm the cap is still in the contract — keeps the token's controls as tight as they were on launch day.
Example (hypothetical): a coffee chain launches a loyalty token
Example (hypothetical): a coffee chain with 5,000 loyalty members launches an ERC-20 token. Members earn 1 token for every $10 spent, and the average member spends $40 a month, so each member earns 4 tokens a month. Across 5,000 members that is 20,000 tokens minted each month, and the contract caps total supply at 1,000,000 tokens.
After 12 months the chain has minted 240,000 tokens, which is 24 in 100 of the cap. Members redeem 100 tokens for a free coffee, and in month 12, 500 members redeem — that burns 50,000 tokens. The net supply after a year is 240,000 minus 50,000, which is 190,000 tokens, or 19 in 100 of the cap. The numbers add up, and the cap leaves room for years of growth.
The chain follows the practices in this article: the contract comes from a tested template, minting needs two signatures, the supply is capped in the contract, and the source is verified so members can check it. When a member asks what stops the chain minting extra tokens, the answer is the cap in the contract — not a promise.
What are the common mistakes?
The most common ERC-20 mistakes are writing the standard by hand, skipping the audit, and leaving minting in one person's hands.
- Writing the standard by hand. Use a tested implementation; hand-written token code is where most bugs live.
- Skipping the audit. Any token that will hold real value should be reviewed before deployment, not after a problem appears.
- One key controls minting. Use a fixed supply or a multi-signature wallet, so no single person can dilute holders.
- Unlimited approvals. Apps that ask for unlimited spending leave holders exposed; approve exact amounts and revoke old ones.
- No pause plan. A contract with no way to stop transfers cannot limit the damage from a bug.
- Promising returns. Saying a token will rise in value can turn it into a security and bring legal trouble.
Keep the code tested, the approvals exact, the minting capped and the keys shared. A token run that way will not be perfect, but it will avoid the failures that end most new tokens early.
Key takeaways
- Start from a tested template; never write the ERC-20 functions by hand
- Approve exact amounts and revoke approvals you no longer use
- Cap the supply and put minting behind more than one key
- Test on a test network, then audit the exact code that will deploy
- Monitor the token after launch and keep an incident plan ready
Frequently asked questions
Do I need an audit for a small ERC-20 token?
Yes, if the token will hold real value. An audit reviews the contract before deployment and finds bugs in minting, approval and upgrade logic that the team is blind to. It finds some bugs, not all, and says nothing about the token's economics — but it is still the cheapest check available.
What is the safest way to handle minting?
Set a fixed total supply or a hard cap in the contract, and put minting behind a multi-signature wallet so no single key can mint alone. Add a time delay between the decision to mint and the mint itself, so a bad mint can be spotted and stopped.
Should my ERC-20 contract be upgradeable?
It depends on the trade-off. An immutable contract cannot be fixed after deployment, so a bug stays forever. An upgradeable contract built with a proxy can be fixed, but the upgrade key can change the rules, so it needs more than one signature and a time delay.
How much should I approve when an app asks?
Approve only the amount the transaction needs, and no more. Many apps ask for unlimited approval so you never have to approve again, but that leaves your whole balance open if the app's contract is later exploited. Revoke approvals for apps you stopped using.
What does it mean to verify a contract?
It means publishing the contract source on a block explorer so anyone can read it and match it to the code that is actually deployed. Holders can then check the supply cap, the minting keys and the pause rules for themselves instead of trusting a promise.
Can an ERC-20 token be paused?
Only if the contract includes a pause function. A pause lets the team stop transfers while a bug is fixed, which limits the damage from an exploit. It should need more than one signature to trigger, and the team should say in advance when it will be used.