EIP-2786 Provider connect/disconnect events (Ethereum Provider Connect/Disconnect Events)

No call decision · Networking & nodes · EIP status Withdrawn · created 2020-07-15

An interface specification defining connect and disconnect events that an Ethereum provider, such as a wallet, should emit when it connects to or disconnects from a chain.

Why it is needed

Currently there is no standard way for an Ethereum provider (a wallet or node connection module) to tell an app whether it is connected to or disconnected from a chain. Apps need to know the provider's connection status in order to properly inform users of the situation and handle errors, but detection methods currently differ across providers. This EIP defines a provider as connected if it can process RPC requests for at least one chain, and disconnected otherwise, and has it emit an event whenever the status changes, so apps can detect this change and inform users. It is left to the app to decide how to handle the event once heard.

What changes

Today

After EIP-2786

Who is affected

In depth

Definition of connected/disconnected status

The source defines a provider as connected if it can process RPC requests for at least one chain, and disconnected if it cannot process RPC requests for any chain. The status is determined for the provider as a whole, not per chain, and a provider that supports multiple chains still has only a single connection status.

Conditions for the connect event and chainId

The Specification section specifically defines only the connect event. When a provider transitions from disconnected to connected, it MUST emit a connect event to all attached EIP-2700 listeners, and the listener is called with a {chainId} parameter. chainId is the integer ID of the connected chain encoded as a hexadecimal string, and if the provider supports the eth_chainId method (or a derivative of it), this value must match the return value of eth_chainId. The provider MAY call listeners in any order it chooses. The disconnect event is mentioned in the Abstract, but the Specification section provides no separate definition for it.

Inconsistency between the Abstract and Specification descriptions

The Abstract states that a connect event occurs when the provider changes from connected to disconnected, and a disconnect event occurs when it changes from disconnected to connected. The Specification section, however, states exactly the opposite: that a connect event occurs on the transition from disconnected to connected. The two descriptions contradict each other, and the source contains no correction or explanation reconciling them.

EIP-2700 dependency

This EIP specifies EIP-2700 as a requirement. The connect and disconnect events are premised on being delivered to attached listeners through the listener registration method defined by EIP-2700. In other words, this EIP itself only defines the event conditions and payload, delegating the method of registering and removing listeners to EIP-2700.

Rationale: documenting existing practice as is

The Rationale section states that this EIP retrospectively codifies an existing practice rather than proposing a new design. It explains that there is accordingly little room for improvement, such as having separate connect/disconnect events per chain.

Security Considerations: trust in the provider

The Security Considerations section points out that the relationship between the provider and the client (app) is a trust relationship. It assumes that the user implicitly trusts the very way the provider was injected into the client or the way the client explicitly obtained the connection. This EIP merely explains that connect/disconnect events are delivered on top of this trust relationship, without introducing any additional security mechanism.

Status: Withdrawn

This EIP's status is marked Withdrawn, meaning the proposal is no longer being advanced. Unlike a Draft or Review stage that could still change, it has been withdrawn and was not adopted as a standard. No related call records were provided.

Original EIP · ← EIPs