EIP-7039 A scheme-handler option for wallet discovery (Scheme-Handler Discovery Option for Wallets)

No call decision · Other · EIP status Stagnant · created 2023-05-15

Proposes a way for a web page to find and connect to a wallet using an iframe and a custom protocol (web+evm://). It requires no special permissions in the browser extension and allows multiple wallets to be used at the same time.

Why it is needed

Currently, most ways for a web page to find a wallet rely on a global object such as window.ethereum, which supports only one active wallet at a time. Also, for a browser extension to act as a wallet, it must request broad permissions (content_scripts, permissions) that let it inject code into every web page. As a result, users are effectively forced to install and use only one wallet extension, and developers creating new wallets face a barrier to entry because of this demand for broad permissions. SHADOW (Scheme-Handler Discovery Option for Wallets) lets extensions register only as protocol handlers without special permissions, and lets wallets that are not extensions, such as web wallets or hardware wallets, participate in the same way, so that multiple wallets can coexist at the same time and users can choose among them as needed.

What changes

Today

After EIP-7039

Who is affected

In depth

The procedure for initiating a connection

The web page first attaches a message event listener to window, then creates an iframe tag with its src attribute set to web+evm:// and attaches it to the DOM. It then waits for a message event whose source matches that iframe's contentWindow, and stores the first port delivered in that event as the primary port. The data of this event can optionally include a ProviderInfo interface (name: string, icon: string), letting the page learn the wallet's name and icon URI in advance.

The format of requests and responses

The requester sends postMessage to the primary port and can pass a MessagePort as the first item in the transfer list, which is called the reply port. The message data must follow EIP-1193's RequestArguments interface as is. The responder sends a response on that port only once, and only if a reply port was provided, following a Response interface that contains exactly one of result or error (result?: unknown, error?: ProviderRpcError). A request sent without a reply port is not treated as an error even in situations where a response would otherwise have been expected.

The icon image spec is still empty

The icon field of ProviderInfo is meant to be used as a URI pointing to an image, but the original Icon Images section is left as a TODO, so the concrete format (size, file type, etc.) is undefined.

Why a port is handed off: iframe relay handoff

The reason for passing a separate port in the first message rather than using the iframe's contentWindow port directly is to let the iframe fully hand off communication in certain situations. This lets the web page and the wallet (provider) communicate directly afterward without relaying through the iframe.

Compatibility with EIP-1193

SHADOW is not directly compatible with EIP-1193, but it deliberately uses nearly identical data structures such as RequestArguments and ProviderRpcError to reduce the burden of transition. The source states that an EIP-1193-compatible provider can be built on top of this approach, but the concrete example remains an unwritten TODO.

Security Considerations is still mostly empty

The only stated requirement is that both the provider and the web page MUST verify the sending origin before trusting a message. The section itself ends with a TODO note saying "more discussion is needed," so no other threat models are addressed.

Current status: Stagnant

This EIP's status is Stagnant, meaning it is no longer actively progressing. Several sections, including Icon Images, Backwards Compatibility examples, and Security Considerations, remain at a draft level marked TODO, so details may change or be filled in if discussion resumes. This material does not include any core developer call record addressing fork inclusion.

Original EIP · ← EIPs