EIPs Explained

ERC-1710 · Stagnant · ERC · 2019-01-13

ERC-1710: URL Format for Web3 Browsers

Proposes a dapp: URL scheme, with an optional chain ID, so links to decentralized apps open in whatever web3 browser the user has instead of a specific vendor's app.

What problem does it solve?

On mobile, a regular browser cannot run most dapps because it has no injected wallet. Dapps therefore deep-link users into a specific wallet's built-in browser, and every wallet had its own URL scheme for this. A dapp had to pick a wallet to recommend, even if the user already had a different one installed.

Reusing the ethereum: scheme from ERC-831 was not a good fit either: many apps register it (wallets, identity apps), and on iOS the OS picks unpredictably between apps that claim the same scheme, so the link might open in an app that has no browser at all.

ERC-1710 proposes a dedicated, vendor-neutral scheme for "open this website in a web3 browser".

How it works

dapp:[chain_id@]dapp_url
  • dapp_url is a normal RFC 3986 URI, written without the https:// prefix.
  • chain_id is optional. If present, the browser switches to that chain ID (as defined in EIP-155) before loading the page, so the user lands on the right network.

Example from the spec: dapp:[email protected]/brunobar79?utm_source=github opens a web3 browser, selects chain 1 (mainnet), then navigates to https://peepeth.com/brunobar79?utm_source=github.

Dapps can still recommend a particular wallet through deferred deep linking, but if the user already has any browser that supports dapp:, the link just works.

Sample code

Building a link, and how a web3 browser might interpret one (TypeScript):

function toDappLink(url: string, chainId?: number): string {
  const bare = url.replace(/^https?:\/\//, "");
  return chainId !== undefined ? `dapp:${chainId}@${bare}` : `dapp:${bare}`;
}

function parseDappLink(link: string): { chainId?: number; url: string } {
  const m = link.match(/^dapp:(?:(\d+)@)?(.+)$/);
  if (!m) throw new Error("not a dapp: URL");
  return { chainId: m[1] ? Number(m[1]) : undefined, url: `https://${m[2]}` };
}

toDappLink("https://app.example.org/swap", 10);
// "dapp:[email protected]/swap"

parseDappLink("dapp:[email protected]/brunobar79?utm_source=github");
// { chainId: 1, url: "https://peepeth.com/brunobar79?utm_source=github" }

An HTML link a dapp could show to mobile visitors:

<a href="dapp:[email protected]/">Open in your web3 browser</a>

Things to know

  • Status: Stagnant. Support depends on wallets registering the dapp: scheme; check each target wallet before relying on it.
  • The spec does not say whether http or https should be used when opening the target; the example implies https.
  • The @ separator can be ambiguous if the dapp URL itself starts with user-info (user@host). Avoid such URLs.
  • Today, many dapps instead connect to mobile wallets through WalletConnect (ERC-1328) or wallet-specific universal links. For payment requests, use ERC-681.

#url #deep-link #mobile #web3-browser #wallet

Details

Authors
Bruno Barbieri (@brunobar79)
Status
Stagnant
Type
Standards Track / ERC
Created
2019-01-13
Requires

Machine-readable: Markdown · JSON