Approve vs Permit: Gas and the Risk You Take On
Bottom line: approve costs a storage write (~46k gas cold, ~29k warm) and leaks a standing allowance; permit (EIP-2612) costs one signature plus a combined call and leaves no allowance behind. Permit removes the approve-then-swap two-transaction pattern, at the cost of a signature that can be replayed if the nonce handling is sloppy.
The gas difference
| Path | Transactions | Gas | Allowance left |
|---|---|---|---|
| approve + transferFrom | 2 | 46k + 51k | yes, until reset |
| permit + transferFrom | 1 | 51k + ~2.5k sig check | no |
| approve(max) + transferFrom | 2 once | 46k then 51k each | infinite |
Infinite approval saves gas on later calls and is the reason most exploits drain unlimited balances.
Why infinite approve is risky
An allowance of 2^256-1 means any bug in the spender contract controls your whole balance of that token, forever, with no further signature. Malicious upgrades and compromised keys do not need you to click anything twice.
Permit mechanics
1 | permit(owner, spender, value, deadline, v, r, s); |
The signature covers chain id, verifying contract, nonce, deadline and value. A correct implementation consumes the nonce, so a replay reverts.
Where permit breaks
- Tokens without EIP-2612. Many older ERC-20s have no
permit. Fall back to approve; do not assume. - Nonce races. Two permits signed in parallel share a nonce; the second reverts.
- Front-run griefing. A third party can submit your signed permit with altered value if the contract allows partial consumption and your deadline is long. Keep deadlines under 20 minutes.
- Dead chain ids. A permit signed on a fork can be valid on both sides unless the domain separator includes the fork-specific chain id. Most do; verify.
Practical policy
| Use case | Choice |
|---|---|
| One-off DEX swap | permit, exact amount |
| Recurring allowance (router) | approve, capped, revoke when done |
| Token without 2612 | approve, exact amount |
| Contract-to-contract | permit if available, else approve + assert allowance |
Revoking
approve(spender, 0) costs ~29k gas warm. Build a revoke sweep into your habits after any session where you granted infinite. More than a handful of live infinite allowances to unaudited contracts is a standing liability.
Operating notes
Before choosing, check whether the spender contract is verified and how old it is. An unaudited contract created last week gets an exact-amount permit; a router with a year of history and an audit gets a capped approve. The mechanism matters less than the blast radius the spender can reach.
Measure the pair: approve on a warm slot is 29,000 gas, the same on a cold slot is 46,000. A permit signature plus transfer is roughly 54,000 gas total, so the saving over approve-then-transfer is about 20,000 to 40,000 — real, but not a reason to accept an unknown contract.
Deadline discipline
Twenty minutes is a reasonable default. A deadline that spans a chain halt or a fork window can be replayed on the fork. Re-sign rather than extend; signatures are free to produce and a stale one is free to exploit.
Watch for partial consumption
Some permit implementations let a spender consume less than the signed value and leave the rest available. That turns a one-shot permit into a standing allowance with none of the visibility. Read the implementation; if it permits partial fills, treat the remaining balance as approved and revoke explicitly when done.
Revocation cadence
After any session with an unaudited contract, revoke the same day. A weekly sweep of everything untouched for thirty days catches the rest. approve(spender, 0) costs 29,000 gas — cheaper than one drained token position by a factor of a thousand.
FAQ
How much gas does approve cost compared to permit?
Approve costs about 46,000 gas on a cold storage slot and about 29,000 on a warm slot. A permit signature plus transfer is roughly 54,000 gas total, so the saving over approve-then-transfer is about 20,000 to 40,000 gas. The saving is real but not a reason to accept an unknown contract.
Why is an infinite approve dangerous?
An allowance of 2^256-1 means any bug in the spender contract controls your whole balance of that token, forever, with no further signature. Malicious upgrades and compromised keys do not need you to click anything twice. Infinite approval is the reason most exploits drain unlimited balances.
What happens if two permits are signed in parallel?
Two permits signed in parallel share a nonce, so the second one reverts. A correct implementation consumes the nonce, which means a replayed permit also reverts. Sign permits sequentially rather than in parallel to avoid the race.
How long should a permit deadline be?
Twenty minutes is a reasonable default. A deadline that spans a chain halt or a fork window can be replayed on the fork. Re-sign rather than extend, since signatures are free to produce and a stale one is free to exploit.
How do I revoke an approval?
Call approve(spender, 0), which costs about 29,000 gas on a warm slot. After any session with an unaudited contract, revoke the same day, and run a weekly sweep of everything untouched for thirty days. Revoking is far cheaper than a drained token position.











