Token standards & NFTs

ERC-2612 permit

ERC-2612 permit lets you approve a spender by signing a message instead of sending an approve transaction. Normally a DeFi interaction costs two transactions: first approve (which costs gas and a wallet click), then the actual swap or deposit. Permit collapses this: you sign a structured off-chain message granting the allowance, and that signature is passed into a single on-chain call, so the approval and the action settle together. From the user's view the approve step becomes 'gasless' — there is no separate transaction to pay for.

The mechanism is an EIP-712 typed-data signature. The token exposes permit(owner, spender, value, deadline, v, r, s); it reconstructs the exact message the owner signed (including the token's DOMAIN_SEPARATOR, the spender, the value, a per-owner nonce, and a deadline), recovers the signer with ecrecover, checks it equals owner and that the deadline has not passed, increments the nonce to stop replay, and then sets the allowance — all in one call that anyone (a relayer, or the spender contract itself) can submit. The nonce and deadline are what make each signed permit single-use and time-bounded.

The same power is a phishing surface. A signature request looks harmless because it is not a transaction and shows no gas, yet a permit signature can authorize draining a token balance just as effectively as an on-chain approve. Variants like DAI's older custom permit and the broader Permit2 contract (a single approval target many apps share) extend the idea, but the rule for users is unchanged: read what you are signing, especially the spender and value.

// EIP-712 struct the owner signs:
Permit(
  address owner,
  address spender,
  uint256 value,
  uint256 nonce,
  uint256 deadline
)
// then on-chain, in one tx:
token.permit(owner, spender, value, deadline, v, r, s);
token.transferFrom(owner, spender, value);

Sign off-chain, approve and pull in a single transaction.

'Gasless' refers only to the approval, and only for the user — someone still submits the on-chain permit call and pays its gas. A signed permit is a bearer authorization until its deadline or nonce kills it.

Also called
signed approval簽章授權