Summary
# EIP-1193: How Ethereum providers connect dapps, wallets, and RPC
EIP-1193 is the Ethereum Provider JavaScript API specification. It defines a small, transport-agnostic interface that lets a dapp request blockchain operations from a provider, such as reading chain data, requesting accounts, sending transactions, or subscribing to provider events. In a browser, that provider is often exposed through an injected object such as window.ethereum, although the specification does not require that name or a browser environment.
The important distinction is that EIP-1193 is an application-facing provider interface, not an RPC endpoint, wallet, signing system, or node implementation. An EIP-1193 provider may forward JSON-RPC requests to an HTTP or WebSocket RPC service, while a wallet provider may also handle account access and transaction authorization. OnFinality can provide the RPC API or dedicated node infrastructure behind an application’s provider layer; the application still needs to implement wallet, signing, permissions, and event handling correctly.
This reference explains the request method, standard events, error handling, provider-versus-RPC boundaries, and practical checks for production dapps. For infrastructure selection, compare the required chains and methods in the supported RPC networks, then review RPC pricing before choosing a hosted RPC API or dedicated node deployment.
Key Takeaways
- EIP-1193 standardizes the provider-side JavaScript interface used by dapps to request Ethereum-compatible operations.
- The core method is provider.request({ method, params }), which returns a promise or rejects with an error.
- EIP-1193 does not define a node, RPC URL, wallet, private-key store, or mandatory browser global.
- The chainChanged, accountsChanged, connect, disconnect, and message events require explicit application handling.
- Wallet authorization and transaction signing are separate concerns from reading data through an RPC service.
- Applications should validate chain and account state at the request boundary and treat provider errors as structured input.
- Hosted RPC APIs and dedicated nodes solve infrastructure needs behind the provider layer; they do not replace wallet UX or authorization logic.
Decision guide: identify the layer you actually need
Choose an EIP-1193 provider when your code needs a consistent JavaScript boundary for wallet interaction or Ethereum-compatible JSON-RPC requests. Browser wallets, mobile wallet connectors, embedded wallets, and server-side adapters can all expose a provider-shaped interface.
Choose an RPC API when your application needs node access without operating the node itself. Choose dedicated node infrastructure when operational control, isolation, custom configuration, or a specific data-access profile makes managed shared access insufficient. These choices are complementary: an application can consume an OnFinality RPC API through an EIP-1193 adapter, while a wallet provider can remain responsible for accounts and signing.
Do not treat EIP-1193 compliance as proof that a provider supports every RPC method, every event, or every network. The specification defines the interface contract; the underlying wallet, adapter, node, and chain determine available capabilities.
- Dapp needing wallet access: request an injected or connector-provided EIP-1193 provider.
- Backend or read-heavy service: use an RPC client or adapter connected to an RPC API; a wallet provider is not required.
- Application requiring both wallet actions and server reads: keep wallet and backend providers separate and define which layer handles each operation.
- Infrastructure buyer: verify chain coverage, method availability, WebSocket behavior, historical-data requirements, quotas, and support terms independently of EIP-1193.
| Criterion | What to check | Why it matters |
|---|---|---|
| EIP-1193 provider | request() behavior, events, error shape, account and chain transitions | This is the application-facing contract used by wallet and connector integrations |
| RPC API | HTTP or WebSocket transport, JSON-RPC methods, access policy, quotas, and historical data | This is the node-access layer that serves reads, simulations, subscriptions, and broadcasts |
| Dedicated node | Node client, storage profile, upgrades, operational ownership, and network-specific requirements | This changes who controls the infrastructure behind the provider or RPC client |
The EIP-1193 contract in one request
The central API is request, which accepts an object containing a string method and an optional params value. It returns a promise for the method result. The method name and parameter encoding follow the underlying Ethereum-compatible RPC or provider convention; EIP-1193 does not create a separate replacement for JSON-RPC.
A minimal read request can look like this:
const blockNumber = await provider.request({ method: "eth_blockNumber" });
A wallet-sensitive request is different because it may trigger user permission or signing behavior:
const accounts = await provider.request({ method: "eth_requestAccounts" });
The first call reads chain state. The second asks the provider to expose accounts and may require user interaction. Applications should not assume that a provider can silently return accounts or sign a transaction merely because it implements request.
- Use feature detection before reading an injected provider: check that a provider object exists and that
requestis callable. - Keep method parameters in the format expected by the target RPC method, commonly hex-encoded quantities and data for Ethereum JSON-RPC.
- Handle rejected promises at the boundary where user actions, network state, and node errors enter the application.
- Do not expose private keys to an RPC endpoint; RPC infrastructure submits requests and may broadcast signed payloads, but it should not be treated as a key manager.
| Criterion | What to check | Why it matters |
|---|---|---|
| Read chain state | eth_chainId, eth_blockNumber, eth_getBalance, contract calls | These requests normally depend on the connected network and node’s available data |
| Request account access | eth_requestAccounts and the provider’s authorization flow | Account exposure is permissioned and may be rejected or unavailable |
| Submit a transaction | Wallet signing, gas fields, chain state, and eth_sendTransaction behavior | A provider interface does not guarantee that a wallet can sign or broadcast every transaction type |
| Use a custom method | Provider and underlying RPC support, parameter format, and error behavior | EIP-1193 permits extensibility, but method support is implementation-specific |
Events are state changes, not polling shortcuts
EIP-1193 defines provider events that let an application react when connection or wallet state changes. The most important events for a dapp are accountsChanged and chainChanged. A wallet can change the selected account or chain while the page remains open, so reading the initial state once is not sufficient.
The connect event indicates that the provider can service requests for a chain, while disconnect indicates that the provider cannot service RPC requests. The specification also defines a message event for provider-specific messages. Applications should treat event payloads as provider input and validate them before changing application state.
A typical event wiring pattern is:
provider.on("accountsChanged", (accounts) => { /* update session state */ }); provider.on("chainChanged", (chainId) => { /* verify supported chain */ }); provider.on("disconnect", (error) => { /* disable network actions */ });
When a chain changes, refresh network-dependent data and verify that the application’s contracts, token lists, transaction parameters, and RPC configuration match the new chain. Do not merely update a label in the user interface.
- Treat an empty accounts array as a meaningful state: the provider may still exist, but the dapp no longer has an exposed account.
- Use the chain ID supplied by the provider as the source for session validation, then compare it with the networks your application supports.
- Avoid registering duplicate listeners during component rerenders; remove listeners when the component or session is disposed.
- Do not assume all providers implement identical optional event behavior. Test the wallet and connector combinations used by your application.
Error handling: classify before retrying
An EIP-1193 provider reports failures by rejecting the request promise. The specification defines error categories and commonly used codes, including user rejection, unauthorized access, unsupported method, disconnected provider, and chain-disconnected conditions. Exact messages and additional data can vary by implementation.
A rejected request is not automatically an infrastructure failure. A user rejecting a signature should normally end that action without an immediate retry. A disconnected provider may require reconnection or a network-state update. An unsupported method may require a capability check, a different provider, or a different RPC path.
Use an error boundary that records the method and application state without logging sensitive request data. A generic handling pattern is:
try { await provider.request({ method: "eth_sendTransaction", params: [transaction] }); } catch (error) { const code = typeof error?.code === "number" ? error.code : undefined; if (code === 4001) { // The user rejected the request; do not retry automatically. } else { // Classify, surface, or retry according to the provider and method. } }
The numeric code shown in this example is widely used for user rejection, but applications should still account for wallet-specific behavior and inspect the provider’s returned error object.
| Criterion | What to check | Why it matters |
|---|---|---|
| User rejected request | User-rejection code or provider-specific equivalent | Retrying can create repeated prompts and poor wallet UX |
| Unauthorized or no account | Permission state and accountsChanged result | The dapp may need to request access or disable account actions |
| Unsupported method | Provider capability and RPC method availability | A compliant request interface does not imply universal method support |
| Disconnected or chain unavailable | Connection state, chain ID, transport, and RPC service status | The next step may be reconnection, failover, or an infrastructure investigation |
Provider, wallet, and RPC endpoint: keep responsibilities separate
A wallet provider commonly combines several functions: it exposes an EIP-1193 interface, mediates account permissions, signs user-approved payloads, and forwards some requests to a node. A plain RPC adapter can also implement the same interface for read operations, but it may have no accounts and cannot authorize user signatures.
This distinction matters when designing server and browser architecture. A browser dapp should not assume that its injected provider is suitable for backend indexing, unrestricted historical queries, or operational monitoring. A backend should not depend on a user’s browser wallet to provide continuous access.
For node access, use the supported RPC networks to identify a matching OnFinality network page and select the transport and capabilities your workload needs. For a hosted deployment, compare RPC pricing. If the application requires infrastructure under a separate operational model, evaluate a dedicated node rather than changing the dapp’s provider abstraction.
- Browser wallet: user authorization, account exposure, signing, and chain selection.
- EIP-1193 adapter: a consistent JavaScript request and event boundary.
- RPC API: node-backed reads, simulations, broadcasts, and possibly subscriptions, subject to service capabilities.
- Dedicated node: a deployment option for teams that need more direct infrastructure control.
- Application code: chain validation, transaction policy, error UX, listener lifecycle, and secret management.
Production checks before shipping an EIP-1193 integration
Test the complete lifecycle rather than only a successful balance lookup. The relevant behavior includes initial provider discovery, permission denial, account switching, chain switching, wallet disconnection, unsupported methods, rejected signatures, stale UI state, and duplicate event listeners.
Run read and write paths against each supported chain and wallet combination. A request that works through one wallet or RPC adapter may fail elsewhere because method support, transaction fields, error formatting, or event timing differs. Record the provider identity and chain context in diagnostics, but avoid storing account or transaction data that is not needed.
For infrastructure validation, probe the exact methods used by the application instead of relying on a generic health check. A successful eth_blockNumber response does not establish that trace methods, archive reads, contract simulation, WebSocket subscriptions, or transaction propagation are available for the same endpoint.
- Confirm the provider exists before calling
request. - Validate the expected chain ID after connection and after every
chainChangedevent. - Treat account exposure as session state and update it after every
accountsChangedevent. - Use method-specific timeouts and bounded retries for transport failures; never automatically retry user rejection.
- Test both HTTP-style request flows and WebSocket event flows when subscriptions are part of the product.
- Keep wallet RPC access and backend RPC access independently configurable so one user session does not become a service dependency.
- Check the provider and RPC documentation for supported methods before enabling advanced features.
| Criterion | What to check | Why it matters |
|---|---|---|
| Wallet and connector matrix | Injection, permission prompts, account changes, chain changes, and disconnect behavior | Provider implementations can differ at the integration boundary |
| RPC method matrix | Every read, simulation, broadcast, trace, and subscription method the product uses | Basic JSON-RPC success does not prove workload compatibility |
| Failure recovery | Retry policy, failover rules, stale state handling, and user messaging | Provider errors can represent user intent, chain state, or infrastructure conditions |
| Operational fit | Network coverage, usage limits, historical data, transport support, and pricing | The provider interface does not answer infrastructure-buying questions |
Frequently Asked Questions
What does EIP-1193 standardize?
EIP-1193 standardizes an Ethereum Provider JavaScript API centered on a promise-based request method and provider events such as accountsChanged, chainChanged, connect, disconnect, and message. It does not standardize a particular wallet, RPC URL, node implementation, or browser global.
Is EIP-1193 the same as an RPC endpoint?
No. EIP-1193 is an application-facing provider interface. An implementation may forward requests to an HTTP or WebSocket RPC endpoint, but the endpoint is the node-access layer and the provider may also handle accounts, permissions, signing, and events.
Does EIP-1193 support all Ethereum JSON-RPC methods?
The interface can pass through many JSON-RPC methods, but support is implementation- and network-dependent. Check the wallet, adapter, and underlying RPC provider for the methods, parameters, historical data, tracing, and subscriptions your application needs.
What is the difference between `eth_accounts` and `eth_requestAccounts`?
eth_accounts checks which accounts are currently exposed to the dapp. eth_requestAccounts asks the provider to request account access and may display a wallet permission prompt. Both can return no accounts, and the application should handle rejection and later accountsChanged events.
Can a server use an EIP-1193 provider?
Yes. A server can use an EIP-1193-shaped adapter around an RPC transport, but it will not automatically have browser wallet behavior or user accounts. Backend services should normally use their own RPC configuration and signing controls rather than depend on an injected wallet.
Where does OnFinality fit with EIP-1193?
OnFinality can be used as an RPC API or dedicated node infrastructure option behind an application’s provider or RPC client layer. EIP-1193 remains responsible for the JavaScript-facing request and event contract; OnFinality does not replace wallet authorization or transaction-signing logic.