Skip to content

eth_requestAccounts

Defined in EIP-1102

Requests that the user provides an Ethereum address to be identified by. This method is used to request the user's accounts and trigger wallet connection. Calling this method may trigger a user interface that allows the user to approve or reject account access for the dApp.

Parameters

None. This method does not accept any parameters.

Returns

Array<string>

An array of Ethereum addresses (hexadecimal strings), which the connected user controls. The array will typically contain a single address, which is the currently selected account in the wallet.

Example

Request:

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "eth_requestAccounts",
  "params": []
}

Response:

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": ["0xabc123..."]
}

Errors

CodeMessageDescription
4001User denied connection requestThe user rejected the request to connect with your dApp
4100UnauthorizedThe requested method and/or account has not been authorized
4900DisconnectedThe provider is disconnected from the wallet