{"eip":3009,"title":"Transfer With Authorization","description":"Transfer fungible assets via a signed authorization","authors":["Peter Jihoon Kim (@petejkim)","Kevin Britz (@kbrizzle)","David Knott (@DavidLKnott)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2020-09-28","requires":[20,712],"discussionsTo":"https://ethereum-magicians.org/t/erc-3009-transfer-with-authorization/25698","repo":"ERCs","label":"ERC-3009","officialUrl":"https://eips.ethereum.org/EIPS/eip-3009","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-3009.md","url":"https://eips.huatuo.xyz/eip-3009/","tldr":{"en":"Lets an ERC-20 holder sign a one-off transfer authorization off-chain that anyone can submit, using random nonces and a validity window, enabling gasless and atomic token payments without allowances.","ja":"ERC-20 の保有者が、1 回限りの送金の承認をオフチェーンで署名し、誰でもそれを送信できるようにする。ランダムな nonce と有効期間を使い、allowance なしでガスレスかつアトミックなトークン支払いを実現する。","ko":"ERC-20 보유자가 일회성 전송 승인을 오프체인에서 서명하면 누구나 이를 제출할 수 있게 한다. 무작위 nonce와 유효 기간을 사용해 allowance 없이 가스리스·원자적 토큰 결제를 가능하게 한다.","zh":"允许 ERC-20 持有者在链下签署一次性的转账授权，任何人都可以提交；使用随机 nonce 和有效期窗口，无需 allowance 即可实现免 gas 且原子的代币支付。"},"tags":["token","erc20","meta-transactions","gasless","eip712","payments"],"explainers":{"en":{"lang":"en","tldr":"Lets an ERC-20 holder sign a one-off transfer authorization off-chain that anyone can submit, using random nonces and a validity window, enabling gasless and atomic token payments without allowances.","tags":["token","erc20","meta-transactions","gasless","eip712","payments"],"related":[20,712,2612,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-3009/","markdown":"## What problem does it solve?\n\nTo move [ERC-20](/eip-20/) tokens, a holder normally sends a transaction and therefore needs ETH for gas. Letting a contract move tokens on your behalf requires an `approve` first, which adds a transaction and often leads to risky \"infinite\" allowances.\n\n[ERC-2612](/eip-2612/) `permit` solved part of this with a signed approval, but it uses **sequential** nonces. If a user signs nonce 5 and nonce 6 in two different apps, or a relayer lands them in the wrong order, one of them fails. It also still relies on the allowance pattern.\n\nERC-3009 lets the holder sign the **transfer itself**. A relayer, the recipient or a contract submits it and pays the gas. Each authorization has a random 32-byte nonce, so users can create many in parallel with no ordering issues.\n\n## How it works\n\nThe holder signs an [EIP-712](/eip-712/) typed message:\n\n```text\nTransferWithAuthorization(address from,address to,uint256 value,\n                          uint256 validAfter,uint256 validBefore,bytes32 nonce)\n```\n\nThe token exposes:\n\n| Function | Purpose |\n| --- | --- |\n| `transferWithAuthorization(from, to, value, validAfter, validBefore, nonce, v, r, s)` | Anyone may submit; moves `value` from `from` to `to` |\n| `receiveWithAuthorization(...)` (same args) | Same, but requires `msg.sender == to`; use this from contracts |\n| `authorizationState(authorizer, nonce)` | Whether a nonce has been used |\n| `cancelAuthorization(authorizer, nonce, v, r, s)` | Optional: burn a nonce before it is used |\n\nThe contract checks that `validAfter \u003c now \u003c validBefore`, that the nonce is unused for `from`, and that the signature recovers to `from`. It then marks the nonce used, emits `AuthorizationUsed(authorizer, nonce)` and performs the transfer.\n\nThe validity window protects users when a relayer controls submission timing. The EIP-712 domain (including `chainId` and the token address) prevents replay on other chains or tokens.\n\n## Sample code\n\nSigning an authorization and submitting it as a relayer (ethers v6):\n\n```ts\nimport { Wallet, Contract, hexlify, randomBytes, Signature, parseUnits } from \"ethers\";\n\nconst domain = { name: \"USD Coin\", version: \"2\", chainId, verifyingContract: tokenAddress };\nconst types = {\n  TransferWithAuthorization: [\n    { name: \"from\", type: \"address\" },\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n    { name: \"validAfter\", type: \"uint256\" },\n    { name: \"validBefore\", type: \"uint256\" },\n    { name: \"nonce\", type: \"bytes32\" },\n  ],\n};\nconst message = {\n  from: payer.address,\n  to: merchant,\n  value: parseUnits(\"10\", 6),\n  validAfter: 0,\n  validBefore: Math.floor(Date.now() / 1000) + 3600, // 1 hour\n  nonce: hexlify(randomBytes(32)),\n};\n\nconst sig = Signature.from(await payer.signTypedData(domain, types, message)); // off-chain\n\n// Relayer pays the gas:\nconst token = new Contract(tokenAddress, [\n  \"function transferWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)\",\n], relayer);\nawait token.transferWithAuthorization(\n  message.from, message.to, message.value, message.validAfter,\n  message.validBefore, message.nonce, sig.v, sig.r, sig.s,\n);\n```\n\nDomain `name` and `version` must match what the token contract uses; read them from the contract rather than hard-coding.\n\n## Things to know\n\n- Status is **Draft**, although the interface has been implemented in production tokens, most prominently USDC.\n- **Front-running:** if a contract calls `transferWithAuthorization`, an observer can copy the signature from the mempool and submit it directly, so the transfer happens without your contract's logic running. Contracts should use `receiveWithAuthorization`, which only the payee can call.\n- It is designed for externally owned accounts. Contract accounts can just call `transfer` directly.\n- Implementations must reject a zero-address result from `ecrecover`; malformed signatures recover to `address(0)`.\n- Tokens are encouraged to implement both ERC-3009 and [ERC-2612](/eip-2612/) for maximum compatibility.\n"},"ja":{"lang":"ja","tldr":"ERC-20 の保有者が、1 回限りの送金の承認をオフチェーンで署名し、誰でもそれを送信できるようにする。ランダムな nonce と有効期間を使い、allowance なしでガスレスかつアトミックなトークン支払いを実現する。","tags":["token","erc20","meta-transactions","gasless","eip712","payments"],"related":[20,712,2612,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-3009/","markdown":"## 何を解決するのか\n\n[ERC-20](/eip-20/) トークンを動かすには、保有者が通常トランザクションを送る必要があり、そのためガス用の ETH が必要です。コントラクトに自分の代わりにトークンを動かさせるには、まず `approve` が必要で、トランザクションが 1 回増え、危険な「無限」の allowance につながることもよくあります。\n\n[ERC-2612](/eip-2612/) の `permit` は、署名付きの承認によってこの問題の一部を解決しましたが、**連番の** nonce を使います。ユーザーが 2 つの異なるアプリで nonce 5 と nonce 6 に署名したり、リレイヤーが誤った順序でトランザクションを載せたりすると、どちらかが失敗します。また、依然として allowance パターンに依存しています。\n\nERC-3009 では、保有者が**送金そのもの**に署名します。リレイヤー、受取人、またはコントラクトがそれを送信し、ガスを支払います。各承認にはランダムな 32 バイトの nonce があるため、ユーザーは順序の問題なしに、多数を並行して作成できます。\n\n## 仕組み\n\n保有者は [EIP-712](/eip-712/) の型付きメッセージに署名します。\n\n```text\nTransferWithAuthorization(address from,address to,uint256 value,\n                          uint256 validAfter,uint256 validBefore,bytes32 nonce)\n```\n\nトークンは次の関数を公開します。\n\n| 関数 | 役割 |\n| --- | --- |\n| `transferWithAuthorization(from, to, value, validAfter, validBefore, nonce, v, r, s)` | 誰でも送信可能。`from` から `to` へ `value` を移動する |\n| `receiveWithAuthorization(...)`（引数は同じ） | 同じだが、`msg.sender == to` が必要。コントラクトからはこちらを使う |\n| `authorizationState(authorizer, nonce)` | nonce が使用済みかどうか |\n| `cancelAuthorization(authorizer, nonce, v, r, s)` | 任意：nonce を使用前に無効化する |\n\nコントラクトは、`validAfter \u003c now \u003c validBefore` であること、`from` に対してその nonce が未使用であること、署名が `from` に復元されることを確認します。その後、nonce を使用済みにし、`AuthorizationUsed(authorizer, nonce)` を emit して、送金を実行します。\n\n有効期間は、リレイヤーが送信タイミングを握る場合にユーザーを保護します。EIP-712 のドメイン（`chainId` とトークンアドレスを含む）によって、他のチェーンや他のトークンでのリプレイが防がれます。\n\n## サンプルコード\n\n承認に署名し、リレイヤーとして送信する例です（ethers v6）。\n\n```ts\nimport { Wallet, Contract, hexlify, randomBytes, Signature, parseUnits } from \"ethers\";\n\nconst domain = { name: \"USD Coin\", version: \"2\", chainId, verifyingContract: tokenAddress };\nconst types = {\n  TransferWithAuthorization: [\n    { name: \"from\", type: \"address\" },\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n    { name: \"validAfter\", type: \"uint256\" },\n    { name: \"validBefore\", type: \"uint256\" },\n    { name: \"nonce\", type: \"bytes32\" },\n  ],\n};\nconst message = {\n  from: payer.address,\n  to: merchant,\n  value: parseUnits(\"10\", 6),\n  validAfter: 0,\n  validBefore: Math.floor(Date.now() / 1000) + 3600, // 1 hour\n  nonce: hexlify(randomBytes(32)),\n};\n\nconst sig = Signature.from(await payer.signTypedData(domain, types, message)); // off-chain\n\n// Relayer pays the gas:\nconst token = new Contract(tokenAddress, [\n  \"function transferWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)\",\n], relayer);\nawait token.transferWithAuthorization(\n  message.from, message.to, message.value, message.validAfter,\n  message.validBefore, message.nonce, sig.v, sig.r, sig.s,\n);\n```\n\nドメインの `name` と `version` は、トークンコントラクトが使っているものと一致させる必要があります。ハードコードせず、コントラクトから読み取ってください。\n\n## 知っておくべきこと\n\n- ステータスは **Draft** ですが、このインターフェースは、最も有名な USDC をはじめ、本番のトークンで実装されています。\n- **フロントランニング：** コントラクトが `transferWithAuthorization` を呼び出す場合、観察者は mempool から署名をコピーして直接送信でき、コントラクトのロジックが実行されないまま送金が行われます。コントラクトは、受取人だけが呼び出せる `receiveWithAuthorization` を使うべきです。\n- 外部所有アカウント向けに設計されています。コントラクトアカウントは、単に `transfer` を直接呼び出せば済みます。\n- 実装は、`ecrecover` がゼロアドレスを返した結果を拒否しなければなりません。不正な形式の署名は `address(0)` に復元されます。\n- 互換性を最大にするため、トークンは ERC-3009 と [ERC-2612](/eip-2612/) の両方を実装することが推奨されています。\n"},"ko":{"lang":"ko","tldr":"ERC-20 보유자가 일회성 전송 승인을 오프체인에서 서명하면 누구나 이를 제출할 수 있게 한다. 무작위 nonce와 유효 기간을 사용해 allowance 없이 가스리스·원자적 토큰 결제를 가능하게 한다.","tags":["token","erc20","meta-transactions","gasless","eip712","payments"],"related":[20,712,2612,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-3009/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-20](/eip-20/) 토큰을 옮기려면 보유자가 보통 트랜잭션을 보내야 하므로 가스용 ETH가 필요합니다. 컨트랙트가 대신 토큰을 옮기게 하려면 먼저 `approve`가 필요한데, 이는 트랜잭션을 하나 더 늘리고 위험한 \"무한\" allowance로 이어지는 경우가 많습니다.\n\n[ERC-2612](/eip-2612/)의 `permit`은 서명된 승인으로 이 문제의 일부를 해결했지만 **순차적** nonce를 사용합니다. 사용자가 서로 다른 두 앱에서 nonce 5와 nonce 6에 서명하거나 릴레이어가 순서를 잘못 올리면 둘 중 하나가 실패합니다. 또한 여전히 allowance 패턴에 의존합니다.\n\nERC-3009는 보유자가 **전송 자체**에 서명하게 합니다. 릴레이어, 수신자 또는 컨트랙트가 이를 제출하고 가스를 지불합니다. 각 승인에는 무작위 32바이트 nonce가 있어, 사용자는 순서 문제 없이 여러 개를 병렬로 만들 수 있습니다.\n\n## 어떻게 동작하나요?\n\n보유자는 [EIP-712](/eip-712/) 타입 메시지에 서명합니다.\n\n```text\nTransferWithAuthorization(address from,address to,uint256 value,\n                          uint256 validAfter,uint256 validBefore,bytes32 nonce)\n```\n\n토큰은 다음 함수를 노출합니다.\n\n| 함수 | 역할 |\n| --- | --- |\n| `transferWithAuthorization(from, to, value, validAfter, validBefore, nonce, v, r, s)` | 누구나 제출 가능. `from`에서 `to`로 `value`를 이동 |\n| `receiveWithAuthorization(...)` (같은 인자) | 같지만 `msg.sender == to`가 필요. 컨트랙트에서는 이것을 사용 |\n| `authorizationState(authorizer, nonce)` | nonce가 사용되었는지 여부 |\n| `cancelAuthorization(authorizer, nonce, v, r, s)` | 선택: nonce를 사용 전에 폐기 |\n\n컨트랙트는 `validAfter \u003c now \u003c validBefore`인지, 해당 nonce가 `from`에 대해 사용되지 않았는지, 서명이 `from`으로 복구되는지 확인합니다. 그런 다음 nonce를 사용됨으로 표시하고 `AuthorizationUsed(authorizer, nonce)`를 emit한 뒤 전송을 수행합니다.\n\n유효 기간은 릴레이어가 제출 시점을 좌우할 때 사용자를 보호합니다. EIP-712 도메인(`chainId`와 토큰 주소 포함)은 다른 체인이나 다른 토큰에서의 리플레이를 막습니다.\n\n## 샘플 코드\n\n승인에 서명하고 릴레이어로서 제출하는 예시입니다(ethers v6).\n\n```ts\nimport { Wallet, Contract, hexlify, randomBytes, Signature, parseUnits } from \"ethers\";\n\nconst domain = { name: \"USD Coin\", version: \"2\", chainId, verifyingContract: tokenAddress };\nconst types = {\n  TransferWithAuthorization: [\n    { name: \"from\", type: \"address\" },\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n    { name: \"validAfter\", type: \"uint256\" },\n    { name: \"validBefore\", type: \"uint256\" },\n    { name: \"nonce\", type: \"bytes32\" },\n  ],\n};\nconst message = {\n  from: payer.address,\n  to: merchant,\n  value: parseUnits(\"10\", 6),\n  validAfter: 0,\n  validBefore: Math.floor(Date.now() / 1000) + 3600, // 1 hour\n  nonce: hexlify(randomBytes(32)),\n};\n\nconst sig = Signature.from(await payer.signTypedData(domain, types, message)); // off-chain\n\n// Relayer pays the gas:\nconst token = new Contract(tokenAddress, [\n  \"function transferWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)\",\n], relayer);\nawait token.transferWithAuthorization(\n  message.from, message.to, message.value, message.validAfter,\n  message.validBefore, message.nonce, sig.v, sig.r, sig.s,\n);\n```\n\n도메인의 `name`과 `version`은 토큰 컨트랙트가 사용하는 값과 일치해야 합니다. 하드코딩하지 말고 컨트랙트에서 읽어 오세요.\n\n## 알아둘 점\n\n- 상태는 **Draft**이지만, 이 인터페이스는 가장 대표적으로 USDC를 비롯한 실서비스 토큰에 구현되어 있습니다.\n- **프론트러닝:** 컨트랙트가 `transferWithAuthorization`을 호출하면, 관찰자가 mempool에서 서명을 복사해 직접 제출할 수 있어 컨트랙트의 로직이 실행되지 않은 채 전송이 일어납니다. 컨트랙트는 수취인만 호출할 수 있는 `receiveWithAuthorization`을 사용해야 합니다.\n- 외부 소유 계정을 위해 설계되었습니다. 컨트랙트 계정은 그냥 `transfer`를 직접 호출하면 됩니다.\n- 구현은 `ecrecover`가 제로 주소를 반환한 결과를 거부해야 합니다. 형식이 잘못된 서명은 `address(0)`으로 복구됩니다.\n- 최대한의 호환성을 위해 토큰은 ERC-3009와 [ERC-2612](/eip-2612/)를 모두 구현하도록 권장합니다.\n"},"zh":{"lang":"zh","tldr":"允许 ERC-20 持有者在链下签署一次性的转账授权，任何人都可以提交；使用随机 nonce 和有效期窗口，无需 allowance 即可实现免 gas 且原子的代币支付。","tags":["token","erc20","meta-transactions","gasless","eip712","payments"],"related":[20,712,2612,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-3009/","markdown":"## 它解决什么问题？\n\n要转移 [ERC-20](/eip-20/) 代币，持有者通常需要发送一笔交易，因此需要 ETH 来支付 gas。让合约代你转移代币则需要先 `approve`，这会多出一笔交易，还常常导致有风险的\"无限\"授权额度。\n\n[ERC-2612](/eip-2612/) 的 `permit` 通过签名授权解决了其中一部分问题，但它使用的是**顺序**的 nonce。如果用户在两个不同的应用中分别签了 nonce 5 和 nonce 6，或者中继者把它们以错误的顺序上链，就会有一个失败。而且它仍然依赖 allowance 模式。\n\nERC-3009 让持有者签署**转账本身**。由中继者、收款方或合约提交并支付 gas。每个授权都带有一个随机的 32 字节 nonce，因此用户可以并行创建许多授权，不存在顺序问题。\n\n## 它如何运作\n\n持有者签署一条 [EIP-712](/eip-712/) 类型化消息：\n\n```text\nTransferWithAuthorization(address from,address to,uint256 value,\n                          uint256 validAfter,uint256 validBefore,bytes32 nonce)\n```\n\n代币合约公开以下函数：\n\n| 函数 | 用途 |\n| --- | --- |\n| `transferWithAuthorization(from, to, value, validAfter, validBefore, nonce, v, r, s)` | 任何人都可以提交；把 `value` 从 `from` 转给 `to` |\n| `receiveWithAuthorization(...)`（参数相同） | 同上，但要求 `msg.sender == to`；合约应使用这个 |\n| `authorizationState(authorizer, nonce)` | 某个 nonce 是否已被使用 |\n| `cancelAuthorization(authorizer, nonce, v, r, s)` | 可选：在 nonce 被使用之前将其作废 |\n\n合约会检查 `validAfter \u003c now \u003c validBefore`、该 nonce 对 `from` 尚未使用，以及签名能恢复出 `from`。然后把 nonce 标记为已使用，触发 `AuthorizationUsed(authorizer, nonce)` 事件，并执行转账。\n\n当提交时机由中继者掌控时，有效期窗口可以保护用户。EIP-712 域（包括 `chainId` 和代币地址）防止了在其他链或其他代币上的重放。\n\n## 示例代码\n\n签署授权并以中继者身份提交（ethers v6）：\n\n```ts\nimport { Wallet, Contract, hexlify, randomBytes, Signature, parseUnits } from \"ethers\";\n\nconst domain = { name: \"USD Coin\", version: \"2\", chainId, verifyingContract: tokenAddress };\nconst types = {\n  TransferWithAuthorization: [\n    { name: \"from\", type: \"address\" },\n    { name: \"to\", type: \"address\" },\n    { name: \"value\", type: \"uint256\" },\n    { name: \"validAfter\", type: \"uint256\" },\n    { name: \"validBefore\", type: \"uint256\" },\n    { name: \"nonce\", type: \"bytes32\" },\n  ],\n};\nconst message = {\n  from: payer.address,\n  to: merchant,\n  value: parseUnits(\"10\", 6),\n  validAfter: 0,\n  validBefore: Math.floor(Date.now() / 1000) + 3600, // 1 hour\n  nonce: hexlify(randomBytes(32)),\n};\n\nconst sig = Signature.from(await payer.signTypedData(domain, types, message)); // off-chain\n\n// Relayer pays the gas:\nconst token = new Contract(tokenAddress, [\n  \"function transferWithAuthorization(address,address,uint256,uint256,uint256,bytes32,uint8,bytes32,bytes32)\",\n], relayer);\nawait token.transferWithAuthorization(\n  message.from, message.to, message.value, message.validAfter,\n  message.validBefore, message.nonce, sig.v, sig.r, sig.s,\n);\n```\n\n域中的 `name` 和 `version` 必须与代币合约使用的一致；请从合约中读取，而不要硬编码。\n\n## 需要注意\n\n- 状态为 **Draft**，不过该接口已在生产环境的代币中实现，最著名的是 USDC。\n- **抢跑（front-running）：** 如果合约调用 `transferWithAuthorization`，观察者可以从内存池中复制签名并直接提交，这样转账就会在你合约的逻辑没有运行的情况下发生。合约应使用只有收款方才能调用的 `receiveWithAuthorization`。\n- 它是为外部拥有账户设计的。合约账户直接调用 `transfer` 即可。\n- 实现必须拒绝 `ecrecover` 返回零地址的结果；格式错误的签名会恢复为 `address(0)`。\n- 为了获得最大的兼容性，鼓励代币同时实现 ERC-3009 和 [ERC-2612](/eip-2612/)。\n"}},"requiredBy":[7598,8126]}
