---
eip: 6860
label: ERC-6860
title: Web3 URL to EVM Call Message Translation
status: Draft
type: Standards Track
category: ERC
created: 2023-09-29
requires: 137
official: https://eips.ethereum.org/EIPS/eip-6860
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-6860.md
canonical: https://eips.huatuo.xyz/eip-6860/
lang: en
tldr: "Defines how a web3:// URL such as web3://uniswap.eth/ is turned into a read-only EVM call, so browsers and gateways can load on-chain HTML, SVG or JSON directly from contracts."
tags: [url, web3, ens, frontend, onchain-web]
---

# ERC-6860: Web3 URL to EVM Call Message Translation

> A translation of an HTTP-style Web3 URL to an EVM call message

**TL;DR:** Defines how a web3:// URL such as web3://uniswap.eth/ is turned into a read-only EVM call, so browsers and gateways can load on-chain HTML, SVG or JSON directly from contracts.

## What problem does it solve?

To read on-chain data from a browser today you go through someone's website, RPC provider or block explorer, which translates for you. ERC-6860 lets a URL itself describe the contract call, so any compliant client or gateway can fetch content straight from the chain. A contract can then serve a whole web page (HTML, CSS, images, SVG) and be linked to like a normal site.

It is an updated version of [ERC-4804](/eip-4804/), with a formal ABNF grammar, corrections and clarifications.

## How it works

A URL has the shape:

```
web3://[from@]contractName[:chainId]/path?query#fragment
```

- `web3` (or `w3`) is the scheme. `from` optionally sets the caller; default is `0x0`.
- `contractName` is an address or a name, resolved via ENS ([ENS](/eip-137/), resolution rules in [ERC-6821](/eip-6821/)). `chainId` defaults to the name service's chain (1 for `.eth`).
- Only read-only (`view`) calls are defined.

The client first calls `resolveMode()` on the contract:

- **Manual mode** (returns `"manual"` as bytes32): the raw path and query are sent as calldata (an empty path becomes `/`, i.e. `0x2f`). The contract parses it itself and returns ABI-encoded `bytes`. MIME type is `text/html` unless the path ends in a file extension. Relative URLs work like HTTP.
- **Auto mode** (returns `"auto"`, zero, or reverts): the path is `/method/arg1/arg2...`, ABI-encoded into a normal function call. Arguments can be typed (`uint8!5`, `string!hello.svg`) or auto-detected: digits → `uint256`, 32-byte hex → `bytes32`, 20-byte hex → `address`, other hex → `bytes`, `true`/`false` → `bool`, else a name to resolve to an address.
- In auto mode, `?returns=(uint256,string)` asks the client to decode the result to JSON (integers as `0x` hex, per JSON-RPC). `?returns=()` returns the raw bytes as hex in JSON. With no `returns`, the result is treated as ABI-encoded `bytes`.

## Sample code

Example URLs from the spec and what they call:

```text
web3://w3url.eth/                          # manual mode: calldata 0x2f, served as text/html
web3://cyberbrokers-meta.eth/renderBroker/9999
                                           # auto mode: renderBroker(uint256 9999)
web3://0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/balanceOf/vitalik.eth?returns=(uint256)
                                           # balanceOf(<vitalik.eth address>) -> ["0x..."] as application/json
```

A contract that serves pages in manual mode:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

contract Site {
    function resolveMode() external pure returns (bytes32) {
        return "manual";
    }

    // Any calldata that isn't resolveMode() lands here; it is the raw URL path.
    fallback(bytes calldata path) external returns (bytes memory) {
        if (keccak256(path) == keccak256("/")) {
            return abi.encode(bytes("<html><body>Hello from the chain</body></html>"));
        }
        return abi.encode(bytes("Not found"));
    }
}
```

## Things to know

- Status is **Draft**. It supersedes ERC-4804's details (the `ethereum-web3://` and `eth-web3://` schemes are dropped, more argument types are added, and integer results are hex rather than strings).
- Browsers don't speak `web3://` natively; you need a gateway, extension or dedicated client, and you trust it to make the call honestly unless it verifies results.
- Auto-detected argument types can surprise you, e.g. a numeric-looking string becomes `uint256`. Use explicit `type!value` when it matters.
- Large pages are bounded by what an `eth_call` can return under the node's gas limit for calls.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-6860
