{"eip":6944,"title":"ERC-5219 Resolve Mode","description":"Adds an ERC-4804 resolveMode to support ERC-5219 requests","authors":["Gavin John (@Pandapip1)","Qi Zhou (@qizhou)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2023-04-27","requires":[4804,5219],"discussionsTo":"https://ethereum-magicians.org/t/erc-5219-resolve-mode/14088","repo":"ERCs","label":"ERC-6944","officialUrl":"https://eips.ethereum.org/EIPS/eip-6944","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6944.md","url":"https://eips.huatuo.xyz/eip-6944/","tldr":{"en":"Draft ERC that adds a \"5219\" resolve mode to web3:// URLs, so a contract can serve web resources through the ERC-5219 HTTP-like request interface.","ja":"web3:// URL に「5219」解決モードを追加するドラフト ERC。コントラクトが ERC-5219 の HTTP 風リクエストインターフェースを通じてウェブリソースを配信できるようにする。","ko":"web3:// URL에 \"5219\" 해석 모드를 추가하는 초안 ERC. 컨트랙트가 ERC-5219의 HTTP 유사 요청 인터페이스를 통해 웹 리소스를 제공할 수 있게 한다.","zh":"为 web3:// URL 增加\"5219\"解析模式的草案 ERC，使合约可以通过 ERC-5219 的类 HTTP 请求接口提供网页资源。"},"tags":["web3-url","dapp","hosting","resolve-mode","erc5219"],"explainers":{"en":{"lang":"en","tldr":"Draft ERC that adds a \"5219\" resolve mode to web3:// URLs, so a contract can serve web resources through the ERC-5219 HTTP-like request interface.","tags":["web3-url","dapp","hosting","resolve-mode","erc5219"],"related":[4804,5219,6860,7618],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-6944/","markdown":"## What problem does it solve?\n\n[ERC-4804](/eip-4804/) defines `web3://` URLs that map a URL to a read-only call on a contract, so front-ends can be served straight from the chain. A contract chooses how its URLs are interpreted via a `resolveMode()` function: **auto** (the path is parsed into an ABI function call) or **manual** (the raw path and query are passed as calldata).\n\n[ERC-5219](/eip-5219/) separately defines a contract interface for HTTP-like requests: the contract receives a resource path and parameters and returns a status code, body and headers. That shape is a natural fit for serving web pages, but `web3://` clients had no way to know a contract speaks ERC-5219. ERC-6944 adds that missing link: a third resolve mode.\n\n## How it works\n\nA contract that wants `web3://` requests routed through ERC-5219 implements the ERC-5219 interface (`IDecentralizedApp`) and also:\n\n```solidity\nfunction resolveMode() external pure returns (bytes32 mode);\n```\n\nreturning the ASCII string `\"5219\"`, right-padded to 32 bytes (`0x3532313900…00`). The comparison is case-insensitive.\n\nA `web3://` client calls `resolveMode()` on the target contract first:\n\n- `\"auto\"` (or no `resolveMode` at all) → ERC-4804 auto mode.\n- `\"manual\"` → ERC-4804 manual mode.\n- `\"5219\"` → translate the URL into an ERC-5219 request and render the returned status, headers and body like an HTTP response.\n\n[ERC-165](/eip-165/) is deliberately not used; calling `resolveMode` is enough to check support.\n\n## Sample code\n\nDeclaring the mode in a contract:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.0;\n\nabstract contract ERC5219Resolver /* is IDecentralizedApp */ {\n    function resolveMode() public pure returns (bytes32 mode) {\n        return \"5219\"; // 0x35323139 followed by 28 zero bytes\n    }\n}\n```\n\nChecking a contract's mode from a client (ethers v6):\n\n```ts\nimport { Contract, decodeBytes32String } from \"ethers\";\n\nconst c = new Contract(target, [\"function resolveMode() view returns (bytes32)\"], provider);\nlet mode = \"auto\";\ntry { mode = decodeBytes32String(await c.resolveMode()).toLowerCase(); } catch {}\n// \"5219\" -\u003e send an ERC-5219 request; otherwise use ERC-4804 auto/manual rules\n```\n\n## Things to know\n\n- **Status: Draft.** Browser and gateway support depends on the `web3://` client you use.\n- The security considerations of both ERC-4804 and ERC-5219 apply; content served from a contract is only as trustworthy as that contract and whoever can change it.\n- The `web3://` URL spec has a newer draft revision, [ERC-6860](/eip-6860/), and [ERC-7618](/eip-7618/) adds content encoding for responses in this 5219 mode.\n"},"ja":{"lang":"ja","tldr":"web3:// URL に「5219」解決モードを追加するドラフト ERC。コントラクトが ERC-5219 の HTTP 風リクエストインターフェースを通じてウェブリソースを配信できるようにする。","tags":["web3-url","dapp","hosting","resolve-mode","erc5219"],"related":[4804,5219,6860,7618],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-6944/","markdown":"## 何を解決するのか\n\n[ERC-4804](/eip-4804/) は、URL をコントラクトへの読み取り専用の呼び出しに対応づける `web3://` URL を定義しており、フロントエンドをチェーンから直接配信できます。コントラクトは `resolveMode()` 関数で URL の解釈方法を選びます。**auto**（パスを ABI の関数呼び出しとして解析）か、**manual**（生のパスとクエリを calldata として渡す）です。\n\n[ERC-5219](/eip-5219/) は別に、HTTP 風リクエスト向けのコントラクトインターフェースを定義しています。コントラクトはリソースのパスとパラメーターを受け取り、ステータスコード、ボディ、ヘッダーを返します。この形はウェブページの配信に自然に合いますが、`web3://` クライアントには、そのコントラクトが ERC-5219 に対応していることを知る手段がありませんでした。ERC-6944 はこの欠けていた部分として、3 つ目の解決モードを追加します。\n\n## 仕組み\n\n`web3://` リクエストを ERC-5219 経由にしたいコントラクトは、ERC-5219 のインターフェース（`IDecentralizedApp`）を実装し、さらに次も実装します。\n\n```solidity\nfunction resolveMode() external pure returns (bytes32 mode);\n```\n\nこの関数は ASCII 文字列 `\"5219\"` を 32 バイトまで右詰めのゼロ埋めにした値（`0x3532313900…00`）を返します。比較は大文字小文字を区別しません。\n\n`web3://` クライアントは、まず対象コントラクトの `resolveMode()` を呼びます。\n\n- `\"auto\"`（または `resolveMode` 自体がない）→ ERC-4804 の auto モード。\n- `\"manual\"` → ERC-4804 の manual モード。\n- `\"5219\"` → URL を ERC-5219 リクエストに変換し、返されたステータス、ヘッダー、ボディを HTTP レスポンスのように表示します。\n\n[ERC-165](/eip-165/) は意図的に使われていません。対応しているかどうかは `resolveMode` を呼べば確認できます。\n\n## サンプルコード\n\nコントラクトでモードを宣言する例:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.0;\n\nabstract contract ERC5219Resolver /* is IDecentralizedApp */ {\n    function resolveMode() public pure returns (bytes32 mode) {\n        return \"5219\"; // 0x35323139 followed by 28 zero bytes\n    }\n}\n```\n\nクライアントからコントラクトのモードを確認する例（ethers v6）:\n\n```ts\nimport { Contract, decodeBytes32String } from \"ethers\";\n\nconst c = new Contract(target, [\"function resolveMode() view returns (bytes32)\"], provider);\nlet mode = \"auto\";\ntry { mode = decodeBytes32String(await c.resolveMode()).toLowerCase(); } catch {}\n// \"5219\" -\u003e send an ERC-5219 request; otherwise use ERC-4804 auto/manual rules\n```\n\n## 知っておくべきこと\n\n- **ステータス: Draft。** ブラウザーやゲートウェイの対応状況は、使用する `web3://` クライアントによって異なります。\n- ERC-4804 と ERC-5219 の両方のセキュリティ上の考慮事項が当てはまります。コントラクトから配信されるコンテンツの信頼性は、そのコントラクトと、それを変更できる人の信頼性次第です。\n- `web3://` URL の仕様にはより新しいドラフト版として [ERC-6860](/eip-6860/) があり、[ERC-7618](/eip-7618/) はこの 5219 モードでのレスポンスにコンテンツエンコーディングを追加します。\n"},"ko":{"lang":"ko","tldr":"web3:// URL에 \"5219\" 해석 모드를 추가하는 초안 ERC. 컨트랙트가 ERC-5219의 HTTP 유사 요청 인터페이스를 통해 웹 리소스를 제공할 수 있게 한다.","tags":["web3-url","dapp","hosting","resolve-mode","erc5219"],"related":[4804,5219,6860,7618],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-6944/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-4804](/eip-4804/)는 URL을 컨트랙트에 대한 읽기 전용 호출로 매핑하는 `web3://` URL을 정의하며, 덕분에 프런트엔드를 체인에서 바로 제공할 수 있습니다. 컨트랙트는 `resolveMode()` 함수로 URL을 어떻게 해석할지 선택합니다. **auto**(경로를 ABI 함수 호출로 파싱) 또는 **manual**(원본 경로와 쿼리를 calldata로 전달)입니다.\n\n[ERC-5219](/eip-5219/)는 별도로 HTTP 유사 요청을 위한 컨트랙트 인터페이스를 정의합니다. 컨트랙트가 리소스 경로와 파라미터를 받아 상태 코드, 본문, 헤더를 반환하는 방식입니다. 이 형태는 웹 페이지를 제공하기에 자연스럽지만, `web3://` 클라이언트는 컨트랙트가 ERC-5219를 지원하는지 알 방법이 없었습니다. ERC-6944는 이 빠져 있던 연결 고리로서 세 번째 해석 모드를 추가합니다.\n\n## 어떻게 동작하나요?\n\n`web3://` 요청을 ERC-5219로 라우팅하려는 컨트랙트는 ERC-5219 인터페이스(`IDecentralizedApp`)를 구현하고 다음도 구현합니다.\n\n```solidity\nfunction resolveMode() external pure returns (bytes32 mode);\n```\n\n이 함수는 ASCII 문자열 `\"5219\"`를 32바이트가 되도록 오른쪽을 0으로 채운 값(`0x3532313900…00`)을 반환합니다. 비교는 대소문자를 구분하지 않습니다.\n\n`web3://` 클라이언트는 먼저 대상 컨트랙트의 `resolveMode()`를 호출합니다.\n\n- `\"auto\"`(또는 `resolveMode`가 아예 없음) → ERC-4804 auto 모드.\n- `\"manual\"` → ERC-4804 manual 모드.\n- `\"5219\"` → URL을 ERC-5219 요청으로 변환하고, 반환된 상태, 헤더, 본문을 HTTP 응답처럼 렌더링합니다.\n\n[ERC-165](/eip-165/)는 의도적으로 사용하지 않습니다. 지원 여부는 `resolveMode`를 호출하는 것만으로 확인할 수 있습니다.\n\n## 샘플 코드\n\n컨트랙트에서 모드를 선언하는 예:\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.0;\n\nabstract contract ERC5219Resolver /* is IDecentralizedApp */ {\n    function resolveMode() public pure returns (bytes32 mode) {\n        return \"5219\"; // 0x35323139 followed by 28 zero bytes\n    }\n}\n```\n\n클라이언트에서 컨트랙트의 모드를 확인하는 예(ethers v6):\n\n```ts\nimport { Contract, decodeBytes32String } from \"ethers\";\n\nconst c = new Contract(target, [\"function resolveMode() view returns (bytes32)\"], provider);\nlet mode = \"auto\";\ntry { mode = decodeBytes32String(await c.resolveMode()).toLowerCase(); } catch {}\n// \"5219\" -\u003e send an ERC-5219 request; otherwise use ERC-4804 auto/manual rules\n```\n\n## 알아둘 점\n\n- **상태: Draft.** 브라우저와 게이트웨이의 지원 여부는 사용하는 `web3://` 클라이언트에 따라 달라집니다.\n- ERC-4804와 ERC-5219의 보안 고려 사항이 모두 적용됩니다. 컨트랙트가 제공하는 콘텐츠는 그 컨트랙트와 그것을 변경할 수 있는 주체만큼만 신뢰할 수 있습니다.\n- `web3://` URL 명세에는 더 최신 초안인 [ERC-6860](/eip-6860/)이 있으며, [ERC-7618](/eip-7618/)은 이 5219 모드의 응답에 콘텐츠 인코딩을 추가합니다.\n"},"zh":{"lang":"zh","tldr":"为 web3:// URL 增加\"5219\"解析模式的草案 ERC，使合约可以通过 ERC-5219 的类 HTTP 请求接口提供网页资源。","tags":["web3-url","dapp","hosting","resolve-mode","erc5219"],"related":[4804,5219,6860,7618],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-6944/","markdown":"## 它解决什么问题？\n\n[ERC-4804](/eip-4804/) 定义了 `web3://` URL，把 URL 映射为对合约的只读调用，因此前端可以直接从链上提供。合约通过 `resolveMode()` 函数选择 URL 的解释方式：**auto**（把路径解析成 ABI 函数调用）或 **manual**（把原始路径和查询字符串作为 calldata 传入）。\n\n[ERC-5219](/eip-5219/) 另外定义了一个面向类 HTTP 请求的合约接口：合约接收资源路径和参数，返回状态码、响应体和响应头。这种形式天然适合提供网页，但 `web3://` 客户端无从得知某个合约是否支持 ERC-5219。ERC-6944 补上了这个缺失的环节：第三种解析模式。\n\n## 它如何运作\n\n想让 `web3://` 请求经由 ERC-5219 处理的合约，需要实现 ERC-5219 接口（`IDecentralizedApp`），并且还要实现：\n\n```solidity\nfunction resolveMode() external pure returns (bytes32 mode);\n```\n\n它返回 ASCII 字符串 `\"5219\"`，右侧补零至 32 字节（`0x3532313900…00`）。比较时不区分大小写。\n\n`web3://` 客户端会先在目标合约上调用 `resolveMode()`：\n\n- `\"auto\"`（或者根本没有 `resolveMode`）→ ERC-4804 的 auto 模式。\n- `\"manual\"` → ERC-4804 的 manual 模式。\n- `\"5219\"` → 把 URL 转换为 ERC-5219 请求，并像 HTTP 响应一样渲染返回的状态、响应头和响应体。\n\n这里有意不使用 [ERC-165](/eip-165/)；调用 `resolveMode` 就足以检查是否支持。\n\n## 示例代码\n\n在合约中声明模式：\n\n```solidity\n// SPDX-License-Identifier: CC0-1.0\npragma solidity ^0.8.0;\n\nabstract contract ERC5219Resolver /* is IDecentralizedApp */ {\n    function resolveMode() public pure returns (bytes32 mode) {\n        return \"5219\"; // 0x35323139 followed by 28 zero bytes\n    }\n}\n```\n\n在客户端检查合约的模式（ethers v6）：\n\n```ts\nimport { Contract, decodeBytes32String } from \"ethers\";\n\nconst c = new Contract(target, [\"function resolveMode() view returns (bytes32)\"], provider);\nlet mode = \"auto\";\ntry { mode = decodeBytes32String(await c.resolveMode()).toLowerCase(); } catch {}\n// \"5219\" -\u003e send an ERC-5219 request; otherwise use ERC-4804 auto/manual rules\n```\n\n## 需要注意\n\n- **状态：Draft。** 浏览器和网关的支持情况取决于你使用的 `web3://` 客户端。\n- ERC-4804 和 ERC-5219 的安全注意事项都适用；合约提供的内容，其可信度取决于该合约以及能修改它的人。\n- `web3://` URL 规范有一个更新的草案版本 [ERC-6860](/eip-6860/)，而 [ERC-7618](/eip-7618/) 为这种 5219 模式下的响应增加了内容编码。\n"}},"requiredBy":[7617,7618,7774]}
