Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines EIP-2700, which proposes a common object through which JavaScript applications can receive notifications of blockchain state changes from Ethereum providers.
This article translates, summarizes, and supplements the material linked below.
I have also covered other EIPs.
Overview
The proposal standardizes how JavaScript applications receive chain-state notifications from an Ethereum provider, a service or software component enabling communication with Ethereum.
General Architecture
Ethereum providers and JavaScript applications can communicate through a shared JavaScript object.
The standard defines an object available to JavaScript applications and a mechanism for receiving notifications from an Ethereum provider through that object.
Notification Mechanism
The standard focuses on the notification mechanism. It does not define particular notification payloads or how clients and providers agree on their contents.
Events such as successful transactions or new blocks are therefore outside the scope of the standard.
Unspecified Implementation and Discovery
The proposal does not define how the object is exposed to JavaScript applications or how clients and providers discover and use it. Those details are left to future standards.
The standard proposes a common way for JavaScript applications to detect changes in Ethereum state. It does not prescribe how the mechanism is implemented or what information is exchanged.
Motivation
The proposal discusses exposing an Ethereum provider to JavaScript applications and scripts within JavaScript execution environments, such as Node.js, Electron, and web browsers.
Customizing Execution Environments
A JavaScript runtime or its plugins can inject specific objects into the execution environment.
This allows runtime and plugin developers to provide applications and scripts with additional functionality or data.
Exposing Ethereum Providers
Runtime or plugin developers may choose to expose an Ethereum provider to deliver notifications about Ethereum blockchain state changes.
This provides applications with an interface for interacting with Ethereum.
Why a Standard Is Needed
Maximizing compatibility between providers and clients requires a standard for the shape of the exposed object, including its structure and methods.
A common interface provides consistency across runtimes and plugins, simplifying Ethereum integrations for developers.
A standardized mechanism for accessing Ethereum data and detecting state changes within JavaScript environments allows developers to interact with blockchain data consistently across different runtimes.
Specification
The proposal defines a JavaScript interface for Ethereum providers, primarily specifying methods for adding and removing event listeners.
Interface Definition
The EthereumProvider interface contains two methods: on and removeListener.
The on method accepts an event name (eventName) and a listener function (listener) invoked when that event occurs.
The removeListener method removes a listener previously registered through on.
Behavioral Requirements
When on registers a listener for an event name recognized by the provider, the provider must invoke the listener when the event occurs.
If the same listener is registered for the same event multiple times through on, the provider may invoke it once or once per registration.
When removeListener is called with the registered event name and listener, the provider must reduce the number of invocations for that event by one.
Specific Event and Listener Definitions
The specific events that listeners can observe and the shapes of their callback functions are not defined here. Separate standards can define those details.
The proposal establishes fundamental behavioral rules for how Ethereum providers interact with JavaScript applications, particularly event subscription and listener management.
Additional Notes
This Ethereum Improvement Proposal formalizes an existing specification. Its purpose is primarily to document established behavior.
Retrospective EIP
Because the EIP codifies an existing interface, it has limited scope for introducing improvements. Its focus is formal documentation of existing practices.
Limits on Improvements
Potential improvements, such as using discriminated unions for listener parameters or defining on more strictly, are not extensively incorporated. The EIP is based on an existing interface rather than a substantial redesign.
Intentional Omission of Events
The EIP deliberately does not enumerate specific events that listeners can observe.
The set of events evolves over time. Events listed in an initial version might later be deprecated or fall out of use.
Omitting those details allows the specification to remain relevant and flexible as the ecosystem evolves.
This EIP formalizes an existing Ethereum interface while leaving areas that may evolve, such as particular event definitions, open to future development. This preserves flexibility and adaptability.
Security
The proposal discusses the relationship between an Ethereum provider and its client, emphasizing that the relationship is based on trust.
Trust Relationship
A client, such as an application or script interacting with Ethereum, has a trust relationship with its Ethereum provider, which supplies access to the Ethereum network.
The proposal assumes that users trust the provider they use.
Provider Introduction
The trust relationship is also reflected in how a provider is injected into the client or how the client explicitly requests a connection to the provider.
In the model described by the proposal, the provider is present because its use has been authorized or desired by the user.
Implicit Trust
Users implicitly trust the Ethereum provider to operate within their client environment when they select the provider and authorize its use.
The provider-client relationship is based on user trust. Under the proposal's model, the provider is embedded in the client or accessed by it because the user trusts and selects it.
Citation
Micah Zoltu (@MicahZoltu), Erik Marks (@rekmarks), "EIP-2700: JavaScript Provider Event Emitter," Ethereum Improvement Proposals, no. 2700, June 2020. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-2700.
Conclusion
EIP-2700 proposes a common JavaScript object through which applications receive Ethereum blockchain state-change notifications from providers.
If you have questions, feel free to contact me on Twitter.
I also publish articles on the following platforms.


