---
eip: 1102
label: EIP-1102
title: Opt-in account exposure
status: Stagnant
type: Standards Track
category: Interface
created: 2018-05-04
requires: 1474
official: https://eips.ethereum.org/EIPS/eip-1102
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1102.md
canonical: https://eips.huatuo.xyz/eip-1102/
lang: en
tldr: Lets browser wallets hide your accounts until you approve a site, via the eth_requestAccounts RPC method that every dapp now calls on connect.
tags: [wallet, provider, privacy, dapp, interface]
---

# EIP-1102: Opt-in account exposure

> This proposal describes a communication protocol between dapps and Ethereum-enabled DOM environments that allows the Ethereum-enabled DOM environment to choose what information to supply the dapp with and when.

**TL;DR:** Lets browser wallets hide your accounts until you approve a site, via the eth_requestAccounts RPC method that every dapp now calls on connect.

## What problem does it solve?

Early Ethereum browsers and extensions injected a provider (usually `web3`) into every page with the user's accounts already exposed. Any website you visited could read your addresses, look up your balances and history, and pop up transaction requests without asking first. Most users would reject an unexpected transaction, but the page should never have been able to see the accounts or prompt for them at all.

EIP-1102 changes the default: the wallet exposes **no accounts** until the user explicitly approves access for that site.

## How it works

- The browser or extension exposes a provider at `window.ethereum`.
- Providers add a new RPC method, `eth_requestAccounts`. Calling it may open a wallet prompt asking the user to approve or reject the site.
- If the user approves, the call resolves with an array of at least one account.
- If no accounts are available for any reason (most often because the user said no), the call rejects with an informative error.
- The dapp should only continue with account-dependent features after the call resolves.

The proposed start-up flow is simple:

```
START dapp
IF provider is defined
    REQUEST account access (eth_requestAccounts)
    IF user approves -> CONTINUE dapp
    IF user rejects  -> STOP (or degrade gracefully)
IF provider is undefined
    STOP dapp
```

An earlier version of the proposal used a method called `ethereum.enable()`. The spec itself marks it **deprecated** in favour of `eth_requestAccounts`.

## Sample code

The spec's examples use the older `ethereum.send(...)` call style. Today's providers follow [EIP-1193](/eip-1193/), so the same method is called through `request`. With ethers v6:

```ts
import { BrowserProvider } from "ethers";

async function connect() {
  if (!window.ethereum) throw new Error("No wallet found");

  try {
    // Opens the wallet's "connect this site?" prompt if needed
    const accounts: string[] = await window.ethereum.request({
      method: "eth_requestAccounts",
    });

    const provider = new BrowserProvider(window.ethereum);
    const signer = await provider.getSigner(accounts[0]);
    console.log("connected as", await signer.getAddress());
    return signer;
  } catch (err) {
    // User rejected, or no accounts available
    console.warn("account access denied", err);
  }
}
```

Note that `eth_accounts` (without "request") simply returns the accounts the site already has access to, which is an empty array before approval.

## Things to know

- **Status: Stagnant.** Even so, the `eth_requestAccounts` method it introduced is effectively universal: browser wallets support it and dapp libraries call it when you click "Connect wallet".
- The provider interface itself (`request`, events such as `accountsChanged`) is standardized separately in [EIP-1193](/eip-1193/). Finer-grained permissions were later proposed in [EIP-2255](/eip-2255/).
- The spec assumes a single provider at `window.ethereum`. When several wallet extensions are installed they compete for that global; [EIP-6963](/eip-6963/) defines event-based discovery of multiple providers.
- Approval is per site and is remembered by the wallet. Do not call `eth_requestAccounts` on page load without user action; trigger it from a button so users understand why the prompt appears.


---

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