Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
ERC-7087 extends ERC-6860 to provide appropriate MIME types for data returned through Web3 URLs, helping browsers interpret the content correctly.
This article translates, summarizes, and expands on the following proposal.
More EIP, BIP, SLIP, CAIP, ENSIP, RFC, and ACP explainers:
Overview
ERC-7087 extends the web3:// protocol defined by ERC-6860. When an existing smart contract is accessed in auto mode, the MIME type of its returned data may be implicit or embedded in an RFC 2397 data URL.
For ERC-6860, see the following article.
ERC-6860: Accessing on-chain content using HTTP-style Web3 URLs
A MIME type identifies the format of a resource, such as HTML, an image, or JSON. Examples include text/html and image/png.
ERC-7087 introduces query parameters that allow clients to determine the MIME type when retrieving data through a Web3 URL. It also allows a client to interpret a returned value as an RFC 2397 data URL, decode its contents, and use the media type declared within it.
Motivation
Browsers rely on the Content-Type header to interpret responses correctly. A missing or incorrect media type can result in incorrect rendering, encoding problems, or an unexpected download.
ERC-6860 defines two resolution modes.
| Mode | Description |
|---|---|
manual |
A contract explicitly selects manual resolution. The contract can provide the information needed to determine the response's MIME type. |
auto |
This mode can be explicitly selected by a contract and is also used for ordinary contracts that do not implement a dedicated Web3 URL resolution interface. Existing contracts may return data without explicit MIME type information. |
The problem concerns auto mode. An existing contract may contain data intended for a browser without providing a way to communicate its format to the Web3 URL client. Even when the returned value is an RFC 2397 data URL, the client may otherwise treat it as ordinary bytes.
ERC-7087 addresses this gap in two ways.
- It introduces query parameters that let a Web3 URL specify the expected MIME type, enabling the client to provide an appropriate
Content-Typeheader even when the contract does not supply one. - It allows a Web3 URL to explicitly identify the returned value as a data URL, so the client can decode the payload and obtain its declared media type.
The goal is to make auto-mode responses easier for browsers to interpret while retaining compatibility with the existing Web3 URL mechanism.
Specification
Three MIME-related query parameters
| Query parameter | Description |
|---|---|
mime.content=<contentType> |
Specifies a MIME type as defined by RFC 6838. After URL decoding, the value is used as the response's Content-Type. An invalid MIME type causes an error without executing the URL. |
mime.type=<fileType> |
Specifies a filename extension, such as svg or png. The client resolves it to a corresponding MIME type and uses that type as Content-Type. An unrecognized extension causes an error without executing the URL. |
mime.dataurl |
Interprets the returned data as an RFC 2397 data URL, such as data:application/json,.... The client returns the decoded payload and uses the media type declared in the data URL. An invalid data URL causes an error. |
Precedence and ignored parameters
If multiple MIME-related query parameters are present, the last one takes precedence. If none is specified, MIME type handling follows ERC-6860.
If the returns query parameter is specified, the MIME-related parameters are ignored and the response content type follows ERC-6860.
ABNF syntax
The proposal uses Augmented Backus-Naur Form (ABNF), as described in RFC 2234.
The original ERC-6860 attribute syntax is as follows.
attribute = attrName "=" attrValue
attrName = "returns"
/ "returnTypes"
attrValue = [ "(" [ retTypes ] ")" ]ERC-7087 extends it with MIME-related attributes.
attribute = retAttr / mimeCAttr / mimeTAttr / mimeDAttr
retAttr = retAttrName "=" retAttrValue
retAttrName = "returns"
/ "returnTypes"
retAttrValue = [ "(" [ retTypes ] ")" ]
mimeCAttr = "mime.content=" mimeCAttrVal
mimeCAttrVal = # ABNF of MIME type as in RFC 6838
mimeTAttr = "mime.type=" 1*( ALPHA / DIGIT )
mimeDAttr = "mime.dataurl"The new syntax recognizes three MIME selection mechanisms alongside returns and returnTypes.
Examples
The following examples illustrate the interpretation of each query parameter.
Example 1: Explicit MIME type using mime.content
web3://0x91cf36c92feb5c11d3f5fe3e8b9e212f7472ec14/accessorizedImageOf/1289?mime.content=image/svg%2BxmlThe contract is accessed in auto mode. The URL-decoded value image/svg+xml becomes the response's Content-Type.
Example 2: MIME type inferred from an extension using mime.type
web3://0x91cf36c92feb5c11d3f5fe3e8b9e212f7472ec14/accessorizedImageOf/1289?mime.type=svgThe contract is accessed in auto mode. The extension svg resolves to image/svg+xml, which becomes the response's Content-Type.
Example 3: Decoding a data URL using mime.dataurl
web3://0xff9c1b15b16263c61d017ee9f65c50e4ae0113d7/tokenURI/100?mime.dataurlThe contract accessed in auto mode returns a data URL of the following form.
data:application/json,["xx"]Because mime.dataurl is specified, the returned value is parsed and decoded as a data URL.
The resulting payload is ["xx"], and its response content type is application/json.
Rationale
ERC-7087 defines three separate query parameters rather than combining all three mechanisms into a single parameter. This makes the intention of each URL easier to understand.
The presence of mime.content= indicates an explicit MIME type, mime.type= indicates selection based on an extension, and mime.dataurl indicates that the returned data should be decoded as a data URL.
In auto mode, these query parameters do not affect the construction of the EVM message, including its calldata. They can therefore extend response interpretation without changing the contract function invocation.
Security
Allowing callers to influence a response's MIME type introduces cross-site scripting (XSS) risks. In particular, browsers must not assume that a response is safe to interpret as active HTML or JavaScript simply because the URL references a familiar contract.
A trusted-looking Web3 URL hostname may lead users to underestimate the risk posed by untrusted contract output.
| Risk | Description |
|---|---|
| Access to browser storage | Script execution within an affected origin can expose data accessible to scripts, including localStorage, sessionStorage, IndexedDB, and cookies that are not protected from JavaScript access. |
| Unexpected wallet requests | Active content may initiate wallet signature or transaction prompts. Such prompts do not themselves constitute authorization or guarantee execution. |
XSS is an established web security concern. Web3 URL clients must additionally account for the fact that MIME selection can be controlled through the URL rather than exclusively through a server-generated response header.
The proposal cautions against using auto mode indiscriminately for websites. Applications and gateways should establish appropriate origin isolation, content-handling restrictions, and wallet authorization boundaries. Developers and users should understand the trust implications before treating arbitrary contract output as executable web content.
Citation
Qi Zhou (@qizhou), Nicolas Deschildre (@nand2), "ERC-7087: MIME type for Web3 URL in Auto Mode [DRAFT]," Ethereum Improvement Proposals, no. 7087, May 2023. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-7087.
Conclusion
ERC-7087 extends ERC-6860 with three mechanisms for determining the MIME type of auto-mode Web3 URL responses. These mechanisms help clients handle existing contract output while introducing security considerations around the interpretation of active content.
Questions are welcome via Twitter @cardene777.
Other publications:



