ERC-7617: Chunk support for ERC-5219 mode in Web3 URL

In ERC-5219 resolve mode, add ability to fetch a Web3 URL resource made of several chunks


Metadata
Status: DraftStandards Track: ERCCreated: 2024-02-08
Authors
Qi Zhou (@qizhou), Nicolas Deschildre (@nand2)

Abstract


In the context of the ERC-6860 web3:// standard, this ERC extends the ERC-6944 resolve mode: This standard defines a new optional web3-next-chunk HTTP header returned by the request() call, that contains a web3:// URL pointing to the next data chunk of the resource data. Chunks are streamed to the web3:// client, and it loops until the web3-next-chunk header is no longer present.

Motivation


Ethereum RPC endpoints have a gas limit, which can be reached when serving large content. By adding a chunking feature, we add the possibility to serve arbitrary sized content.

Specification


In the ERC-6944 resolve mode, this standard introduces the new optional web3-next-chunk HTTP header, to be returned in the headers KeyValue array of the request() method defined in ERC-6944.

The value of the header is either a complete web3:// URL, or a relative one. The target smart contract must use the ERC-6944 resolve mode.

When processing the result of the initial request() call, the protocol return the HTTP status code, HTTP headers and body right away to the web3:// client. If a web3-next-chunk header is present, it parse the URL. If the URL is invalid, or the target smart contract is not using the ERC-6944 resolve mode, the HTTP data streaming is ended with an error. Otherwise it call the request() method, ignore the returned statusCode, send the body data as the next chunk of data, and if a web3-next-chunk header is again present, loops until no more are present.

Rationale


The use of a header pointing to the next chunk was chosen because it does not require changes to the ERC-6944 request() interface, and the use of a web3:// URL in the header add flexibility to the means to provide the next chunk.

Security Considerations


No security considerations were found.

Copyright


Copyright and related rights waived via CC0.