ERC-2525 · Stagnant · ERC · 2020-02-19
ERC-2525: ENSLogin
A stagnant proposal to log in to dapps with just an ENS name, whose text record points to the code that builds your wallet's EIP-1193 provider.
What problem does it solve?
A dapp that wants to support many wallets has to integrate each one: browser extensions inject an object, while hosted and hardware wallets need their own SDKs. Users must also know which button to press. New wallets struggle because dapps only integrate the popular ones.
ENSLogin proposes flipping this around: the user types an ENS name such as alice.wallet.eth, and the name itself tells the dapp which wallet to load. Any wallet that publishes a compatible module would then work with every ENSLogin dapp, with no central approval list.
How it works
- The dapp asks the user for an ENS name.
- An SDK resolves the name through ENS (EIP-137) to get an address and reads a text record (EIP-634) with key
enslogin. If the name has none, it falls back to the parent domain'senslogin-defaultrecord — so a wallet that hands out subdomains can set it once for all its users. - The record holds a link like
ipfs://…orhttps://…. The SDK appends a suffix for the chain (SLIP-44 coin type,60for Ethereum) and language, e.g./60/js, and downloads that module. - The module exposes a function
provider(config) => Promise<provider>that returns an EIP-1193 provider. From there the dapp uses it like any injected wallet.
The dapp may pass a configuration object: a common provider section (network, ENS registry address), wallet-specific keys prefixed with _, and SDK-specific keys prefixed with __.
Wallet-specific code lives only in the wallet's module, never in the SDK, so the SDK does not need updating when wallets change.
Sample code
Resolving the enslogin text record with ethers v6 (the first step of the flow):
import { JsonRpcProvider } from "ethers";
const provider = new JsonRpcProvider(process.env.RPC_URL);
async function findLoginModule(name: string): Promise<string | null> {
const resolver = await provider.getResolver(name);
const own = await resolver?.getText("enslogin");
if (own) return own;
const parent = name.split(".").slice(1).join(".");
const parentResolver = await provider.getResolver(parent);
return (await parentResolver?.getText("enslogin-default")) ?? null;
}
const base = await findLoginModule("alice.wallet.eth");
if (base) console.log("load module from", `${base}/60/js`);
Minimal config object from the spec:
{ "provider": { "network": "goerli" } }
Things to know
- Status is Stagnant. The spec is incomplete: the provider-link format is marked "not yet specified", the record keys are "subject to change", and the prototype and multichain sections are TODO.
- Loading and running code from a URL found in a name record is a large trust decision for a dapp. The spec leaves sandboxing and integrity checks open.
- ENSLogin only discovers the wallet; key storage and signing are entirely up to the wallet provider.
- Multichain addresses in ENS are covered by EIP-2304.