{"eip":3074,"title":"AUTH and AUTHCALL opcodes","description":"Allow externally owned accounts to delegate control to a contract.","authors":["Sam Wilson (@SamWilsn)","Ansgar Dietrichs (@adietrichs)","Matt Garnett (@lightclient)","Micah Zoltu (@micahzoltu)"],"status":"Withdrawn","type":"Standards Track","category":"Core","created":"2020-10-15","requires":[155],"discussionsTo":"https://ethereum-magicians.org/t/eip-3074-sponsored-transaction-precompile/4880","repo":"EIPs","label":"EIP-3074","officialUrl":"https://eips.ethereum.org/EIPS/eip-3074","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-3074.md","url":"https://eips.huatuo.xyz/eip-3074/","tldr":{"en":"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.","ja":"EOA が一度署名するだけで「インボーカー」コントラクトに制御を委任できる AUTH と AUTHCALL opcode の提案。バッチ処理やガス代のスポンサーを可能にする。撤回され、EIP-7702 に置き換えられた。","ko":"EOA가 한 번만 서명해 \"인보커\" 컨트랙트에 제어를 위임할 수 있게 하는 AUTH와 AUTHCALL opcode 제안. 배치 처리와 가스 후원을 가능하게 한다. 철회되었고 EIP-7702로 대체되었다.","zh":"提议新增 AUTH 和 AUTHCALL 操作码，让 EOA 只需签名一次就能把控制权委托给一个\"invoker\"合约，从而实现批处理和代付 gas；已撤回，被 EIP-7702 取代。"},"tags":["eoa","account-abstraction","opcodes","sponsored-transactions","core"],"explainers":{"en":{"lang":"en","tldr":"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.","tags":["eoa","account-abstraction","opcodes","sponsored-transactions","core"],"related":[7702,4337,3607,2938,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3074/","markdown":"## What problem does it solve?\n\nExternally 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.\n\nA 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.\n\n## How it works\n\nTwo new opcodes:\n\n**`AUTH` (0xf6)** takes an `authority` address and a memory range holding `yParity, r, s, commit`. It verifies a secp256k1 signature over:\n\n```\nkeccak256(MAGIC || chainId || nonce || invokerAddress || commit)   // MAGIC = 0x04\n```\n\nIf 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`.\n\n**`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.\n\nThe 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.\n\n## Sample code\n\nComputing the digest an EOA would sign for `AUTH` (ethers v6, illustrative):\n\n```ts\nimport { concat, keccak256, toBeHex, zeroPadValue, Wallet, Signature } from \"ethers\";\n\nconst MAGIC = \"0x04\";\nconst digest = keccak256(concat([\n  MAGIC,\n  toBeHex(chainId, 32),\n  toBeHex(await provider.getTransactionCount(eoa.address), 32), // current nonce\n  zeroPadValue(invokerAddress, 32),\n  commit, // bytes32: invoker-defined hash of the intended call(s)\n]));\n\n// raw signature over the digest (no EIP-191 prefix)\nconst sig = Signature.from(eoa.signingKey.sign(digest));\n// memory passed to AUTH: yParity(1) || r(32) || s(32) || commit(32)\nconst authData = concat([toBeHex(sig.yParity, 1), sig.r, sig.s, commit]);\n```\n\n## Things to know\n\n- **Status: Withdrawn.** The withdrawal reason is \"Superseded by [EIP-7702](/eip-7702/)\". EIP-7702 (Set Code for EOAs) took over the same goals and shipped instead.\n- 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.\n- 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.\n- `AUTH` refuses accounts with code, following the reasoning of [EIP-3607](/eip-3607/).\n- For contract-wallet-based account abstraction without protocol changes, see [ERC-4337](/eip-4337/).\n"},"ja":{"lang":"ja","tldr":"EOA が一度署名するだけで「インボーカー」コントラクトに制御を委任できる AUTH と AUTHCALL opcode の提案。バッチ処理やガス代のスポンサーを可能にする。撤回され、EIP-7702 に置き換えられた。","tags":["eoa","account-abstraction","opcodes","sponsored-transactions","core"],"related":[7702,4337,3607,2938,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3074/","markdown":"## 何を解決するのか\n\n外部所有アカウント（EOA）は、1 トランザクションにつき 1 回の呼び出ししかできず、ガス代は ETH で支払わなければなりません。ユーザーは、資金を新しいコントラクトウォレットに移さずに、バッチ処理（approve と swap を一度に）、ガス代のスポンサー（他の誰かが支払う）、有効期限など、スマートウォレットの機能を求めていました。\n\n大きな動機の 1 つは**スポンサー付きトランザクション**でした。価値あるトークンを持っていても ETH がないアカウントは多く、ETH がなければ、ETH を手に入れるためのスワップのガス代すら払えません。EIP-3074 は、機能ごとに新しいトランザクションタイプを組み込む代わりに、EOA が好きなロジックを実装したコントラクトに制御を**委任**できるようにします。\n\n## 仕組み\n\n新しい opcode が 2 つあります。\n\n**`AUTH`（0xf6）** は、`authority` アドレスと、`yParity, r, s, commit` を保持するメモリ範囲を受け取ります。次に対する secp256k1 署名を検証します。\n\n```\nkeccak256(MAGIC || chainId || nonce || invokerAddress || commit)   // MAGIC = 0x04\n```\n\n署名者が `authority` と一致し（かつ `authority` にコードがない）場合、フレームローカルのコンテキスト変数 `authorized = authority` を設定して 1 を返します。そうでなければ `authorized` をクリアして 0 を返します。コストは 3,100 にメモリ拡張分と、`authority` が warm か cold かに応じた 100/2,600 を加えたものです。\n\n**`AUTHCALL`（0xf7）** は `CALL` と同様に動作しますが、呼び出された側には `msg.sender == authorized` と見え、`value` は authorized アカウントの残高から取られます。`authorized` が未設定の場合、実行は無効になります。2,300 ガスのスタイペンドはないため、value 転送の追加コストは 9,000 ではなく 6,700 です。\n\nこれらの opcode を実行するコントラクトが**インボーカー**です。ユーザーは特定のインボーカーアドレスと `commit` ハッシュに対して署名します。安全なインボーカーは、呼び出しの詳細（target、calldata、value、ガス、自前のリプレイ用 nonce）から `commit` を再計算し、一致する場合にのみ処理を進めます。署名対象のメッセージに EOA の現在の `nonce` を含めるため、EOA からの通常のトランザクションが 1 つでもあれば、未処理の認可はすべて失効します。\n\n## サンプルコード\n\nEOA が `AUTH` のために署名するダイジェストの計算（ethers v6、説明用）:\n\n```ts\nimport { concat, keccak256, toBeHex, zeroPadValue, Wallet, Signature } from \"ethers\";\n\nconst MAGIC = \"0x04\";\nconst digest = keccak256(concat([\n  MAGIC,\n  toBeHex(chainId, 32),\n  toBeHex(await provider.getTransactionCount(eoa.address), 32), // current nonce\n  zeroPadValue(invokerAddress, 32),\n  commit, // bytes32: invoker-defined hash of the intended call(s)\n]));\n\n// raw signature over the digest (no EIP-191 prefix)\nconst sig = Signature.from(eoa.signingKey.sign(digest));\n// memory passed to AUTH: yParity(1) || r(32) || s(32) || commit(32)\nconst authData = concat([toBeHex(sig.yParity, 1), sig.r, sig.s, commit]);\n```\n\n## 知っておくべきこと\n\n- **ステータス: Withdrawn（撤回）。** 撤回の理由は「[EIP-7702](/eip-7702/) に置き換えられた」です。EIP-7702（Set Code for EOAs）が同じ目標を引き継ぎ、代わりに出荷されました。\n- バグのある、または悪意のあるインボーカーは、それに対して署名したすべての EOA をほぼ完全に支配できてしまいます。仕様はインボーカーがアップグレード不可であることを求め、十分にレビューされたものに対してのみ署名するようユーザーに促しています。\n- `authorized == tx.origin` を許すと、`msg.sender == tx.origin` が成り立つのは最上位の呼び出しだけだという前提が崩れます。これは、サンドイッチ攻撃やリエントランシー対策としてこのチェックを使うコントラクトに影響します。\n- `AUTH` は、[EIP-3607](/eip-3607/) の考え方に従い、コードを持つアカウントを拒否します。\n- プロトコルの変更なしにコントラクトウォレットでアカウントアブストラクションを実現するには、[ERC-4337](/eip-4337/) を参照してください。\n"},"ko":{"lang":"ko","tldr":"EOA가 한 번만 서명해 \"인보커\" 컨트랙트에 제어를 위임할 수 있게 하는 AUTH와 AUTHCALL opcode 제안. 배치 처리와 가스 후원을 가능하게 한다. 철회되었고 EIP-7702로 대체되었다.","tags":["eoa","account-abstraction","opcodes","sponsored-transactions","core"],"related":[7702,4337,3607,2938,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3074/","markdown":"## 어떤 문제를 해결하나요?\n\n외부 소유 계정(EOA)은 트랜잭션당 정확히 한 번의 호출만 할 수 있고 가스를 ETH로 내야 합니다. 사용자들은 자금을 새 컨트랙트 지갑으로 옮기지 않고도 배치 처리(approve와 swap을 한 번에), 가스 후원(다른 사람이 지불), 만료 등 스마트 지갑 기능을 원했습니다.\n\n핵심 동기 중 하나는 **후원 트랜잭션**이었습니다. 가치 있는 토큰을 가지고 있어도 ETH가 없는 계정이 많고, ETH가 없으면 ETH를 얻기 위한 스왑 비용조차 낼 수 없습니다. EIP-3074는 기능마다 새 트랜잭션 타입에 못 박는 대신, EOA가 원하는 로직을 구현한 컨트랙트에 제어를 **위임**하게 합니다.\n\n## 어떻게 동작하나요?\n\n새 opcode 두 개입니다.\n\n**`AUTH`(0xf6)** 는 `authority` 주소와 `yParity, r, s, commit`을 담은 메모리 범위를 받습니다. 다음 값에 대한 secp256k1 서명을 검증합니다.\n\n```\nkeccak256(MAGIC || chainId || nonce || invokerAddress || commit)   // MAGIC = 0x04\n```\n\n서명자가 `authority`와 같고(`authority`에 코드가 없을 때) 프레임 로컬 컨텍스트 변수 `authorized = authority`를 설정하고 1을 반환합니다. 그렇지 않으면 `authorized`를 지우고 0을 반환합니다. 비용은 3,100에 메모리 확장 비용과, `authority`가 warm인지 cold인지에 따라 100/2,600을 더한 값입니다.\n\n**`AUTHCALL`(0xf7)** 은 `CALL`처럼 동작하지만, 피호출자는 `msg.sender == authorized`로 보고 `value`는 authorized 계정의 잔액에서 가져옵니다. `authorized`가 설정되지 않았으면 실행은 무효입니다. 2,300 가스 스타이펜드가 없어서 value 전송의 추가 비용은 9,000이 아니라 6,700입니다.\n\n이 opcode를 실행하는 컨트랙트가 **인보커**입니다. 사용자는 특정 인보커 주소와 `commit` 해시에 대해 서명합니다. 안전한 인보커는 호출 세부 사항(target, calldata, value, 가스, 자체 재전송 방지 nonce)으로부터 `commit`을 다시 계산하고, 일치할 때만 진행합니다. 서명된 메시지에 EOA의 현재 `nonce`를 포함하므로, EOA에서 나간 일반 트랜잭션 하나만 있어도 미처리 인증은 모두 취소됩니다.\n\n## 샘플 코드\n\nEOA가 `AUTH`를 위해 서명하는 다이제스트 계산(ethers v6, 설명용):\n\n```ts\nimport { concat, keccak256, toBeHex, zeroPadValue, Wallet, Signature } from \"ethers\";\n\nconst MAGIC = \"0x04\";\nconst digest = keccak256(concat([\n  MAGIC,\n  toBeHex(chainId, 32),\n  toBeHex(await provider.getTransactionCount(eoa.address), 32), // current nonce\n  zeroPadValue(invokerAddress, 32),\n  commit, // bytes32: invoker-defined hash of the intended call(s)\n]));\n\n// raw signature over the digest (no EIP-191 prefix)\nconst sig = Signature.from(eoa.signingKey.sign(digest));\n// memory passed to AUTH: yParity(1) || r(32) || s(32) || commit(32)\nconst authData = concat([toBeHex(sig.yParity, 1), sig.r, sig.s, commit]);\n```\n\n## 알아둘 점\n\n- **상태: Withdrawn(철회).** 철회 사유는 \"[EIP-7702](/eip-7702/)로 대체됨\"입니다. EIP-7702(Set Code for EOAs)가 같은 목표를 이어받아 대신 출시되었습니다.\n- 버그가 있거나 악의적인 인보커는 자신에게 서명한 모든 EOA를 거의 완전히 장악할 수 있습니다. 명세는 인보커가 업그레이드 불가능해야 한다고 요구하며, 사용자에게 충분히 검토된 인보커에만 서명하라고 권고합니다.\n- `authorized == tx.origin`을 허용하면 `msg.sender == tx.origin`이 최상위 호출에서만 성립한다는 가정이 깨집니다. 이는 샌드위치 공격이나 재진입 방지를 위해 이 검사를 쓰는 컨트랙트에 영향을 줍니다.\n- `AUTH`는 [EIP-3607](/eip-3607/)의 논리에 따라 코드가 있는 계정을 거부합니다.\n- 프로토콜 변경 없이 컨트랙트 지갑 기반 계정 추상화를 쓰려면 [ERC-4337](/eip-4337/)을 참고하세요.\n"},"zh":{"lang":"zh","tldr":"提议新增 AUTH 和 AUTHCALL 操作码，让 EOA 只需签名一次就能把控制权委托给一个\"invoker\"合约，从而实现批处理和代付 gas；已撤回，被 EIP-7702 取代。","tags":["eoa","account-abstraction","opcodes","sponsored-transactions","core"],"related":[7702,4337,3607,2938,155],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3074/","markdown":"## 它解决什么问题？\n\n外部拥有账户（EOA）每笔交易只能做一次调用，而且必须用 ETH 支付 gas。用户希望获得批处理（一次完成 approve 和 swap）、gas 赞助（由别人付费）、过期时间等智能钱包功能，而不必把资金迁移到新的合约钱包。\n\n一个关键动机是**赞助交易**：许多账户持有有价值的代币却没有 ETH，没有 ETH 就连换取 ETH 的兑换交易都付不起。EIP-3074 没有为每个功能都在新的交易类型中固化，而是让 EOA 能把控制权**委托**给一个可以实现任意逻辑的合约。\n\n## 它如何运作\n\n两个新操作码：\n\n**`AUTH`（0xf6）** 接收一个 `authority` 地址和一段保存 `yParity, r, s, commit` 的内存范围。它验证对以下内容的 secp256k1 签名：\n\n```\nkeccak256(MAGIC || chainId || nonce || invokerAddress || commit)   // MAGIC = 0x04\n```\n\n如果签名者等于 `authority`（且 `authority` 没有代码），它会设置帧内局部的上下文变量 `authorized = authority` 并返回 1；否则清除 `authorized` 并返回 0。成本：3,100，加上内存扩展，再加上 `authority` 为 warm/cold 时的 100/2,600。\n\n**`AUTHCALL`（0xf7）** 的工作方式与 `CALL` 类似，但被调用方看到的是 `msg.sender == authorized`，并且 `value` 取自 authorized 账户的余额。如果 `authorized` 未设置，则执行无效。没有 2,300 gas 的津贴，所以转账价值的额外成本是 6,700 而不是 9,000。\n\n执行这些操作码的合约就是 **invoker**。用户对特定的 invoker 地址和一个 `commit` 哈希签名；安全的 invoker 会根据调用细节（target、calldata、value、gas、它自己的重放 nonce）重新计算 `commit`，仅在两者匹配时才继续。把 EOA 当前的 `nonce` 包含在已签名消息中，意味着 EOA 发出的任何一笔普通交易都会撤销所有未完成的授权。\n\n## 示例代码\n\n计算 EOA 为 `AUTH` 签名的摘要（ethers v6，示意）：\n\n```ts\nimport { concat, keccak256, toBeHex, zeroPadValue, Wallet, Signature } from \"ethers\";\n\nconst MAGIC = \"0x04\";\nconst digest = keccak256(concat([\n  MAGIC,\n  toBeHex(chainId, 32),\n  toBeHex(await provider.getTransactionCount(eoa.address), 32), // current nonce\n  zeroPadValue(invokerAddress, 32),\n  commit, // bytes32: invoker-defined hash of the intended call(s)\n]));\n\n// raw signature over the digest (no EIP-191 prefix)\nconst sig = Signature.from(eoa.signingKey.sign(digest));\n// memory passed to AUTH: yParity(1) || r(32) || s(32) || commit(32)\nconst authData = concat([toBeHex(sig.yParity, 1), sig.r, sig.s, commit]);\n```\n\n## 需要注意\n\n- **状态：Withdrawn（已撤回）。** 撤回原因是\"被 [EIP-7702](/eip-7702/) 取代\"。EIP-7702（Set Code for EOAs）接过了同样的目标并最终上线。\n- 有缺陷或恶意的 invoker 几乎可以完全控制所有为它签过名的 EOA。规范要求 invoker 不可升级，并敦促用户只为经过充分审查的 invoker 签名。\n- 允许 `authorized == tx.origin` 会打破\"`msg.sender == tx.origin` 只在顶层调用中成立\"的假设，这会影响那些用该检查来防范三明治攻击或重入的合约。\n- `AUTH` 拒绝有代码的账户，遵循 [EIP-3607](/eip-3607/) 的思路。\n- 若想在不改动协议的情况下通过合约钱包实现账户抽象，请参阅 [ERC-4337](/eip-4337/)。\n"}},"requiredBy":[5003]}
