{"eip":7617,"title":"Chunk support for ERC-5219 mode in Web3 URL","description":"In ERC-5219 resolve mode, add ability to fetch a Web3 URL resource made of several chunks","authors":["Qi Zhou (@qizhou)","Nicolas Deschildre (@nand2)"],"status":"Draft","type":"Standards Track","category":"ERC","created":"2024-02-08","requires":[5219,6944],"discussionsTo":"https://ethereum-magicians.org/t/erc-5219-resolve-mode/14088","repo":"ERCs","label":"ERC-7617","officialUrl":"https://eips.ethereum.org/EIPS/eip-7617","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-7617.md","url":"https://eips.huatuo.xyz/eip-7617/","tldr":{"en":"Adds a web3-next-chunk response header to ERC-5219-style web3:// contracts, so a large file can be served in pieces and streamed to the client instead of hitting the RPC gas limit.","ja":"ERC-5219 形式の web3:// コントラクトに web3-next-chunk レスポンスヘッダーを追加し、大きなファイルを分割して提供し、RPC のガス上限に達することなくクライアントへストリーミングできるようにする。","ko":"ERC-5219 방식의 web3:// 컨트랙트에 web3-next-chunk 응답 헤더를 추가해, 큰 파일을 조각으로 나눠 제공하고 RPC 가스 한도에 걸리지 않고 클라이언트로 스트리밍할 수 있게 한다.","zh":"为 ERC-5219 风格的 web3:// 合约增加 web3-next-chunk 响应头，使大文件可以分块提供并流式传输给客户端，而不会触及 RPC 的 gas 上限。"},"tags":["web3-url","web3","hosting","http","onchain-website"],"explainers":{"en":{"lang":"en","tldr":"Adds a web3-next-chunk response header to ERC-5219-style web3:// contracts, so a large file can be served in pieces and streamed to the client instead of hitting the RPC gas limit.","tags":["web3-url","web3","hosting","http","onchain-website"],"related":[5219,6944,6860,4804],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-7617/","markdown":"## What problem does it solve?\n\nThe `web3://` URL scheme ([ERC-6860](/eip-6860/), building on [ERC-4804](/eip-4804/)) lets a browser or gateway fetch web content straight from a smart contract using a read-only `eth_call`. In the [ERC-5219](/eip-5219/) resolve mode ([ERC-6944](/eip-6944/)), the contract exposes an HTTP-like `request()` function that returns a status code, a body and headers.\n\nEvery `eth_call` is still bound by the RPC node's gas limit. A large image, script or video cannot be returned in a single call. ERC-7617 lets the contract split the response into **chunks** and tell the client where to find the next one.\n\n## How it works\n\n- The contract returns a normal response from `request()`. If more data follows, it adds a header **`web3-next-chunk`** whose value is a `web3://` URL, either absolute or relative, pointing to the next chunk.\n- The client sends the status code, headers and first body to the user immediately, then starts streaming.\n- For each next-chunk URL, the client calls `request()` on the target contract, **ignores its status code**, appends its `body` to the stream, and repeats while a `web3-next-chunk` header is present.\n- If a URL is invalid, or its target contract does not use the ERC-5219 resolve mode, the stream ends with an error.\n\nA header was chosen so the existing `request()` interface does not change. Because the value is a full URL, the next chunk can even come from a different contract.\n\n## Sample code\n\nA contract serving a file stored as several chunks (Solidity):\n\n```solidity\nstruct KeyValue { string key; string value; }\n\ncontract ChunkedSite /* is IERC5219Resolver */ {\n    string[] internal chunks; // filled by the owner\n\n    function resolveMode() external pure returns (bytes32) { return \"5219\"; }\n\n    function request(string[] memory resource, KeyValue[] memory params)\n        external view returns (uint16 statusCode, string memory body, KeyValue[] memory headers)\n    {\n        uint256 i = params.length \u003e 0 ? _parseUint(params[0].value) : 0; // ?chunk=i\n        bool more = i + 1 \u003c chunks.length;\n        headers = new KeyValue[](more ? 2 : 1);\n        headers[0] = KeyValue(\"Content-Type\", \"text/html\");\n        if (more) headers[1] = KeyValue(\"web3-next-chunk\",\n            string.concat(\"/index.html?chunk=\", _toString(i + 1)));   // relative URL\n        return (200, chunks[i], headers);\n    }\n    // _parseUint / _toString omitted\n}\n```\n\n## Things to know\n\n- Status: **Draft**, as are [ERC-6860](/eip-6860/) and [ERC-6944](/eip-6944/) it builds on.\n- The header is optional; clients that do not understand it will only show the first chunk, so put something sensible there.\n- Chunks are fetched one after another, so very large files mean many sequential `eth_call`s and slower loading.\n- Only the first response's status code and headers are used; later ones are ignored apart from `web3-next-chunk`.\n"},"ja":{"lang":"ja","tldr":"ERC-5219 形式の web3:// コントラクトに web3-next-chunk レスポンスヘッダーを追加し、大きなファイルを分割して提供し、RPC のガス上限に達することなくクライアントへストリーミングできるようにする。","tags":["web3-url","web3","hosting","http","onchain-website"],"related":[5219,6944,6860,4804],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-7617/","markdown":"## 何を解決するのか\n\n`web3://` URL スキーム（[ERC-6860](/eip-6860/)、[ERC-4804](/eip-4804/) を土台とする）により、ブラウザやゲートウェイは読み取り専用の `eth_call` を使って、スマートコントラクトから直接ウェブコンテンツを取得できます。[ERC-5219](/eip-5219/) のリゾルブモード（[ERC-6944](/eip-6944/)）では、コントラクトがステータスコード、ボディ、ヘッダーを返す HTTP のような `request()` 関数を公開します。\n\nすべての `eth_call` は依然として RPC ノードのガス上限に縛られます。大きな画像、スクリプト、動画を 1 回の呼び出しで返すことはできません。ERC-7617 は、コントラクトがレスポンスを**チャンク**に分割し、次のチャンクの場所をクライアントに伝えられるようにします。\n\n## 仕組み\n\n- コントラクトは `request()` から通常のレスポンスを返します。続きのデータがある場合は、次のチャンクを指す `web3://` URL（絶対または相対）を値とするヘッダー **`web3-next-chunk`** を追加します。\n- クライアントはステータスコード、ヘッダー、最初のボディをすぐにユーザーへ送り、その後ストリーミングを開始します。\n- 各 next-chunk URL について、クライアントは対象コントラクトの `request()` を呼び出し、**そのステータスコードを無視し**、その `body` をストリームに追加し、`web3-next-chunk` ヘッダーがある間これを繰り返します。\n- URL が無効な場合、またはその対象コントラクトが ERC-5219 のリゾルブモードを使っていない場合、ストリームはエラーで終了します。\n\n既存の `request()` インターフェースを変えないよう、ヘッダーが選ばれました。値は完全な URL なので、次のチャンクは別のコントラクトから取得することもできます。\n\n## サンプルコード\n\n複数のチャンクとして保存されたファイルを提供するコントラクト（Solidity）:\n\n```solidity\nstruct KeyValue { string key; string value; }\n\ncontract ChunkedSite /* is IERC5219Resolver */ {\n    string[] internal chunks; // filled by the owner\n\n    function resolveMode() external pure returns (bytes32) { return \"5219\"; }\n\n    function request(string[] memory resource, KeyValue[] memory params)\n        external view returns (uint16 statusCode, string memory body, KeyValue[] memory headers)\n    {\n        uint256 i = params.length \u003e 0 ? _parseUint(params[0].value) : 0; // ?chunk=i\n        bool more = i + 1 \u003c chunks.length;\n        headers = new KeyValue[](more ? 2 : 1);\n        headers[0] = KeyValue(\"Content-Type\", \"text/html\");\n        if (more) headers[1] = KeyValue(\"web3-next-chunk\",\n            string.concat(\"/index.html?chunk=\", _toString(i + 1)));   // relative URL\n        return (200, chunks[i], headers);\n    }\n    // _parseUint / _toString omitted\n}\n```\n\n## 知っておくべきこと\n\n- ステータス: **Draft**。土台となる [ERC-6860](/eip-6860/) と [ERC-6944](/eip-6944/) も Draft です。\n- ヘッダーは任意です。これを理解しないクライアントは最初のチャンクしか表示しないため、そこに意味のある内容を置いてください。\n- チャンクは順番に取得されるため、非常に大きなファイルでは `eth_call` が何度も連続して発生し、読み込みが遅くなります。\n- 最初のレスポンスのステータスコードとヘッダーだけが使われ、以降のものは `web3-next-chunk` を除いて無視されます。\n"},"ko":{"lang":"ko","tldr":"ERC-5219 방식의 web3:// 컨트랙트에 web3-next-chunk 응답 헤더를 추가해, 큰 파일을 조각으로 나눠 제공하고 RPC 가스 한도에 걸리지 않고 클라이언트로 스트리밍할 수 있게 한다.","tags":["web3-url","web3","hosting","http","onchain-website"],"related":[5219,6944,6860,4804],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-7617/","markdown":"## 어떤 문제를 해결하나요?\n\n`web3://` URL 스킴([ERC-6860](/eip-6860/), [ERC-4804](/eip-4804/) 기반)은 브라우저나 게이트웨이가 읽기 전용 `eth_call`로 스마트 컨트랙트에서 직접 웹 콘텐츠를 가져오게 합니다. [ERC-5219](/eip-5219/) 리졸브 모드([ERC-6944](/eip-6944/))에서 컨트랙트는 상태 코드, 본문, 헤더를 반환하는 HTTP 유사 `request()` 함수를 노출합니다.\n\n모든 `eth_call`은 여전히 RPC 노드의 가스 한도에 묶여 있습니다. 큰 이미지, 스크립트, 동영상은 한 번의 호출로 반환할 수 없습니다. ERC-7617은 컨트랙트가 응답을 **청크**로 나누고 클라이언트에게 다음 청크의 위치를 알려 줄 수 있게 합니다.\n\n## 어떻게 동작하나요?\n\n- 컨트랙트는 `request()`에서 일반적인 응답을 반환합니다. 뒤따르는 데이터가 있으면, 다음 청크를 가리키는 `web3://` URL(절대 또는 상대)을 값으로 하는 헤더 **`web3-next-chunk`**를 추가합니다.\n- 클라이언트는 상태 코드, 헤더, 첫 번째 본문을 즉시 사용자에게 보내고 스트리밍을 시작합니다.\n- 각 next-chunk URL에 대해 클라이언트는 대상 컨트랙트의 `request()`를 호출하고, **그 상태 코드는 무시하며**, 그 `body`를 스트림에 덧붙이고, `web3-next-chunk` 헤더가 있는 동안 이를 반복합니다.\n- URL이 유효하지 않거나 대상 컨트랙트가 ERC-5219 리졸브 모드를 쓰지 않으면 스트림은 오류로 끝납니다.\n\n기존 `request()` 인터페이스를 바꾸지 않기 위해 헤더가 선택되었습니다. 값이 전체 URL이므로 다음 청크는 다른 컨트랙트에서 올 수도 있습니다.\n\n## 샘플 코드\n\n여러 청크로 저장된 파일을 제공하는 컨트랙트(Solidity):\n\n```solidity\nstruct KeyValue { string key; string value; }\n\ncontract ChunkedSite /* is IERC5219Resolver */ {\n    string[] internal chunks; // filled by the owner\n\n    function resolveMode() external pure returns (bytes32) { return \"5219\"; }\n\n    function request(string[] memory resource, KeyValue[] memory params)\n        external view returns (uint16 statusCode, string memory body, KeyValue[] memory headers)\n    {\n        uint256 i = params.length \u003e 0 ? _parseUint(params[0].value) : 0; // ?chunk=i\n        bool more = i + 1 \u003c chunks.length;\n        headers = new KeyValue[](more ? 2 : 1);\n        headers[0] = KeyValue(\"Content-Type\", \"text/html\");\n        if (more) headers[1] = KeyValue(\"web3-next-chunk\",\n            string.concat(\"/index.html?chunk=\", _toString(i + 1)));   // relative URL\n        return (200, chunks[i], headers);\n    }\n    // _parseUint / _toString omitted\n}\n```\n\n## 알아둘 점\n\n- 상태: **Draft**. 기반이 되는 [ERC-6860](/eip-6860/)과 [ERC-6944](/eip-6944/)도 Draft입니다.\n- 헤더는 선택 사항입니다. 이를 이해하지 못하는 클라이언트는 첫 번째 청크만 보여 주므로, 거기에 의미 있는 내용을 넣으세요.\n- 청크는 차례대로 가져오므로, 아주 큰 파일은 `eth_call`이 순차적으로 많이 발생해 로딩이 느려집니다.\n- 첫 번째 응답의 상태 코드와 헤더만 사용되며, 이후 응답은 `web3-next-chunk`를 제외하고 무시됩니다.\n"},"zh":{"lang":"zh","tldr":"为 ERC-5219 风格的 web3:// 合约增加 web3-next-chunk 响应头，使大文件可以分块提供并流式传输给客户端，而不会触及 RPC 的 gas 上限。","tags":["web3-url","web3","hosting","http","onchain-website"],"related":[5219,6944,6860,4804],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-7617/","markdown":"## 它解决什么问题？\n\n`web3://` URL 方案（[ERC-6860](/eip-6860/)，基于 [ERC-4804](/eip-4804/)）让浏览器或网关通过只读的 `eth_call` 直接从智能合约获取网页内容。在 [ERC-5219](/eip-5219/) 的解析模式（[ERC-6944](/eip-6944/)）中，合约暴露一个类似 HTTP 的 `request()` 函数，返回状态码、正文和响应头。\n\n每个 `eth_call` 仍然受 RPC 节点 gas 上限的约束。大图片、脚本或视频无法在一次调用中返回。ERC-7617 让合约把响应拆分成**块（chunk）**，并告诉客户端下一块在哪里。\n\n## 它如何运作\n\n- 合约从 `request()` 返回一个正常的响应。如果后面还有数据，它会添加一个响应头 **`web3-next-chunk`**，其值是指向下一块的 `web3://` URL（绝对或相对均可）。\n- 客户端立即把状态码、响应头和第一块正文发送给用户，然后开始流式传输。\n- 对于每个 next-chunk URL，客户端在目标合约上调用 `request()`，**忽略其状态码**，把它的 `body` 追加到流中，只要还存在 `web3-next-chunk` 响应头就重复这一过程。\n- 如果 URL 无效，或其目标合约不使用 ERC-5219 解析模式，流会以错误结束。\n\n选择使用响应头是为了不改变现有的 `request()` 接口。由于其值是完整的 URL，下一块甚至可以来自另一个合约。\n\n## 示例代码\n\n一个提供以多个块存储的文件的合约（Solidity）：\n\n```solidity\nstruct KeyValue { string key; string value; }\n\ncontract ChunkedSite /* is IERC5219Resolver */ {\n    string[] internal chunks; // filled by the owner\n\n    function resolveMode() external pure returns (bytes32) { return \"5219\"; }\n\n    function request(string[] memory resource, KeyValue[] memory params)\n        external view returns (uint16 statusCode, string memory body, KeyValue[] memory headers)\n    {\n        uint256 i = params.length \u003e 0 ? _parseUint(params[0].value) : 0; // ?chunk=i\n        bool more = i + 1 \u003c chunks.length;\n        headers = new KeyValue[](more ? 2 : 1);\n        headers[0] = KeyValue(\"Content-Type\", \"text/html\");\n        if (more) headers[1] = KeyValue(\"web3-next-chunk\",\n            string.concat(\"/index.html?chunk=\", _toString(i + 1)));   // relative URL\n        return (200, chunks[i], headers);\n    }\n    // _parseUint / _toString omitted\n}\n```\n\n## 需要注意\n\n- 状态：**Draft**，它所依赖的 [ERC-6860](/eip-6860/) 和 [ERC-6944](/eip-6944/) 也是 Draft。\n- 该响应头是可选的；不理解它的客户端只会显示第一块，因此请在其中放置合理的内容。\n- 各块是依次获取的，因此非常大的文件意味着许多串行的 `eth_call`，加载会更慢。\n- 只使用第一个响应的状态码和响应头；之后的响应除 `web3-next-chunk` 外都会被忽略。\n"}}}
