Module 2: Wallets, Custody, and Security

Token Approvals, the Permissions You Forget About

Chapter 8 of 14 · about 6 minutes

8.1 Why two transactions?

When Mint swapped USDC for ETH on a decentralised exchange for the first time, the wallet asked for two confirmations instead of one. The first was labelled "Approve USDC." The second was the actual swap.

"Why do I need to approve anything?" Mint asked. "I'm the one making the swap."

"Because tokens don't move themselves," said Hash. "Before a smart contract can take your USDC and give you ETH, you have to give it permission to move your USDC. That permission is called an approval. And here's the part most people don't know: it often stays active long after the swap is done."

8.2 How approvals work

Recall from Module 1, Chapter 5 that most tokens on Ethereum follow the ERC-20 standard. A token is a smart contract that keeps a ledger of balances. The standard includes a function called approve, which records that a particular address, called the spender, is allowed to move up to a certain amount of your tokens.

Think of it like giving a trusted shop permission to charge your card. You set up the permission once, and then the shop can take payments without asking you each time. That's convenient. But if the shop is dishonest, or gets hacked, it can charge you without asking too.

Here's the flow of Mint's swap:

  1. Approve: Mint allows the DEX's smart contract to spend Mint's USDC.
  2. Swap: The DEX contract takes the USDC from Mint's wallet, using that permission, and sends ETH back.

The approval doesn't move any tokens by itself. It just grants the right to move them.

Chapter 8 · How token approvals work

Transaction one is an approval on the token contract, which does not move tokens but sets an allowance for the spender. Transaction two is the swap, where the DEX contract pulls the approved tokens. With an unlimited approval, a large allowance remains after the swap and can be used later.

Using a token on a DEX takes two steps: first you approve the contract to spend an amount, then it pulls the tokens during the swap. An unlimited approval leaves the door open long after the trade, which is why careless approvals get drained.

8.3 Exact versus unlimited

When approving, many applications request an unlimited approval by default, permission to move any amount of that token, forever. The reason is convenience: next time you swap, you won't need to approve again, saving time and gas.

The alternative is an exact approval, permission for only the amount you're about to use.

Exact approvalUnlimited approval
What it allowsOnly the amount you specifyAny amount of that token, now and in future
Future transactionsNeed a new approval each timeNo new approval needed
Gas cost over timeHigher, an extra transaction each timeLower
If the spender is later hacked or maliciousExposure limited to the remaining approved amountAll of that token in your wallet is at risk

Most wallets let you edit the approval amount in the pop-up before confirming. Look for an option like "edit," "custom spending cap," or similar.

8.4 A worked example

Mint swapped 100 USDC on a DEX three months ago, granting an unlimited approval. Since then, Mint received a salary payment and now holds 5,000 USDC in the same wallet.

Then the news breaks: the DEX contract Mint approved has a newly discovered vulnerability, and attackers are using existing approvals to drain users' tokens.

ScenarioMint's approvalUSDC at risk
AUnlimitedAll 5,000 USDC
BExact, 100 USDC, fully used in the swap0 USDC
CUnlimited, but revoked after the swap0 USDC

Mint didn't do anything wrong today. The risk was created three months ago, by a permission Mint had forgotten about.

"So approvals are like doors I left unlocked," said Mint.

"Doors you left unlocked in houses you've forgotten you own," said Hash.

8.5 Where approvals come from

Approvals don't only come from swaps. You may have granted them when you deposited into a lending protocol, staked tokens, listed NFTs on a marketplace, bridged tokens, used a trading bot, or signed a permit signature, as Mint did in Chapter 7.

Some applications also use a shared approval system, where you approve one contract once, and individual applications then request time-limited permissions through signatures. This can reduce long-term exposure when used well, but it means some of your permissions are granted through signatures rather than transactions. Read them just as carefully.

NFTs have their own version. Set approval for all gives a contract permission to move every NFT you own in a collection. Marketplaces need this to sell your NFTs, but a malicious "approval for all" can empty your whole collection.

8.6 Checking and revoking approvals

The good news is that approvals are public on the blockchain, so you can see every one you've granted and cancel any of them. Cancelling is called revoking.

Many block explorers include a token approval checker. Independent approval-checking tools also exist, and some wallets show approvals directly. You enter your address, and the tool lists every active approval: the token, the spender, and the amount.

Revoking is itself a transaction, setting the approval amount to zero, so it costs a small amount of gas.

Here's a sensible routine:

  1. Check your approvals every month or two, and after using any new application.
  2. Revoke anything you no longer use.
  3. Revoke anything with an unknown spender immediately.
  4. Revoke immediately if you hear that a protocol you've used has been hacked.
  5. Remember that approvals are per network. Check each network you use.

Node was concerned. "Isn't using a website to check approvals risky in itself?"

"Good instinct," said Hash. "Checking is safe, because you're only reading public data. But only connect your wallet and sign revoke transactions on tools you've verified, from bookmarked links. Scammers have created fake revoke sites too."

8.7 When to use unlimited approvals

Unlimited approvals aren't always wrong. For a well-established protocol you use frequently, with a wallet that doesn't hold much else, the convenience may be worth it. The important thing is to choose deliberately, rather than accepting the default every time.

SituationReasonable choice
A new or unfamiliar applicationExact approval, or use a burner wallet
A well-established protocol you use dailyUnlimited may be acceptable, with periodic review
Your vault wallet with long-term savingsAvoid approvals entirely where possible
Anything asking for approval of a token unrelated to what you're doingReject

8.8 Try it yourself

Open a token approval checker for an address you've used, starting with your testnet wallet from Chapter 5. List every approval: token, spender, and amount. Identify which are unlimited. Then revoke one of them on the testnet and confirm on a block explorer that the approval is now zero.

If you have a mainnet wallet you've used with applications, check it too. Most people are surprised by how many approvals they find.

Key takeaways from this chapter

  1. An approval gives a smart contract permission to move your tokens. It doesn't move tokens by itself.
  2. Approvals often remain active indefinitely after the transaction that needed them.
  3. Unlimited approvals are convenient but put every unit of that token at risk if the spender is hacked or malicious.
  4. Exact approvals limit exposure to the amount you intend to use.
  5. Approvals come from swaps, lending, staking, marketplaces, bridges, and permit signatures. NFTs have "set approval for all."
  6. Approvals are public. Check them regularly and revoke those you don't need, network by network.
  7. Use only verified tools to revoke, and choose unlimited approvals deliberately, not by default.