EIPs Explained

EIP-3074 · Withdrawn · Core · 2020-10-15

EIP-3074: AUTH and AUTHCALL opcodes

Proposed AUTH and AUTHCALL opcodes that let an EOA sign once to delegate control to an "invoker" contract, enabling batching and sponsored gas; withdrawn and superseded by EIP-7702.

What problem does it solve?

Externally owned accounts (EOAs) can do exactly one call per transaction and must pay gas in ETH. Users wanted batching (approve and swap in one go), gas sponsorship (someone else pays), expirations and other smart-wallet features, without migrating funds to a new contract wallet.

A key motivation was sponsored transactions: many accounts hold valuable tokens but no ETH, and without ETH they cannot even pay for the swap that would get them ETH. Rather than enshrining each feature in a new transaction type, EIP-3074 lets an EOA delegate control to a contract that implements whatever logic it wants.

How it works

Two new opcodes:

AUTH (0xf6) takes an authority address and a memory range holding yParity, r, s, commit. It verifies a secp256k1 signature over:

keccak256(MAGIC || chainId || nonce || invokerAddress || commit)   // MAGIC = 0x04

If the signer equals authority (and authority has no code), it sets a frame-local context variable authorized = authority and returns 1; otherwise it clears authorized and returns 0. Cost: 3,100 plus memory expansion plus 100/2,600 for warm/cold authority.

AUTHCALL (0xf7) works like CALL, but the callee sees msg.sender == authorized, and value is taken from the authorized account's balance. If authorized is unset, execution is invalid. There is no 2,300 gas stipend, so value transfer costs 6,700 extra instead of 9,000.

The contract executing these opcodes is the invoker. The user signs over a specific invoker address and a commit hash; a safe invoker recomputes commit from the call details (target, calldata, value, gas, its own replay nonce) and only proceeds if they match. Including the EOA's current nonce in the signed message means any normal transaction from the EOA revokes all outstanding authorizations.

Sample code

Computing the digest an EOA would sign for AUTH (ethers v6, illustrative):

import { concat, keccak256, toBeHex, zeroPadValue, Wallet, Signature } from "ethers";

const MAGIC = "0x04";
const digest = keccak256(concat([
  MAGIC,
  toBeHex(chainId, 32),
  toBeHex(await provider.getTransactionCount(eoa.address), 32), // current nonce
  zeroPadValue(invokerAddress, 32),
  commit, // bytes32: invoker-defined hash of the intended call(s)
]));

// raw signature over the digest (no EIP-191 prefix)
const sig = Signature.from(eoa.signingKey.sign(digest));
// memory passed to AUTH: yParity(1) || r(32) || s(32) || commit(32)
const authData = concat([toBeHex(sig.yParity, 1), sig.r, sig.s, commit]);

Things to know

  • Status: Withdrawn. The withdrawal reason is "Superseded by EIP-7702". EIP-7702 (Set Code for EOAs) took over the same goals and shipped instead.
  • A buggy or malicious invoker could take near-total control of every EOA that signed for it. The spec requires invokers to be non-upgradeable and urges users to sign only for thoroughly reviewed ones.
  • Allowing authorized == tx.origin breaks the assumption that msg.sender == tx.origin only holds in the top-level call, which affects contracts using that check against sandwiching or reentrancy.
  • AUTH refuses accounts with code, following the reasoning of EIP-3607.
  • For contract-wallet-based account abstraction without protocol changes, see ERC-4337.

#eoa #account-abstraction #opcodes #sponsored-transactions #core

Details

Authors
Sam Wilson (@SamWilsn), Ansgar Dietrichs (@adietrichs), Matt Garnett (@lightclient), Micah Zoltu (@micahzoltu)
Status
Withdrawn
Type
Standards Track / Core
Created
2020-10-15
Requires
Required by

Machine-readable: Markdown · JSON