In this track: Tokens and digital ownership
intermediate · 3 MIN READ

Approve zero and allowance changes

Changing a standing permission requires attention to ordering.

LET’S PICTURE IT

Replacing a pickup permit while the old permit can still be used introduces a timing question, not just a new number.

SEE IT FOR YOURSELF
Build a transfer call from typed fieldsStep 1 / 4
Build a transfer call from typed fieldstransfer(address,uint256)Recipient: 0x0000…0001Raw amount: 100Diagram labels abbreviate addresses; the lab shows full bytes4-byte selectora9059cbbEach box is one byte; this prefix is not a 32-byte wordWord 0 · recipient address12 zero bytes20 address bytes000…0001Left padding preserves the lower-order address valueSelector4 bytesa9059cbbAddress32 bytesword 0Amount32 bytesword 1 → 0x644 + 32 + 32 = 68 bytesThe integer does not contain token decimals or market price

The standard transfer interface takes an address and a raw integer amount. This diagram uses address one and amount one hundred.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Approve commonly sets a value

Under the ERC-20 interface, a new approve call overwrites the spender’s allowance with the specified value. It is not generally an instruction to add that number to the previous allowance.

Transactions can race

When changing a nonzero allowance to another value, a spender might use the old permission before the update is included. Applications need to reason about ordering instead of assuming the pending update already took effect.

Zero-first is a documented mitigation pattern

The standard discusses interfaces setting an allowance to zero before setting a new nonzero value for the same spender. This adds steps and does not retroactively cancel spending that already completed. Implementations may offer other mechanisms with their own rules.

Read the actual token behavior

Some tokens impose special approval constraints. Libraries and interfaces need an explicit compatibility policy. Practice encoding approve in the local lab, while leaving real permission changes to a deliberately reviewed wallet flow.

TURN UNDERSTANDING INTO PRACTICEOpen the ABI encoder →
QUICK CHECK · NO PRESSURE

Does a standard approve(spender, 5) generally mean “add five to whatever was there”?

Your progress stays in this browser.
Keep exploring the original referenceEthereum Improvement Proposals ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.