Skip to main content
Continues the witness-derived keypair pattern from Approval and Access Control. The spender authenticates by proving knowledge of their witness secret.

The Contract

How It Works

transferFrom authenticates the spender

The caller must produce a ZK proof that they hold the secret behind the spender’s stored UserPublicKey. The owner and to are explicit parameters — they are targets of the operation, not authorities.

Why this resists impersonation

_spendAllowance(owner, spender, amount) requires that the inner map _allowances[owner][spender] already holds at least amount. Because the allowance was written by owner against a specific spender public key, and because spender here was just derived from the caller’s witness secret, the caller must actually hold the spender’s secret. An attacker with no secret cannot synthesise a passing proof, no matter what they read from the chain.

Infinite approval

If the recorded allowance equals MAX_UINT128, treat it as unlimited and skip the decrement. Useful for long-lived integrations (e.g. a DEX).

Partial spending

Privacy Note

Each transferFrom writes the (owner, spender, amount) tuple to the public ledger. The participant graph is visible to chain observers.

What’s Next

Token Approval

Back to granting approvals

ERC20 Token

Complete token implementation