{"eip":5639,"title":"Delegation Registry","description":"Delegation of permissions for safer and more convenient signing operations.","authors":["foobar (@0xfoobar)","Wilkins Chung (@wwhchung) \u003cwilkins@manifold.xyz\u003e","ryley-o (@ryley-o)","Jake Rockland (@jakerockland)","andy8052 (@andy8052)"],"status":"Review","type":"Standards Track","category":"ERC","created":"2022-09-09","discussionsTo":"https://ethereum-magicians.org/t/eip-5639-delegation-registry/10949","repo":"ERCs","label":"ERC-5639","officialUrl":"https://eips.ethereum.org/EIPS/eip-5639","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-5639.md","url":"https://eips.huatuo.xyz/eip-5639/","tldr":{"en":"An on-chain registry where a cold \"vault\" wallet can name hot \"delegate\" wallets that may prove ownership on its behalf, so you never have to connect your valuable wallet to a dApp.","ja":"コールドな「ボールト」ウォレットが、代わりに所有を証明できるホットな「デリゲート」ウォレットを指名できるオンチェーンのレジストリ。価値のあるウォレットを dApp に接続せずに済む。","ko":"콜드 \"볼트\" 지갑이 자신을 대신해 소유를 증명할 수 있는 핫 \"위임\" 지갑을 지정할 수 있는 온체인 레지스트리. 가치 있는 지갑을 dApp에 연결할 필요가 없어진다.","zh":"一个链上注册表，冷的“金库”钱包可以在其中指定热的“代理”钱包代表它证明所有权，这样你就无需把自己贵重的钱包连接到 dApp。"},"tags":["delegation","registry","security","nft","wallet"],"explainers":{"en":{"lang":"en","tldr":"An on-chain registry where a cold \"vault\" wallet can name hot \"delegate\" wallets that may prove ownership on its behalf, so you never have to connect your valuable wallet to a dApp.","tags":["delegation","registry","security","nft","wallet"],"related":[721,1155,4361,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-5639/","markdown":"## What problem does it solve?\n\nMany dApps ask you to sign a message or send a transaction from the wallet that holds an asset: to claim an airdrop, enter a token-gated site, edit a marketplace profile or prove you own an NFT. These actions are essentially \"read only\", yet they force you to use the wallet with full write access to your assets. If that wallet is a hardware wallet or multisig it is inconvenient; if you sign a malicious payload by mistake, you can lose everything in it.\n\nERC-5639 proposes a shared Delegation Registry. The valuable **vault** wallet records, once, which **delegate** wallets may act for it. Apps then check the registry and accept the delegate (a hot wallet holding little or nothing) as proof of the vault's ownership.\n\n## How it works\n\nThe vault calls the registry to grant delegation at one of three levels:\n\n| Level | Write function | Meaning |\n| --- | --- | --- |\n| All | `delegateForAll(delegate, value)` | Delegate may act for the whole vault |\n| Contract | `delegateForContract(delegate, contract_, value)` | Only for assets of one contract |\n| Token | `delegateForToken(delegate, contract_, tokenId, value)` | Only for one specific token |\n\n`value = true` grants, `false` revokes. The vault can also call `revokeAllDelegates()` or `revokeDelegate(delegate)`, and a delegate can drop itself with `revokeSelf(vault)`. Each change emits an event (`DelegateForAll`, `DelegateForContract`, `DelegateForToken`, `RevokeAllDelegates`, `RevokeDelegate`).\n\nChecks are hierarchical: `checkDelegateForToken` returns true if the delegate has token-, contract- or vault-level rights; `checkDelegateForContract` accepts contract- or vault-level rights. The registry also supports on-chain enumeration (`getDelegationsByDelegate`, `getDelegatesForAll`, `getContractLevelDelegations`, …) so a frontend can show a connected hot wallet which vaults it can speak for.\n\nDelegation can be chained in practice: a delegate may itself have delegates, and revoking at the root cuts off the whole tree.\n\n## Sample code\n\nA claim contract that lets a delegate claim on behalf of an NFT holder:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IDelegationRegistry {\n    function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)\n        external view returns (bool);\n}\n\ninterface IERC721 {\n    function ownerOf(uint256 tokenId) external view returns (address);\n}\n\ncontract DelegatedClaim {\n    IDelegationRegistry public immutable registry;\n    IERC721 public immutable nft;\n    mapping(uint256 =\u003e bool) public claimed;\n\n    constructor(IDelegationRegistry r, IERC721 n) { registry = r; nft = n; }\n\n    /// Caller is either the vault itself or a delegate of the vault.\n    function claim(uint256 tokenId, address vault) external {\n        require(nft.ownerOf(tokenId) == vault, \"not owner\");\n        if (msg.sender != vault) {\n            require(\n                registry.checkDelegateForToken(msg.sender, vault, address(nft), tokenId),\n                \"not delegate\"\n            );\n        }\n        require(!claimed[tokenId], \"claimed\");\n        claimed[tokenId] = true;\n        // send the reward to `vault`, not to msg.sender\n    }\n}\n```\n\n## Things to know\n\n- Status is **Review**: the interface may still change. Use the exact ABI of whichever deployed registry you integrate with.\n- The registry only answers \"is this address allowed to speak for that vault?\". It never moves assets. Your contract decides what a delegate may do, and should usually send rewards to the vault, not the delegate.\n- The spec suggests the dApp pass a hint about which delegation level applies, so the contract can call the cheapest check function.\n- For off-chain logins, combine a delegate's [Sign-In with Ethereum](/eip-4361/) signature with a registry lookup; contract wallets as vaults may also need [ERC-1271](/eip-1271/) signature checks.\n- Delegation is only as safe as the delegate key for the actions an app chooses to accept. Revoke unused delegates.\n"},"ja":{"lang":"ja","tldr":"コールドな「ボールト」ウォレットが、代わりに所有を証明できるホットな「デリゲート」ウォレットを指名できるオンチェーンのレジストリ。価値のあるウォレットを dApp に接続せずに済む。","tags":["delegation","registry","security","nft","wallet"],"related":[721,1155,4361,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-5639/","markdown":"## 何を解決するのか\n\n多くの dApp は、エアドロップの請求、トークンゲート付きサイトへの入場、マーケットプレイスのプロフィール編集、NFT の所有証明などのために、資産を保有するウォレットからメッセージへの署名やトランザクションの送信を求めます。これらの操作は本質的に「読み取り専用」なのに、資産への完全な書き込み権限を持つウォレットを使うことを強いられます。そのウォレットがハードウェアウォレットやマルチシグなら不便ですし、誤って悪意のあるペイロードに署名すれば、中身をすべて失いかねません。\n\nERC-5639 は、共有の Delegation Registry を提案しています。価値のある**ボールト**ウォレットが、どの**デリゲート**ウォレットが自分の代わりに動作できるかを 1 回だけ記録します。アプリはレジストリを確認し、デリゲート（ほとんど、あるいはまったく資産を持たないホットウォレット）を、ボールトの所有の証明として受け入れます。\n\n## 仕組み\n\nボールトはレジストリを呼び出し、3 つのレベルのいずれかで委任を付与します。\n\n| レベル | 書き込み関数 | 意味 |\n| --- | --- | --- |\n| All | `delegateForAll(delegate, value)` | デリゲートがボールト全体の代わりに動作できる |\n| Contract | `delegateForContract(delegate, contract_, value)` | 1 つのコントラクトの資産に限る |\n| Token | `delegateForToken(delegate, contract_, tokenId, value)` | 特定の 1 つのトークンに限る |\n\n`value = true` で付与、`false` で取り消しです。ボールトは `revokeAllDelegates()` や `revokeDelegate(delegate)` も呼べ、デリゲートは `revokeSelf(vault)` で自分自身を外せます。変更のたびにイベント（`DelegateForAll`、`DelegateForContract`、`DelegateForToken`、`RevokeAllDelegates`、`RevokeDelegate`）が emit されます。\n\nチェックは階層的です。`checkDelegateForToken` は、デリゲートがトークン、コントラクト、ボールトのいずれかのレベルの権利を持っていれば true を返し、`checkDelegateForContract` はコントラクトまたはボールトレベルの権利を受け入れます。レジストリはオンチェーンでの列挙（`getDelegationsByDelegate`、`getDelegatesForAll`、`getContractLevelDelegations` など）もサポートしており、フロントエンドは接続されたホットウォレットに、どのボールトの代理ができるかを表示できます。\n\n委任は実際には連鎖させることもできます。デリゲート自身がデリゲートを持つことができ、ルートで取り消せばツリー全体が遮断されます。\n\n## サンプルコード\n\nデリゲートが NFT 保有者の代わりに請求できるようにする請求コントラクト:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IDelegationRegistry {\n    function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)\n        external view returns (bool);\n}\n\ninterface IERC721 {\n    function ownerOf(uint256 tokenId) external view returns (address);\n}\n\ncontract DelegatedClaim {\n    IDelegationRegistry public immutable registry;\n    IERC721 public immutable nft;\n    mapping(uint256 =\u003e bool) public claimed;\n\n    constructor(IDelegationRegistry r, IERC721 n) { registry = r; nft = n; }\n\n    /// Caller is either the vault itself or a delegate of the vault.\n    function claim(uint256 tokenId, address vault) external {\n        require(nft.ownerOf(tokenId) == vault, \"not owner\");\n        if (msg.sender != vault) {\n            require(\n                registry.checkDelegateForToken(msg.sender, vault, address(nft), tokenId),\n                \"not delegate\"\n            );\n        }\n        require(!claimed[tokenId], \"claimed\");\n        claimed[tokenId] = true;\n        // send the reward to `vault`, not to msg.sender\n    }\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Review** です。インターフェースはまだ変更される可能性があります。統合するデプロイ済みレジストリの正確な ABI を使ってください。\n- レジストリが答えるのは「このアドレスはそのボールトの代理を務めてよいか」だけです。資産を動かすことはありません。デリゲートに何を許すかはあなたのコントラクトが決め、通常は報酬をデリゲートではなくボールトに送るべきです。\n- 仕様は、dApp がどの委任レベルが当てはまるかのヒントを渡し、コントラクトが最も安価なチェック関数を呼べるようにすることを提案しています。\n- オフチェーンのログインでは、デリゲートの [Sign-In with Ethereum](/eip-4361/) 署名とレジストリの照会を組み合わせます。ボールトがコントラクトウォレットの場合は、[ERC-1271](/eip-1271/) の署名チェックも必要になることがあります。\n- 委任の安全性は、アプリが受け入れると決めた操作に対するデリゲート鍵の安全性に左右されます。使っていないデリゲートは取り消してください。\n"},"ko":{"lang":"ko","tldr":"콜드 \"볼트\" 지갑이 자신을 대신해 소유를 증명할 수 있는 핫 \"위임\" 지갑을 지정할 수 있는 온체인 레지스트리. 가치 있는 지갑을 dApp에 연결할 필요가 없어진다.","tags":["delegation","registry","security","nft","wallet"],"related":[721,1155,4361,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-5639/","markdown":"## 어떤 문제를 해결하나요?\n\n많은 dApp은 에어드롭 수령, 토큰 게이트 사이트 입장, 마켓플레이스 프로필 편집, NFT 소유 증명 등을 위해 자산을 보유한 지갑으로 메시지에 서명하거나 트랜잭션을 보내라고 요구합니다. 이런 동작은 본질적으로 \"읽기 전용\"인데도 자산에 대한 전체 쓰기 권한을 가진 지갑을 사용하도록 강제합니다. 그 지갑이 하드웨어 지갑이나 멀티시그라면 불편하고, 실수로 악성 페이로드에 서명하면 안에 든 모든 것을 잃을 수 있습니다.\n\nERC-5639는 공유 Delegation Registry를 제안합니다. 가치 있는 **볼트(vault)** 지갑이 어떤 **위임(delegate)** 지갑이 자신을 대신해 동작할 수 있는지 한 번만 기록합니다. 그러면 앱은 레지스트리를 확인하고, 위임 지갑(자산이 거의 없거나 전혀 없는 핫 지갑)을 볼트 소유의 증명으로 받아들입니다.\n\n## 어떻게 동작하나요?\n\n볼트는 레지스트리를 호출해 세 가지 수준 중 하나로 위임을 부여합니다.\n\n| 수준 | 쓰기 함수 | 의미 |\n| --- | --- | --- |\n| All | `delegateForAll(delegate, value)` | 위임 지갑이 볼트 전체를 대신해 동작할 수 있음 |\n| Contract | `delegateForContract(delegate, contract_, value)` | 한 컨트랙트의 자산에 한정 |\n| Token | `delegateForToken(delegate, contract_, tokenId, value)` | 특정한 토큰 하나에 한정 |\n\n`value = true`는 부여, `false`는 철회입니다. 볼트는 `revokeAllDelegates()`나 `revokeDelegate(delegate)`도 호출할 수 있고, 위임 지갑은 `revokeSelf(vault)`로 스스로를 제거할 수 있습니다. 변경이 있을 때마다 이벤트(`DelegateForAll`, `DelegateForContract`, `DelegateForToken`, `RevokeAllDelegates`, `RevokeDelegate`)가 emit됩니다.\n\n검사는 계층적입니다. `checkDelegateForToken`은 위임 지갑이 토큰, 컨트랙트, 볼트 수준의 권한 중 하나라도 있으면 true를 반환하고, `checkDelegateForContract`는 컨트랙트 또는 볼트 수준의 권한을 받아들입니다. 레지스트리는 온체인 열거(`getDelegationsByDelegate`, `getDelegatesForAll`, `getContractLevelDelegations` 등)도 지원하므로, 프런트엔드는 연결된 핫 지갑이 어떤 볼트를 대변할 수 있는지 보여 줄 수 있습니다.\n\n실제로는 위임을 연쇄할 수 있습니다. 위임 지갑 자신도 위임 지갑을 둘 수 있고, 루트에서 철회하면 트리 전체가 끊깁니다.\n\n## 샘플 코드\n\n위임 지갑이 NFT 보유자를 대신해 수령할 수 있게 하는 수령 컨트랙트:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IDelegationRegistry {\n    function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)\n        external view returns (bool);\n}\n\ninterface IERC721 {\n    function ownerOf(uint256 tokenId) external view returns (address);\n}\n\ncontract DelegatedClaim {\n    IDelegationRegistry public immutable registry;\n    IERC721 public immutable nft;\n    mapping(uint256 =\u003e bool) public claimed;\n\n    constructor(IDelegationRegistry r, IERC721 n) { registry = r; nft = n; }\n\n    /// Caller is either the vault itself or a delegate of the vault.\n    function claim(uint256 tokenId, address vault) external {\n        require(nft.ownerOf(tokenId) == vault, \"not owner\");\n        if (msg.sender != vault) {\n            require(\n                registry.checkDelegateForToken(msg.sender, vault, address(nft), tokenId),\n                \"not delegate\"\n            );\n        }\n        require(!claimed[tokenId], \"claimed\");\n        claimed[tokenId] = true;\n        // send the reward to `vault`, not to msg.sender\n    }\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Review**입니다. 인터페이스는 아직 바뀔 수 있습니다. 연동하는 배포된 레지스트리의 정확한 ABI를 사용하세요.\n- 레지스트리는 \"이 주소가 그 볼트를 대변해도 되는가?\"에만 답합니다. 자산을 옮기지는 않습니다. 위임 지갑이 무엇을 할 수 있는지는 여러분의 컨트랙트가 결정하며, 보통 보상은 위임 지갑이 아니라 볼트로 보내야 합니다.\n- 스펙은 dApp이 어떤 위임 수준이 적용되는지 힌트를 전달해, 컨트랙트가 가장 저렴한 검사 함수를 호출할 수 있게 할 것을 제안합니다.\n- 오프체인 로그인에서는 위임 지갑의 [Sign-In with Ethereum](/eip-4361/) 서명과 레지스트리 조회를 결합하세요. 볼트가 컨트랙트 지갑이라면 [ERC-1271](/eip-1271/) 서명 검사도 필요할 수 있습니다.\n- 위임의 안전성은 앱이 수락하기로 한 동작에 대해 위임 키가 얼마나 안전한가에 달려 있습니다. 쓰지 않는 위임 지갑은 철회하세요.\n"},"zh":{"lang":"zh","tldr":"一个链上注册表，冷的“金库”钱包可以在其中指定热的“代理”钱包代表它证明所有权，这样你就无需把自己贵重的钱包连接到 dApp。","tags":["delegation","registry","security","nft","wallet"],"related":[721,1155,4361,1271],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-5639/","markdown":"## 它解决什么问题？\n\n许多 dApp 会要求你用持有资产的钱包签署消息或发送交易：用于领取空投、进入代币门控网站、编辑市场个人资料或证明你拥有某个 NFT。这些操作本质上是\"只读\"的，却迫使你使用对资产拥有完整写权限的钱包。如果那个钱包是硬件钱包或多签钱包，会很不方便；如果你不小心签了恶意载荷，里面的一切都可能丢失。\n\nERC-5639 提出了一个共享的 Delegation Registry。贵重的**金库**（vault）钱包只需记录一次，哪些**代理**（delegate）钱包可以代表它行事。之后应用检查注册表，并接受代理（一个几乎不持有或完全不持有资产的热钱包）作为金库所有权的证明。\n\n## 它如何运作\n\n金库调用注册表，按三个级别之一授予委托：\n\n| 级别 | 写入函数 | 含义 |\n| --- | --- | --- |\n| All | `delegateForAll(delegate, value)` | 代理可代表整个金库行事 |\n| Contract | `delegateForContract(delegate, contract_, value)` | 仅限某一个合约的资产 |\n| Token | `delegateForToken(delegate, contract_, tokenId, value)` | 仅限某一个具体代币 |\n\n`value = true` 表示授予，`false` 表示撤销。金库还可以调用 `revokeAllDelegates()` 或 `revokeDelegate(delegate)`，代理也可以用 `revokeSelf(vault)` 撤掉自己。每次变更都会触发一个事件（`DelegateForAll`、`DelegateForContract`、`DelegateForToken`、`RevokeAllDelegates`、`RevokeDelegate`）。\n\n检查是分层的：如果代理拥有代币级、合约级或金库级权限，`checkDelegateForToken` 返回 true；`checkDelegateForContract` 接受合约级或金库级权限。注册表还支持链上枚举（`getDelegationsByDelegate`、`getDelegatesForAll`、`getContractLevelDelegations` 等），因此前端可以向已连接的热钱包显示它能代表哪些金库发言。\n\n在实践中，委托可以串联：代理本身也可以有代理，在根上撤销就会切断整棵树。\n\n## 示例代码\n\n一个允许代理代表 NFT 持有者领取的领取合约：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\ninterface IDelegationRegistry {\n    function checkDelegateForToken(address delegate, address vault, address contract_, uint256 tokenId)\n        external view returns (bool);\n}\n\ninterface IERC721 {\n    function ownerOf(uint256 tokenId) external view returns (address);\n}\n\ncontract DelegatedClaim {\n    IDelegationRegistry public immutable registry;\n    IERC721 public immutable nft;\n    mapping(uint256 =\u003e bool) public claimed;\n\n    constructor(IDelegationRegistry r, IERC721 n) { registry = r; nft = n; }\n\n    /// Caller is either the vault itself or a delegate of the vault.\n    function claim(uint256 tokenId, address vault) external {\n        require(nft.ownerOf(tokenId) == vault, \"not owner\");\n        if (msg.sender != vault) {\n            require(\n                registry.checkDelegateForToken(msg.sender, vault, address(nft), tokenId),\n                \"not delegate\"\n            );\n        }\n        require(!claimed[tokenId], \"claimed\");\n        claimed[tokenId] = true;\n        // send the reward to `vault`, not to msg.sender\n    }\n}\n```\n\n## 需要注意\n\n- 状态为 **Review**：接口仍可能变化。请使用你所集成的已部署注册表的确切 ABI。\n- 注册表只回答\"这个地址是否被允许代表那个金库发言？\"。它从不转移资产。代理能做什么由你的合约决定，并且通常应把奖励发送给金库，而不是代理。\n- 规范建议 dApp 传入一个提示，说明适用哪个委托级别，这样合约可以调用成本最低的检查函数。\n- 对于链下登录，可将代理的 [Sign-In with Ethereum](/eip-4361/) 签名与注册表查询结合使用；以合约钱包作为金库时，可能还需要 [ERC-1271](/eip-1271/) 签名检查。\n- 委托的安全性仅取决于应用选择接受的操作所对应的代理密钥的安全性。请撤销不用的代理。\n"}}}
