Nothing left your wallet. You gave permission instead.
An approval is not a transfer. It is a number stored against your address that lets another address move your tokens later, without asking again. This file covers where that number lives, how it can be written without a transaction from you, and how to read it back without connecting a wallet.
Under the ERC-20 standard a holder grants a contract an allowance. The contract may then move up to that amount at any time. Most interfaces default the amount to the maximum, because it saves gas on repeat use.
The approval transaction is small and looks harmless. nothing moves — which is exactly why it gets signed without reading.
Approve is not a transfer
One call writes a number against your address. A second call reads it. Nothing is deducted when the first one is signed.
EIP-20 defines three functions and one mapping. That is the entire mechanism: no timers, no notifications, and no expiry unless a particular token adds one. The spender gains the option to move funds later, within the limit, without asking again.
Revoking is the same operation with the limit set to zero. ERC-721 marketplaces apply a comparable pattern at collection level, which is a far larger grant than the interface usually makes obvious.
The transaction that creates an allowance costs gas and emits an event. The allowance itself costs nothing to hold and does not expire. A grant made in 2021 is still executable in 2026 if the token contract is still live.
The visible outcome of an approval is no visible outcome. Every instinct about noticing something wrong is useless at the moment it happens.
How the drain actually runs
Four stages, joined in one direction. Only the last one is visible from a balance.
You connect to something that looks normal
An airdrop page, a migration portal, a partner site. The wallet prompt is real; the site is not.
You approve a permission you do not read
Nothing leaves the wallet. The page looks like it worked, and you close the tab.
Nothing happens for a while
Days or months pass while the allowance sits dormant, attached to your address.
The allowance is exercised
Tokens move in one transaction. No chargeback, no reversal, nobody to call. The only defence was step two.
The allowance is one number
In EIP-20 the permission is a single unsigned integer, keyed by owner and spender. Every approval you have ever signed is one of these integers.
The interface declares a nested mapping. approve writes one slot. transferFrom reads the slot, moves the tokens, then decrements it. allowance reads the same slot and changes nothing. There is no separate permission object, no list of granted scopes, and no record of what the spender intends to do.
The value is denominated in the token's smallest unit, so the number in the prompt is not the number of tokens. With six decimals, one thousand tokens is stored as 1000000000. With eighteen, the same quantity is a nineteen-digit integer. A prompt that shows “unlimited” is showing you a raw integer the interface chose not to render.
Some widely used token contracts, including the original Tether implementation, revert when a non-zero allowance is replaced by another non-zero value. A wallet that wants to change an amount must first set it to zero. That constraint is one reason interfaces default to the maximum: one approval, never edited again.
// one slot per (owner, spender) pair mapping(address => mapping( address => uint256)) _allowances;
approve(address spender, uint256 amount) → writes the slot transferFrom(address from, address to, uint256 amount) → reads, moves, decrements allowance(address owner, address spender) → view, returns uint256
115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457,584,007,913,129,639,935 2^256 - 1 · 78 decimal digits
No token supply comes close to that number, and comparing it to a balance is meaningless, so interfaces substitute the word “unlimited”. The substitution is accurate in one direction only: the allowance does not run out, but it is still a finite integer sitting in storage.
The most widely used reference implementation does not decrement it. Its allowance check subtracts only when the allowance is not equal to type(uint256).max. An unlimited approval therefore stays at the maximum after every transfer — which is precisely what makes it unlimited, and what makes it permanent until someone writes zero.
Permit: an approval that never hits the chain
EIP-2612 moves the grant into a signature. You never send a transaction; the spender does.
permit takes the same three fields — owner, spender, value — plus a deadline and a signature split into v, r and s. The token contract hashes an EIP-712 typed structure, recovers the signer, checks the nonce and the deadline, then writes the same allowance slot that approve would have written.
EIP-712 exists so the bytes you sign are structured rather than opaque. The domain separator binds the signature to one contract on one chain, so a permit signed for one token cannot be replayed against another, and the per-owner nonce stops the same signature being used twice.
The consequence is accounting, not safety. Your transaction history contains no approval, because you never sent one. The spender's history contains the permit call. An audit that reads only your outgoing transactions will miss it.
| Question | approve | permit | setApprovalForAll |
|---|---|---|---|
| What is granted | One allowance, up to a uint256, for one token contract. | The same allowance, for one token contract. | One boolean: every token in an entire NFT collection, including future mints. |
| Visible on chain | Immediately, as a transaction from you. | Only when the spender submits it, as a transaction from them. | Immediately, as a transaction from you. |
| Who pays gas | You. | The spender. Your signature costs nothing. | You. |
| How to revoke | approve(spender, 0) — one transaction. |
approve(spender, 0), or a fresh permit with value 0. |
setApprovalForAll(operator, false). |
| Main risk | The amount is forgotten and stays executable. | Nothing in your history reminds you it exists. | One signature covers a whole collection. |
How to audit approvals without connecting a wallet
Allowances are public state. Reading them takes an address and a block explorer — no signature, no connection, no gas.
The explorer's read-contract tab sends eth_call: the node executes allowance(owner, spender) against the latest block and returns the result without mining anything. The function selector is 0xdd62ed3e, followed by the two addresses padded to 32 bytes each. The call cannot change state, which is why it needs no key.
The second route is the event log. Every write to that slot emits Approval(owner, spender, value), indexed on owner and spender. Filtering the log by your address returns the full history: which contract was approved, for how much, in which block, and whether it was ever set back to zero.
to 0x4f8b…c02 (token) data 0xdd62ed3e allowance( owner, spender) arg 0000…a1c4 owner arg 0000…9c2b spender ← raw uint256 115792089237316195423570985 008687907853269984665640564 039457584007913129639935
Revocation is approve(spender, 0). The transaction emits Approval with value zero, which is the only durable receipt that the slot is clear — a wallet interface that stops listing a permission is not evidence that the permission is gone. On an NFT collection the equivalent call is setApprovalForAll(operator, false).
It shows what is granted, not why. It cannot tell you whether a spender is honest, what a contract will do with the allowance, or whether a token implements the standard correctly. It answers one question precisely: which addresses may move how much of this token from yours.
What an approval prompt is telling you
Three fields decide the damage. They are on screen, in this order.
The address that receives the right to move your tokens. On a legitimate site it is a contract; on a hostile one it is the attacker's contract wearing a familiar name.
Why it mattersThe token name is familiar. The spender address is the only field that identifies who can act.The raw integer written to the slot, in the token's smallest unit. 2^256-1 is displayed as “unlimited” by nearly every interface.
Why it mattersIt sets the ceiling on everything that can be taken, in one transaction or in twenty.The contract whose slot is being written. An approval applies to one token contract, not to the wallet as a whole.
Why it mattersThe same spender can hold allowances on several tokens. Revoking one does not clear the others.Spender, amount, token. If any of the three is unfamiliar, stop before signing, not after.
The subscription nobody cancelled
A holder approved an unlimited allowance while testing a new tool in 2021. The tool worked, the tab was closed, and nothing appeared in the transaction history afterwards. Two years later the entire balance of that token left the wallet in a single transaction, signed by a contract the holder had never heard of.
There was no malware and no compromised key. The contract simply used a permission that had been sitting open, exactly as designed. Revoking takes one transaction and a small fee; the drain takes none of your attention until it happens.
The pattern repeats across tokens and chains: approve once, forget, get drained when the balance finally becomes worth the gas.
Four assumptions about approvals
“I have a zero balance, so I am not exposed.”
RealityThe permission persists. It activates the moment funds arrive.
“Revoking is free and instant.”
RealityIt is an on-chain transaction with a fee. It can be batched, not skipped.
“A hardware wallet blocks approvals.”
RealityIt displays them clearly and signs them if you confirm. It does not judge intent.
“NFT approvals only cover one item.”
RealityMarketplace approvals often cover an entire collection — a far larger grant than it appears.
Self-custody checklist
Twelve items, in the order they usually fail. The counter is not a score.
Questions on the record
Read allowance(owner, spender) from a block explorer, or scan Approval events for your address. Check the spender, not only the token name.
Yes — a small network fee per revocation, because it is an on-chain transaction. Batching, or waiting for quieter periods, reduces the cost. A permit-based grant can also be cleared by a fresh signature with value zero, but someone still has to submit it.
The approve/allowance pattern is most visible on EVM chains. Other ecosystems implement permissions differently, but the principle of a standing grant that survives the session is common.
setApprovalForAll grants control of every token in one collection, present and future. Treat a collection-wide approval as a much larger grant than a single-item approval, because it is.
Ten terms this case relies on
- Allowance
- The uint256 a token contract stores for each (owner, spender) pair. It is the maximum the spender may move, in raw units.
- Spender
- The address named in an approval. Usually a contract, and usually one you never inspect.
- transferFrom
- The ERC-20 function a spender calls to move tokens. It reads the allowance, moves the balance and decrements the slot.
- approve
- The ERC-20 function that writes the allowance. Called with zero, it revokes.
- Permit
- EIP-2612's signature-based approval. The spender submits the signature and pays the gas, so the grant never appears as your transaction.
- EIP-712
- The typed-data signing format. A domain separator binds each signature to one contract and one chain, and a nonce prevents reuse.
- setApprovalForAll
- The ERC-721 call that grants operator rights over an entire collection with one boolean, including tokens minted later.
- Max uint
- 2^256 - 1, the largest uint256. Rendered as “unlimited” by most interfaces, and not decremented by reference implementations.
- Revoke
- Writing zero to an allowance: approve(spender, 0), or setApprovalForAll(operator, false) for a collection.
- Event log
- The append-only record each contract write leaves behind. ERC-20 approvals emit Approval(owner, spender, value).
The grant is the risk, not the transaction.
An approval is a small, cheap, permanent instruction. It moves nothing, which is why it is easy to sign and easy to forget. The defence is not vigilance at the moment of the drain — by then the permission is years old. It is reading three fields before signing, and reading the allowance back afterwards, which costs nothing and needs no wallet at all.