{"eip":7272,"title":"Ethereum Access Token","description":"A protocol for authorizing function calls from an off-chain service","authors":["Chris Chung (@0xpApaSmURf)","Raphael Roullet (@ra-phael)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2023-07-03","requires":[712],"discussionsTo":"https://ethereum-magicians.org/t/eip-7272-ethereum-access-token/14945","repo":"ERCs","label":"ERC-7272","officialUrl":"https://eips.ethereum.org/EIPS/eip-7272","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7272.md","url":"https://eips.huatuo.xyz/eip-7272/","tldr":{"en":"Defines an EIP-712 signed, short-lived 'access token' that an off-chain service issues so a specific account can call a specific contract function with specific arguments, verified on-chain.","ja":"オフチェーンのサービスが発行する、EIP-712 署名付きの短命な「アクセストークン」を定義する。特定のアカウントが特定のコントラクト関数を特定の引数で呼び出せることを、オンチェーンで検証する。","ko":"오프체인 서비스가 발급하는 EIP-712 서명 기반의 단기 \"액세스 토큰\"을 정의한다. 특정 계정이 특정 컨트랙트 함수를 특정 인자로 호출할 수 있음을 온체인에서 검증한다.","zh":"定义一种由链下服务签发、带 EIP-712 签名的短期\"访问令牌\"，使特定账户能以特定参数调用特定合约函数，并在链上验证。"},"tags":["access-control","signatures","eip-712","authorization"],"explainers":{"en":{"lang":"en","tldr":"Defines an EIP-712 signed, short-lived 'access token' that an off-chain service issues so a specific account can call a specific contract function with specific arguments, verified on-chain.","tags":["access-control","signatures","eip-712","authorization"],"related":[712,4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7272/","markdown":"## What problem does it solve?\n\nSome on-chain actions should only be allowed after an off-chain check: KYC or compliance status, holding a verifiable credential, passing an eligibility test. The usual on-chain options are awkward. Role lists and soulbound tokens must be kept up to date by whoever runs the registry, and storing the underlying data on-chain can leak personal information.\n\nAn Ethereum Access Token (EAT) works like a JSON Web Token for smart contracts. The user asks an off-chain service for permission, the service runs whatever checks it wants, and if the user passes it signs a narrowly scoped, expiring authorization. The user then sends that signature along with the transaction, and the contract verifies it with `ecrecover`. No personal data goes on-chain, and the issuer can change its criteria without redeploying anything.\n\n## How it works\n\nThe issuer signs an [EIP-712](/eip-712/) typed-data payload:\n\n```\nAccessToken  { uint256 expiry; FunctionCall functionCall; }\nFunctionCall { bytes4 functionSignature; address target; address caller; bytes parameters; }\n```\n\nWhat the token is bound to:\n\n- **functionSignature**: must match `msg.sig`, so it cannot be used on another function.\n- **target**: the contract being called.\n- **caller**: must match `msg.sender`, so nobody else can use it.\n- **parameters**: the rest of the calldata (everything after the EAT fields), so the arguments cannot be changed.\n- **expiry**: a Unix timestamp after which the token is no longer valid.\n\nThe gated function takes the signature (`v`, `r`, `s`) and `expiry` as its first arguments. The reference design splits the work in two: an `AccessTokenVerifier` rebuilds the EIP-712 digest, checks expiry, recovers the signer and checks it against the trusted issuers; an `AccessTokenConsumer` base contract provides a modifier that calls the verifier and, in the reference implementation, marks the token as used so it cannot be replayed.\n\n## Sample code\n\nIssuing an EAT off-chain with ethers v6 (domain values are placeholders for your verifier's):\n\n```ts\nimport { Wallet, AbiCoder } from \"ethers\";\n\nconst issuer = new Wallet(process.env.ISSUER_KEY!);\n\nconst domain = { name: \"Ethereum Access Token\", version: \"1\", chainId: 1, verifyingContract: verifierAddress };\nconst types = {\n  AccessToken: [\n    { name: \"expiry\", type: \"uint256\" },\n    { name: \"functionCall\", type: \"FunctionCall\" },\n  ],\n  FunctionCall: [\n    { name: \"functionSignature\", type: \"bytes4\" },\n    { name: \"target\", type: \"address\" },\n    { name: \"caller\", type: \"address\" },\n    { name: \"parameters\", type: \"bytes\" },\n  ],\n};\n\nconst expiry = Math.floor(Date.now() / 1000) + 300; // valid for 5 minutes\nconst parameters = AbiCoder.defaultAbiCoder().encode([\"address\", \"uint256\"], [user, 1n]);\n\nconst sig = await issuer.signTypedData(domain, types, {\n  expiry,\n  functionCall: { functionSignature: mintSelector, target: gatedContract, caller: user, parameters },\n});\n// The user then calls gated.mint(v, r, s, expiry, user, 1)\n```\n\n## Things to know\n\n- Status is **Draft**.\n- Security rests entirely on the off-chain issuer. If its signing key or checks are compromised, attackers can mint valid tokens.\n- Replay protection is optional in the spec (the reference implementation consumes tokens on use). Pick expiry windows carefully: too long increases misuse risk, too short hurts usability.\n- Any function can be gated except `receive` and `fallback`.\n- The spec text describes `expiry` as \"expected to be before `block.timestamp`\"; the intended meaning, and what the reference verifier checks, is that the token has not yet expired.\n- For signing in to off-chain apps (the reverse direction), see [ERC-4361](/eip-4361/) Sign-In with Ethereum.\n"},"ja":{"lang":"ja","tldr":"オフチェーンのサービスが発行する、EIP-712 署名付きの短命な「アクセストークン」を定義する。特定のアカウントが特定のコントラクト関数を特定の引数で呼び出せることを、オンチェーンで検証する。","tags":["access-control","signatures","eip-712","authorization"],"related":[712,4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7272/","markdown":"## 何を解決するのか\n\nオンチェーンの操作の中には、オフチェーンでの確認を済ませた後にのみ許可すべきものがあります。KYC やコンプライアンスの状況、検証可能なクレデンシャルの保有、適格性テストの合格などです。オンチェーンでの一般的な方法は使いにくいものです。ロールのリストやソウルバウンドトークンは、レジストリの運営者が最新に保つ必要があり、元になるデータをオンチェーンに保存すると個人情報が漏れる可能性があります。\n\nEthereum Access Token（EAT）は、スマートコントラクト向けの JSON Web Token のように機能します。ユーザーがオフチェーンのサービスに許可を求め、サービスは任意の確認を行い、合格すればユーザーに対して、範囲が絞られ有効期限のある認可に署名します。ユーザーはその署名をトランザクションと一緒に送り、コントラクトが `ecrecover` で検証します。個人データはオンチェーンに載らず、発行者は何も再デプロイせずに基準を変更できます。\n\n## 仕組み\n\n発行者は [EIP-712](/eip-712/) の型付きデータペイロードに署名します。\n\n```\nAccessToken  { uint256 expiry; FunctionCall functionCall; }\nFunctionCall { bytes4 functionSignature; address target; address caller; bytes parameters; }\n```\n\nトークンが紐づけられる対象:\n\n- **functionSignature**: `msg.sig` と一致する必要があり、別の関数では使えません。\n- **target**: 呼び出される対象のコントラクト。\n- **caller**: `msg.sender` と一致する必要があり、他の人は使えません。\n- **parameters**: calldata の残り部分（EAT のフィールド以降のすべて）。引数を変更できません。\n- **expiry**: これを過ぎるとトークンが無効になる Unix タイムスタンプ。\n\nゲートされる関数は、最初の引数として署名（`v`、`r`、`s`）と `expiry` を受け取ります。リファレンス設計では作業が 2 つに分かれています。`AccessTokenVerifier` は EIP-712 のダイジェストを再構築し、有効期限を確認し、署名者を復元して信頼された発行者と照合します。`AccessTokenConsumer` 基底コントラクトは、verifier を呼ぶ modifier を提供し、リファレンス実装ではトークンを使用済みにしてリプレイできないようにします。\n\n## サンプルコード\n\nethers v6 でオフチェーンで EAT を発行する例です（ドメインの値は、あなたの verifier に合わせたプレースホルダーです）。\n\n```ts\nimport { Wallet, AbiCoder } from \"ethers\";\n\nconst issuer = new Wallet(process.env.ISSUER_KEY!);\n\nconst domain = { name: \"Ethereum Access Token\", version: \"1\", chainId: 1, verifyingContract: verifierAddress };\nconst types = {\n  AccessToken: [\n    { name: \"expiry\", type: \"uint256\" },\n    { name: \"functionCall\", type: \"FunctionCall\" },\n  ],\n  FunctionCall: [\n    { name: \"functionSignature\", type: \"bytes4\" },\n    { name: \"target\", type: \"address\" },\n    { name: \"caller\", type: \"address\" },\n    { name: \"parameters\", type: \"bytes\" },\n  ],\n};\n\nconst expiry = Math.floor(Date.now() / 1000) + 300; // valid for 5 minutes\nconst parameters = AbiCoder.defaultAbiCoder().encode([\"address\", \"uint256\"], [user, 1n]);\n\nconst sig = await issuer.signTypedData(domain, types, {\n  expiry,\n  functionCall: { functionSignature: mintSelector, target: gatedContract, caller: user, parameters },\n});\n// The user then calls gated.mint(v, r, s, expiry, user, 1)\n```\n\n## 知っておくべきこと\n\n- ステータスは **Draft** です。\n- セキュリティは完全にオフチェーンの発行者に依存します。署名鍵や確認処理が侵害されると、攻撃者が有効なトークンを発行できてしまいます。\n- リプレイ防止は仕様上は任意です（リファレンス実装は使用時にトークンを消費します）。有効期限は慎重に選んでください。長すぎると悪用のリスクが高まり、短すぎると使い勝手が悪くなります。\n- `receive` と `fallback` を除き、どの関数でもゲートできます。\n- 仕様の文章では `expiry` を「`block.timestamp` より前であることが期待される」と説明していますが、意図された意味、およびリファレンスの verifier が確認する内容は、トークンがまだ期限切れになっていないということです。\n- オフチェーンアプリへのサインイン（逆方向）については、[ERC-4361](/eip-4361/) の Sign-In with Ethereum を参照してください。\n"},"ko":{"lang":"ko","tldr":"오프체인 서비스가 발급하는 EIP-712 서명 기반의 단기 \"액세스 토큰\"을 정의한다. 특정 계정이 특정 컨트랙트 함수를 특정 인자로 호출할 수 있음을 온체인에서 검증한다.","tags":["access-control","signatures","eip-712","authorization"],"related":[712,4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7272/","markdown":"## 어떤 문제를 해결하나요?\n\n일부 온체인 동작은 오프체인 확인을 거친 뒤에만 허용되어야 합니다. KYC나 컴플라이언스 상태, 검증 가능한 크리덴셜 보유, 자격 테스트 통과 같은 것들입니다. 일반적인 온체인 방식은 불편합니다. 역할 목록이나 소울바운드 토큰은 레지스트리 운영자가 계속 최신 상태로 유지해야 하고, 기반 데이터를 온체인에 저장하면 개인정보가 유출될 수 있습니다.\n\nEthereum Access Token(EAT)은 스마트 컨트랙트용 JSON Web Token처럼 동작합니다. 사용자가 오프체인 서비스에 허가를 요청하면 서비스가 원하는 검사를 수행하고, 사용자가 통과하면 범위가 좁고 만료되는 인가에 서명합니다. 사용자는 그 서명을 트랜잭션과 함께 보내고, 컨트랙트가 `ecrecover`로 검증합니다. 개인 데이터는 온체인에 올라가지 않으며, 발급자는 아무것도 재배포하지 않고도 기준을 바꿀 수 있습니다.\n\n## 어떻게 동작하나요?\n\n발급자는 [EIP-712](/eip-712/) 타입 데이터 페이로드에 서명합니다.\n\n```\nAccessToken  { uint256 expiry; FunctionCall functionCall; }\nFunctionCall { bytes4 functionSignature; address target; address caller; bytes parameters; }\n```\n\n토큰이 묶이는 대상은 다음과 같습니다.\n\n- **functionSignature**: `msg.sig`와 일치해야 하므로 다른 함수에는 쓸 수 없습니다.\n- **target**: 호출되는 컨트랙트.\n- **caller**: `msg.sender`와 일치해야 하므로 다른 사람이 쓸 수 없습니다.\n- **parameters**: calldata의 나머지(EAT 필드 이후의 전부)이므로 인자를 바꿀 수 없습니다.\n- **expiry**: 이 시각이 지나면 토큰이 더 이상 유효하지 않은 Unix 타임스탬프.\n\n게이트가 걸린 함수는 서명(`v`, `r`, `s`)과 `expiry`를 첫 번째 인자로 받습니다. 참조 설계는 작업을 둘로 나눕니다. `AccessTokenVerifier`는 EIP-712 다이제스트를 다시 만들고, 만료를 확인하고, 서명자를 복구해 신뢰하는 발급자와 대조합니다. `AccessTokenConsumer` 기본 컨트랙트는 verifier를 호출하는 modifier를 제공하며, 참조 구현에서는 토큰을 사용 처리해 재사용(리플레이)할 수 없게 합니다.\n\n## 샘플 코드\n\nethers v6로 오프체인에서 EAT를 발급하는 예시입니다(domain 값은 여러분의 verifier에 맞춰야 하는 자리 표시자입니다).\n\n```ts\nimport { Wallet, AbiCoder } from \"ethers\";\n\nconst issuer = new Wallet(process.env.ISSUER_KEY!);\n\nconst domain = { name: \"Ethereum Access Token\", version: \"1\", chainId: 1, verifyingContract: verifierAddress };\nconst types = {\n  AccessToken: [\n    { name: \"expiry\", type: \"uint256\" },\n    { name: \"functionCall\", type: \"FunctionCall\" },\n  ],\n  FunctionCall: [\n    { name: \"functionSignature\", type: \"bytes4\" },\n    { name: \"target\", type: \"address\" },\n    { name: \"caller\", type: \"address\" },\n    { name: \"parameters\", type: \"bytes\" },\n  ],\n};\n\nconst expiry = Math.floor(Date.now() / 1000) + 300; // valid for 5 minutes\nconst parameters = AbiCoder.defaultAbiCoder().encode([\"address\", \"uint256\"], [user, 1n]);\n\nconst sig = await issuer.signTypedData(domain, types, {\n  expiry,\n  functionCall: { functionSignature: mintSelector, target: gatedContract, caller: user, parameters },\n});\n// The user then calls gated.mint(v, r, s, expiry, user, 1)\n```\n\n## 알아둘 점\n\n- 상태는 **Draft**입니다.\n- 보안은 전적으로 오프체인 발급자에게 달려 있습니다. 서명 키나 검사 과정이 침해되면 공격자가 유효한 토큰을 만들 수 있습니다.\n- 명세에서 리플레이 방지는 선택 사항입니다(참조 구현은 사용 시 토큰을 소모합니다). 만료 기간을 신중하게 고르세요. 너무 길면 오남용 위험이 커지고 너무 짧으면 사용성이 나빠집니다.\n- `receive`와 `fallback`을 제외한 모든 함수에 게이트를 걸 수 있습니다.\n- 명세 본문은 `expiry`를 \"`block.timestamp`보다 이전이어야 한다\"고 설명하지만, 의도된 의미와 참조 verifier가 확인하는 것은 토큰이 아직 만료되지 않았다는 것입니다.\n- 오프체인 앱에 로그인하는 경우(반대 방향)는 [ERC-4361](/eip-4361/) Sign-In with Ethereum을 참고하세요.\n"},"zh":{"lang":"zh","tldr":"定义一种由链下服务签发、带 EIP-712 签名的短期\"访问令牌\"，使特定账户能以特定参数调用特定合约函数，并在链上验证。","tags":["access-control","signatures","eip-712","authorization"],"related":[712,4361],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7272/","markdown":"## 它解决什么问题？\n\n有些链上操作应当在通过链下检查之后才允许：KYC 或合规状态、持有可验证凭证、通过资格测试。常见的链上方案都不太顺手。角色列表和灵魂绑定代币必须由注册表的运营方保持更新，而把底层数据存放在链上可能泄露个人信息。\n\n以太坊访问令牌（Ethereum Access Token，EAT）的作用类似于智能合约版的 JSON Web Token。用户向链下服务申请许可，服务执行它想要的任何检查，如果用户通过，就签署一份范围狭窄、会过期的授权。用户随后把该签名连同交易一起发送，合约用 `ecrecover` 验证。个人数据不会上链，签发方也可以在不重新部署任何东西的情况下修改其标准。\n\n## 它如何运作\n\n签发方对一个 [EIP-712](/eip-712/) 类型化数据载荷进行签名：\n\n```\nAccessToken  { uint256 expiry; FunctionCall functionCall; }\nFunctionCall { bytes4 functionSignature; address target; address caller; bytes parameters; }\n```\n\n令牌所绑定的内容：\n\n- **functionSignature**：必须与 `msg.sig` 匹配，因此不能用于其他函数。\n- **target**：被调用的合约。\n- **caller**：必须与 `msg.sender` 匹配，因此其他人无法使用。\n- **parameters**：calldata 的其余部分（EAT 字段之后的全部内容），因此参数无法被更改。\n- **expiry**：Unix 时间戳，超过之后令牌不再有效。\n\n被保护的函数把签名（`v`、`r`、`s`）和 `expiry` 作为前几个参数。参考设计把工作分成两部分：`AccessTokenVerifier` 重建 EIP-712 摘要、检查过期时间、恢复签名者并与受信任的签发方核对；`AccessTokenConsumer` 基础合约提供一个 modifier 来调用 verifier，并且在参考实现中把令牌标记为已使用，使其无法被重放。\n\n## 示例代码\n\n使用 ethers v6 在链下签发 EAT（domain 的值是占位符，应换成你的 verifier 的值）：\n\n```ts\nimport { Wallet, AbiCoder } from \"ethers\";\n\nconst issuer = new Wallet(process.env.ISSUER_KEY!);\n\nconst domain = { name: \"Ethereum Access Token\", version: \"1\", chainId: 1, verifyingContract: verifierAddress };\nconst types = {\n  AccessToken: [\n    { name: \"expiry\", type: \"uint256\" },\n    { name: \"functionCall\", type: \"FunctionCall\" },\n  ],\n  FunctionCall: [\n    { name: \"functionSignature\", type: \"bytes4\" },\n    { name: \"target\", type: \"address\" },\n    { name: \"caller\", type: \"address\" },\n    { name: \"parameters\", type: \"bytes\" },\n  ],\n};\n\nconst expiry = Math.floor(Date.now() / 1000) + 300; // valid for 5 minutes\nconst parameters = AbiCoder.defaultAbiCoder().encode([\"address\", \"uint256\"], [user, 1n]);\n\nconst sig = await issuer.signTypedData(domain, types, {\n  expiry,\n  functionCall: { functionSignature: mintSelector, target: gatedContract, caller: user, parameters },\n});\n// The user then calls gated.mint(v, r, s, expiry, user, 1)\n```\n\n## 需要注意\n\n- 状态为 **Draft**。\n- 安全性完全取决于链下签发方。如果其签名密钥或检查流程被攻破，攻击者就能铸造有效的令牌。\n- 规范中重放保护是可选的（参考实现会在使用时消耗令牌）。请谨慎选择过期时间窗口：太长会增加被滥用的风险，太短则影响可用性。\n- 除 `receive` 和 `fallback` 外，任何函数都可以被保护。\n- 规范文本把 `expiry` 描述为\"应早于 `block.timestamp`\"；其本意，以及参考 verifier 实际检查的是，令牌尚未过期。\n- 关于登录链下应用（相反的方向），请参阅 [ERC-4361](/eip-4361/) 的 Sign-In with Ethereum。\n"}}}
