{"id":21470483,"url":"https://github.com/manifoldfinance/wallet_switchnetworkrpcprovider","last_synced_at":"2025-07-15T07:31:16.471Z","repository":{"id":39797830,"uuid":"473695616","full_name":"manifoldfinance/wallet_switchNetworkRpcProvider","owner":"manifoldfinance","description":"draft EIP for a new wallet_ rpc method","archived":false,"fork":false,"pushed_at":"2022-08-01T18:57:30.000Z","size":82,"stargazers_count":5,"open_issues_count":10,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-19T00:36:54.554Z","etag":null,"topics":["eip","ethereum","proposal","rpc","wallet"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/manifoldfinance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-24T16:53:41.000Z","updated_at":"2023-05-10T01:09:44.000Z","dependencies_parsed_at":"2022-09-18T04:41:21.385Z","dependency_job_id":null,"html_url":"https://github.com/manifoldfinance/wallet_switchNetworkRpcProvider","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fwallet_switchNetworkRpcProvider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fwallet_switchNetworkRpcProvider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fwallet_switchNetworkRpcProvider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/manifoldfinance%2Fwallet_switchNetworkRpcProvider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/manifoldfinance","download_url":"https://codeload.github.com/manifoldfinance/wallet_switchNetworkRpcProvider/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226027936,"owners_count":17562134,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["eip","ethereum","proposal","rpc","wallet"],"created_at":"2024-11-23T09:27:55.302Z","updated_at":"2024-11-23T09:27:55.925Z","avatar_url":"https://github.com/manifoldfinance.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\neip: 0000\ntitle: Wallet Switch Active RPC Provider Method (`wallet_switchNetworkRpcProvider`)\ndescription: An RPC method for switching the wallet's active RPC Provider\nauthor: Sam Bacha (@sambacha) \u003cAdditional Contributors HERE\u003e\ndiscussions-to: https://ethereum-magicians.org/t/eip-wallet-switchactiverpcprovider-rpc-method-for-supporting-aa-custom-rpc-methods-more/9142\nstatus: draft, v0.4.0\ntype: Standards Track\ncategory: Interface\ncreated: 2022-04-25\nrequires: 86, 155, 695, 1193\n---\n\n# Abstract\n\nThe `wallet_switchNetworkRpcProvider` RPC method allows Ethereum applications (\"dapps\") to request\nthat the wallet switches its active RPC Provider backend if the wallet has a concept thereof.\n\nThe caller MUST specify a chain ID. The caller MUST specify a valid URL for the RPC Endpoint\n\nThe wallet application **may not** arbitrarily refuse or accept the request. A status code of `200`\nis returned if the active RPC was successfully switched, A status code of `[TODO]` otherwise.\n\n\n\u003e Important cautions for implementers of this method are included in the\n\u003e [Security Considerations](#security-considerations) section.\n\n## Motivation\n\nThe purpose `wallet_switchNetworkRpcProvider` is to provide dapps with a way of requesting to switch\nthe wallet's active chain's RPC Provider, which they would otherwise have to ask the user to do manually.\n\n- Account Abstraction via private mempool (EIP4339)\n- Fallback provider for RPC Connectivity issues (at the Server side) (Example: Infura Service\n  Outage)\n- Failover provider for RPC Connectivity issues (as the Client side) (Example: Smartphone\n  connectivity issues)\n- Providing Transaction Privacy via RPC Provider endpoint (e.g. Flashbots, OpenMEV, EdenNetwork,\n  etc)\n- Accessing custom RPC Methods supported by the custom RPC Endpoint's Provider\n\n### Existing EIP Specifications do not service this end\n\n`updatedEthereumChain` specifies that the \"...Wallet should default the `rpcUrl` to **any existing\nendpoints matching a chainId known previously to the wallet**, otherwise it will use the provided\nrpcUrl as a fallback.\"\n\n`wallet_switchNetworkRpcProvider` intentionally and explicitly is purely concerned with switching\nthe active RPC endpoints, regardless of any other metadata associated therewith.\n\n## Rationale\n\nAll dapps require the user to interact with one or more Ethereum chains in order to function. Some\nwallets only supports interacting with one chain at a time. We call this the wallet's \"active\nchain\".\n\nThe Wallet's \"active chain\" has an \"active RPC Provider\"\n\n`wallet_switchNetworkRpcProvider` enables dapps to request that the wallet switches its active RPC\nconnection provider to whichever one is required by the dapp.\n\nThis enables UX improvements for both dapps and wallets as discussed in the motivation section.\n\nThe method accepts am object parameter to allow for future extensibility at virtually no cost to\nimplementers and consumers.[^4]\n\n## Specification\n  \nIETF: 4627, 2119, 3986\n\n### Key Words\n  \nThe key words \"MUST\", \"MUST NOT\", \"REQUIRED\", \"SHALL\", \"SHALL NOT\", \"SHOULD\", \"SHOULD NOT\",\n\"RECOMMENDED\", \"MAY\", and \"OPTIONAL\" in this document are to be interpreted as described in\n[RFC-2119](https://www.ietf.org/rfc/rfc2119.txt).\n\n### ResourceURI (string)\n\nUniform Resource Identifier as specified in RFC 3986, is used to identify and resolve endpoints. \nCase sensitive and MUST be case normalized as per section 6.2.2.1 of RFC 3986, m\neaning that the scheme and authority MUST be in lowercase.\n\n### JSON-RPC \n\nSince JSON-RPC utilizes JSON, it has the same type system (described in\n[RFC 4627](http://www.ietf.org/rfc/rfc4627.txt)). JSON can represent four primitive types (Strings,\nNumbers, Booleans, and Null) and two structured types (Objects and Arrays). The term \"Primitive\" in\nthis specification references any of those four primitive JSON types. The term \"Structured\"\nreferences either of the structured JSON types. Whenever this document refers to any JSON type, the\nfirst letter is always capitalized: Object, Array, String, Number, Boolean, Null. True and False are\nalso capitalized.\n\nAll member names exchanged between the Client and the Server that are considered for matching of any\nkind should be considered to be case-sensitive. The terms function, method, and procedure can be\nassumed to be interchangeable.\n\nThe Client is defined as the origin of Request objects and the handler of Response objects. The\nServer is defined as the origin of Response objects and the handler of Request objects.\n\n### `wallet_switchNetworkRpcProvider`\n\nThe method accepts an object parameter with defined fields [^parameters](##Parameters) The method\nreturns `null` if the wallet switched its active chain, and an error otherwise.\n\nThe method presupposes that the wallet has a concept of a single \"active chain\". The active chain is\ndefined as the chain that the wallet is forwarding RPC requests to.\n\n0. Terminology: Wallets are defined as 'Clients' as defined in the Specification section Dapps are\n   defined as 'Servers' as defined in the Specification section\n\n1. Wallets **MUST** switch to the requested RPC URL if the existing ChainID is known to the wallet.\n\n- A dialog box requesting a user to add this to their 'address book'/etc is _recommended_ to be\n  shown.\n\n2. Wallets **MUST NOT** reject the switch to the new RPC Provider URL if the ChainID is known to the\n   wallet for no non-error reasoning.\n\n3. If a field does not meet the requirements of this specification, the wallet **MUST** reject the\n   request.\n\n4. The wallet application **MUST NOT** arbitrarily refuse the request.\n\n### Connectivity\n  \nThe Provider is said to be \"connected\" when it can service RPC requests to at least one chain.\n\nThe Provider is said to be \"disconnected\" when it cannot service RPC requests to any chain at all.\n\nTo service an RPC request, the Provider must successfully submit the request to the remote location, and receive a response. In other words, if the Provider is unable to communicate with its Client, for example due to network issues, the Provider is disconnected.\n\n\n  \n#### Parameters\n\n\u003e .NOTE - WORK IN PROGRESS SECTION\n\n| Parameter                | Description                                                                                         | Required | Values                              | Error Code | Error Message                                                            |             |\n| ------------------------ | --------------------------------------------------------------------------------------------------- | -------- | ----------------------------------- | ---------- | ------------------------------------------------------------------------ | ----------- |\n| chainId                  | specify the integer ID of the chain as a hexadecimal string, per EIP 695                            | TRUE     | 1-4503599627370476                  | -32701     | Result: eth_ChainId Result: Transport Connection Result: Malformed Input | eth_chainId |\n| rpcUrl                   | The RPC endpoint URL to target.                                                                     | TRUE     | ^$\\|^[a-zA-Z_\\\\$][a-zA-Z_\\\\$0-9]\\*$ | -32300     | `rpcUrl` URL ADDRESS format is invalid.                                  |             |\n| rpcMethod                | The RPC method to request.                                                                          | FALSE    |                                     |            |                                                                          |             |\n| setDefault               | OPTIONAL                                                                                            | FALSE    |                                     |            |                                                                          |             |\n| setConfig                | OPTIONAL                                                                                            | FALSE    |                                     |            |                                                                          |             |\n| flushPendingTransactions | Rebroadcast all non-confirmed transactions, in order of oldest to newest, to the new rpc connection | TRUE     |                                     |            |                                                                          |             |\n| version                  |                                                                                                     | FALSE    | [0-9]+\\\\.[0-9]+\\\\.[0-9]+            |            |                                                                          |             |\n\n- `chainId`\n\n  - REQUIRED\n\n  * **MUST** specify the integer ID of the chain as a hexadecimal string, per the\n    [`eth_chainId`](./eip-695.md) Ethereum RPC method.\n  * The chain ID **MUST** be known to the wallet.\n  * The wallet is **REQUIRED** be able to switch to the specified chain and service RPC requests to\n    it. It can not reject the request based on exclusivity of pairing providers with networks.\n  * This exclusivity means wallets **MUST** allow users to be able to configure **ANY** ChainID with\n    an RPC Provider of their choice.\n\n- `rpcUrl`\n\n  - REQUIRED\n  - can't have user@password in RPC url\n\n- `flushPending`:\n\n  - REQUIRED\n\n- `setDefault`:\n  - OPTIONAL\n  - optional field for dapp's to automatically switch when logged into\n\n#### Parameters\n\n`wallet_switchNetworkRpcProvider` accepts an object parameter, specified by the following TypeScript\ninterface:\n\n```typescript\ninterface SwitchEthereumChainParameter {\n  rpcUrl: \u003cURL WITHOUT user@password\u003e // required\n  chainId: string; // required\n  flushPending: boolean // required\n  setDefault: boolean; // optional\n}\n```\n\n#### Returns\n\nThe method **MUST** return `null` if the request was successful, and an error otherwise.\n\nIf the wallet does not have a concept of an active RPC Provider, the wallet **MUST** reject the\nrequest.\n\nIf an RPC method defined in a finalized EIP is not supported, it **SHOULD** be rejected with a 4200 error per the Provider Errors section below, or an appropriate error per the RPC method's specification.\n  \n  \n### Examples\n\nThese examples use JSON-RPC, but the method could be implemented using other RPC protocols.\n\nTo switch to Mainnet:\n\n```json\n{\n  \"id\": 1,\n  \"jsonrpc\": \"2.0\",\n  \"method\": \"wallet_switchNetworkRpcProvider\",\n  \"params\": [\n    {\n      \"chainId\": \"0x1\",\n      \"rpcUrl\": \"https://\u003crpc_provider_\u003e\"\n    }\n  ]\n}\n```\n\nTo switch to the Goerli test chain:\n\n```json\n{\n  \"id\": 1,\n  \"jsonrpc\": \"2.0\",\n  \"method\": \"wallet_switchNetworkRpcProvider\",\n  \"params\": [\n    {\n      \"chainId\": \"0x5\",\n      \"rpcUrl\": \"https://\u003crpc_provider_\u003e\"\n    }\n  ]\n}\n```\n\n## Backwards Compatibility\n  \n*Tentative*: Will Examine more thoroughly \n\nDoes not introduce backwards incompatibilities with existing `wallet_` methods or EIP specifications\n\n## Security Considerations\n\nFor wallets with a concept of an active chain, switching the active chain has significant\nimplications for pending RPC requests and the user's experience. This is relevant with the parameter \nof `flushPendingTxs`. If the active RPC Provider switches the new endpoint *could* be behind the default RPC\nendpoint's 'latest' block. \n\nIn light of this, the wallet should:\n\n- Display a confirmation whenever a `wallet_switchNetworkRpcProvider` is received, clearly\n  identifying the requester and the chain that will be switched to.\n\n- The confirmation used in [EIP-1102](./eip-1102.md) may serve as a point of reference.\n\n- When switching the active RPC Provider, **MUST NOT** cancel and/or rebroadcast any pending RPC requests and/or\n  chain-specific user confirmations unless `flushPendingTransactions` is **TRUE**.\n  \n- Wallet's could provide a syncing modal until the transactions are confirmed if `flushPendingTransactions` is **FALSE**\n\n## Copyright\n\nCopyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanifoldfinance%2Fwallet_switchnetworkrpcprovider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmanifoldfinance%2Fwallet_switchnetworkrpcprovider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmanifoldfinance%2Fwallet_switchnetworkrpcprovider/lists"}