{"eip":7738,"title":"Permissionless Script Registry","description":"Permissionless registry to fetch executable scripts for contracts","authors":["Victor Zhang (@zhangzhongnan928)","James Brown (@JamesSmartCell)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2024-07-01","requires":[173],"discussionsTo":"https://ethereum-magicians.org/t/erc-7738-permissionless-script-registry/20503","repo":"ERCs","label":"ERC-7738","officialUrl":"https://eips.ethereum.org/EIPS/eip-7738","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7738.md","url":"https://eips.huatuo.xyz/eip-7738/","tldr":{"en":"A permissionless on-chain registry where anyone can publish script URIs for any contract, so wallets can find client-side scripts even for contracts that never implemented ERC-5169.","ja":"誰でも任意のコントラクトのスクリプト URI を登録できる、パーミッションレスなオンチェーンレジストリ。ERC-5169 を実装していないコントラクトでも、ウォレットがクライアントサイドのスクリプトを見つけられるようにする。","ko":"누구나 어떤 컨트랙트에 대해서든 스크립트 URI를 게시할 수 있는 허가 불필요(permissionless) 온체인 레지스트리. ERC-5169를 구현한 적 없는 컨트랙트라도 지갑이 클라이언트 측 스크립트를 찾을 수 있게 한다.","zh":"一个无需许可的链上注册表，任何人都可以为任意合约发布脚本 URI，使钱包即使面对从未实现 ERC-5169 的合约，也能找到客户端脚本。"},"tags":["registry","scripts","tokenscript","wallet","metadata"],"explainers":{"en":{"lang":"en","tldr":"A permissionless on-chain registry where anyone can publish script URIs for any contract, so wallets can find client-side scripts even for contracts that never implemented ERC-5169.","tags":["registry","scripts","tokenscript","wallet","metadata"],"related":[5169,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7738/","markdown":"## What problem does it solve?\n\n[ERC-5169](/eip-5169/) lets a token contract point to client-side scripts (for example TokenScript) that wallets and viewers can run to give the token a richer interface. But the contract must implement `scriptURI()` itself, at deploy time or via an upgrade. Most existing contracts never did, and many are not upgradeable.\n\nERC-7738 moves the lookup out of the token and into a separate registry contract. Anyone can register scripts for any contract address, and wallets query the registry instead of the token. The intent is a singleton deployed at the same address on many chains, so no central server or gatekeeper is needed.\n\n## How it works\n\nThe registry exposes two functions and one event:\n\n- `setScriptURI(contractAddress, string[] uris)`: anyone can call it. Entries are stored per (target contract, setter).\n- `scriptURI(contractAddress)`: returns all registered URIs for that contract.\n- `ScriptUpdate` event: emitted on every update so wallets can refresh cached scripts.\n\nBecause writing is permissionless, ordering matters. The registry **should return entries set by the target contract's [ERC-173](/eip-173/) `owner()` first**; simple wallets just take the first URI. The registry should also support paging when there are many entries.\n\nTrust is handled off-chain. A wallet fetching a script should verify its signature, ideally against the contract's `owner()`. If the contract is not `Ownable`, the spec suggests alternatives such as checking against the deployer key, a wallet-embedded keychain, or a governance-approved signer list.\n\n## Sample code\n\nThe interface from the spec:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7738 {\n    event ScriptUpdate(address indexed contractAddress, string[] newScriptURI);\n\n    function scriptURI(address contractAddress) external view returns (string[] memory);\n    function setScriptURI(address contractAddress, string[] memory scriptURIList) external;\n}\n```\n\nA wallet looking up scripts for a token (ethers v6):\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst registry = new Contract(REGISTRY_ADDRESS, [\n  \"function scriptURI(address) view returns (string[])\",\n], provider);\n\nconst uris: string[] = await registry.scriptURI(tokenAddress);\nconst preferred = uris[0]; // owner-set entries come first\n// fetch(preferred), then verify the script's signature before running it\n```\n\n## Things to know\n\n- **Status: Draft.**\n- Anyone can register a script for any contract, so a URI in the registry is not an endorsement. Never execute a script without verifying who signed it; on mainnet the spec advises caution when the signer cannot be authenticated.\n- The spec's simplified implementation emits `ScriptUpdate` with an extra `msg.sender` argument, which does not match the two-argument event in the interface. Check the event signature of the deployment you index.\n- The spec mentions a live deployment address; confirm it on each chain before relying on it.\n"},"ja":{"lang":"ja","tldr":"誰でも任意のコントラクトのスクリプト URI を登録できる、パーミッションレスなオンチェーンレジストリ。ERC-5169 を実装していないコントラクトでも、ウォレットがクライアントサイドのスクリプトを見つけられるようにする。","tags":["registry","scripts","tokenscript","wallet","metadata"],"related":[5169,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7738/","markdown":"## 何を解決するのか\n\n[ERC-5169](/eip-5169/) では、トークンコントラクトがクライアントサイドのスクリプト（たとえば TokenScript）を指し示し、ウォレットやビューアーがそれを実行してトークンに豊かなインターフェースを与えられます。しかしコントラクト自身が、デプロイ時またはアップグレードで `scriptURI()` を実装していなければなりません。既存のコントラクトの多くは実装しておらず、アップグレードできないものも多くあります。\n\nERC-7738 は、この参照をトークンから切り離して別のレジストリコントラクトに移します。誰でも任意のコントラクトアドレスのスクリプトを登録でき、ウォレットはトークンではなくレジストリに問い合わせます。多くのチェーンで同じアドレスにデプロイされるシングルトンを想定しており、中央のサーバーやゲートキーパーは不要です。\n\n## 仕組み\n\nレジストリは 2 つの関数と 1 つのイベントを公開します。\n\n- `setScriptURI(contractAddress, string[] uris)`: 誰でも呼べます。エントリーは（対象コントラクト、設定者）ごとに保存されます。\n- `scriptURI(contractAddress)`: そのコントラクトに登録されたすべての URI を返します。\n- `ScriptUpdate` イベント: 更新のたびに発行され、ウォレットがキャッシュしたスクリプトを更新できます。\n\n書き込みがパーミッションレスなので、順序が重要です。レジストリは、**対象コントラクトの [ERC-173](/eip-173/) の `owner()` が設定したエントリーを先頭に返すべき**で、シンプルなウォレットは最初の URI だけを使います。エントリーが多い場合に備えて、レジストリはページングにも対応すべきです。\n\n信頼はオフチェーンで扱います。スクリプトを取得するウォレットは、その署名を、できればコントラクトの `owner()` に対して検証すべきです。コントラクトが `Ownable` でない場合、仕様ではデプロイヤーの鍵との照合、ウォレット組み込みのキーチェーン、ガバナンスが承認した署名者リストなどの代替案が示されています。\n\n## サンプルコード\n\n仕様のインターフェース:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7738 {\n    event ScriptUpdate(address indexed contractAddress, string[] newScriptURI);\n\n    function scriptURI(address contractAddress) external view returns (string[] memory);\n    function setScriptURI(address contractAddress, string[] memory scriptURIList) external;\n}\n```\n\nウォレットがトークンのスクリプトを検索する（ethers v6）:\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst registry = new Contract(REGISTRY_ADDRESS, [\n  \"function scriptURI(address) view returns (string[])\",\n], provider);\n\nconst uris: string[] = await registry.scriptURI(tokenAddress);\nconst preferred = uris[0]; // owner-set entries come first\n// fetch(preferred), then verify the script's signature before running it\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。**\n- 誰でも任意のコントラクトのスクリプトを登録できるため、レジストリ内の URI は推奨を意味しません。誰が署名したかを検証せずにスクリプトを実行してはいけません。メインネットでは、署名者を認証できない場合に注意するよう仕様が勧めています。\n- 仕様の簡易実装は、`ScriptUpdate` を追加の `msg.sender` 引数付きで emit しており、インターフェースの 2 引数のイベントと一致しません。インデックスするデプロイのイベントシグネチャを確認してください。\n- 仕様には稼働中のデプロイアドレスが記載されていますが、頼る前に各チェーンで確認してください。\n"},"ko":{"lang":"ko","tldr":"누구나 어떤 컨트랙트에 대해서든 스크립트 URI를 게시할 수 있는 허가 불필요(permissionless) 온체인 레지스트리. ERC-5169를 구현한 적 없는 컨트랙트라도 지갑이 클라이언트 측 스크립트를 찾을 수 있게 한다.","tags":["registry","scripts","tokenscript","wallet","metadata"],"related":[5169,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7738/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-5169](/eip-5169/)를 사용하면 토큰 컨트랙트가 클라이언트 측 스크립트(예: TokenScript)를 가리킬 수 있고, 지갑과 뷰어가 이를 실행해 토큰에 더 풍부한 인터페이스를 제공할 수 있습니다. 하지만 컨트랙트가 배포 시점이나 업그레이드를 통해 `scriptURI()`를 직접 구현해야 합니다. 기존 컨트랙트 대부분은 구현하지 않았고, 업그레이드할 수 없는 경우도 많습니다.\n\nERC-7738은 이 조회를 토큰에서 분리해 별도의 레지스트리 컨트랙트로 옮깁니다. 누구나 어떤 컨트랙트 주소에 대해서든 스크립트를 등록할 수 있고, 지갑은 토큰이 아니라 레지스트리에 질의합니다. 여러 체인에서 같은 주소에 배포되는 싱글톤을 의도하며, 따라서 중앙 서버나 게이트키퍼가 필요 없습니다.\n\n## 어떻게 동작하나요?\n\n레지스트리는 함수 두 개와 이벤트 하나를 노출합니다.\n\n- `setScriptURI(contractAddress, string[] uris)`: 누구나 호출할 수 있습니다. 항목은 (대상 컨트랙트, 설정자)별로 저장됩니다.\n- `scriptURI(contractAddress)`: 해당 컨트랙트에 등록된 모든 URI를 반환합니다.\n- `ScriptUpdate` 이벤트: 업데이트될 때마다 발생하며, 지갑이 캐시한 스크립트를 새로 고칠 수 있게 합니다.\n\n쓰기가 허가 불필요이므로 순서가 중요합니다. 레지스트리는 **대상 컨트랙트의 [ERC-173](/eip-173/) `owner()`가 설정한 항목을 먼저 반환해야 하며**, 단순한 지갑은 첫 번째 URI만 사용합니다. 항목이 많을 때를 위해 레지스트리는 페이징도 지원해야 합니다.\n\n신뢰는 오프체인에서 처리합니다. 스크립트를 가져오는 지갑은 서명을 검증해야 하며, 가능하면 컨트랙트의 `owner()`에 대해 검증하는 것이 좋습니다. 컨트랙트가 `Ownable`이 아니라면 명세는 배포자 키와 대조하기, 지갑에 내장된 키체인, 거버넌스가 승인한 서명자 목록 같은 대안을 제시합니다.\n\n## 샘플 코드\n\n명세의 인터페이스입니다.\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7738 {\n    event ScriptUpdate(address indexed contractAddress, string[] newScriptURI);\n\n    function scriptURI(address contractAddress) external view returns (string[] memory);\n    function setScriptURI(address contractAddress, string[] memory scriptURIList) external;\n}\n```\n\n지갑이 토큰의 스크립트를 조회하는 예(ethers v6):\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst registry = new Contract(REGISTRY_ADDRESS, [\n  \"function scriptURI(address) view returns (string[])\",\n], provider);\n\nconst uris: string[] = await registry.scriptURI(tokenAddress);\nconst preferred = uris[0]; // owner-set entries come first\n// fetch(preferred), then verify the script's signature before running it\n```\n\n## 알아둘 점\n\n- **상태: Draft.**\n- 누구나 어떤 컨트랙트에 대해서든 스크립트를 등록할 수 있으므로, 레지스트리에 있는 URI가 보증을 뜻하지는 않습니다. 누가 서명했는지 검증하지 않고 스크립트를 실행해서는 안 됩니다. 메인넷에서는 서명자를 인증할 수 없을 때 주의하라고 명세가 권고합니다.\n- 명세의 단순화된 구현은 `ScriptUpdate`를 추가 `msg.sender` 인자와 함께 emit하는데, 인터페이스의 인자 두 개짜리 이벤트와 일치하지 않습니다. 인덱싱하는 배포본의 이벤트 시그니처를 확인하세요.\n- 명세에는 실제 배포 주소가 언급되어 있습니다. 의존하기 전에 각 체인에서 확인하세요.\n"},"zh":{"lang":"zh","tldr":"一个无需许可的链上注册表，任何人都可以为任意合约发布脚本 URI，使钱包即使面对从未实现 ERC-5169 的合约，也能找到客户端脚本。","tags":["registry","scripts","tokenscript","wallet","metadata"],"related":[5169,173],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7738/","markdown":"## 它解决什么问题？\n\n[ERC-5169](/eip-5169/) 让代币合约可以指向客户端脚本（例如 TokenScript），钱包和查看器可以运行这些脚本，为代币提供更丰富的界面。但合约必须自己实现 `scriptURI()`，要么在部署时，要么通过升级。大多数现有合约都没有实现，而且许多合约不可升级。\n\nERC-7738 把这一查询从代币本身移到一个独立的注册表合约中。任何人都可以为任意合约地址注册脚本，钱包查询注册表而不是代币。其设想是一个在多条链上部署在同一地址的单例，因此不需要中心化服务器或守门人。\n\n## 它如何运作\n\n注册表提供两个函数和一个事件：\n\n- `setScriptURI(contractAddress, string[] uris)`：任何人都可以调用。条目按（目标合约，设置者）分别存储。\n- `scriptURI(contractAddress)`：返回该合约所有已注册的 URI。\n- `ScriptUpdate` 事件：每次更新时触发，使钱包可以刷新缓存的脚本。\n\n由于写入无需许可，顺序就很重要。注册表**应当优先返回由目标合约的 [ERC-173](/eip-173/) `owner()` 设置的条目**；简单的钱包只取第一个 URI。当条目很多时，注册表还应支持分页。\n\n信任问题在链下处理。获取脚本的钱包应验证其签名，最好是对照合约的 `owner()` 验证。如果合约不是 `Ownable`，规范建议了一些替代方案，例如对照部署者密钥验证、使用钱包内置的密钥链，或由治理批准的签名者名单。\n\n## 示例代码\n\n规范中的接口：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.20;\n\ninterface IERC7738 {\n    event ScriptUpdate(address indexed contractAddress, string[] newScriptURI);\n\n    function scriptURI(address contractAddress) external view returns (string[] memory);\n    function setScriptURI(address contractAddress, string[] memory scriptURIList) external;\n}\n```\n\n钱包为某个代币查询脚本（ethers v6）：\n\n```ts\nimport { Contract, JsonRpcProvider } from \"ethers\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\nconst registry = new Contract(REGISTRY_ADDRESS, [\n  \"function scriptURI(address) view returns (string[])\",\n], provider);\n\nconst uris: string[] = await registry.scriptURI(tokenAddress);\nconst preferred = uris[0]; // owner-set entries come first\n// fetch(preferred), then verify the script's signature before running it\n```\n\n## 需要注意\n\n- **状态：Draft。**\n- 任何人都可以为任意合约注册脚本，因此注册表中的 URI 并不代表背书。切勿在未验证签名者身份的情况下执行脚本；在主网上，当无法验证签名者时，规范建议保持谨慎。\n- 规范中的简化实现在触发 `ScriptUpdate` 时多带了一个 `msg.sender` 参数，与接口中的两参数事件不一致。请核对你所索引的部署的事件签名。\n- 规范提到了一个在线部署地址；在依赖它之前，请在每条链上确认。\n"}}}
