Description:
-
At the moment MetaMask doesn’t allow to add alternative Ethereum network via API.
On “wallet_addEthereumChain” call witch chainId = 1
MetaMask throws error "MetaMask - RPC Error: May not specify default MetaMask chain. " -
If you already added second Ethereum chain manually using UI, and switch between default and custom network witch chainId = 1, “chainChanged” event isn’t faired. Since chainId stay the same.
I suggest to implement tracking of chains by RPC url, and allow to user to programmatically add several chains with ChainId=1. If there is any security concerns then add white list on this programmatically added chains.
Purpose:
Protect DEX / DEX aggregators users from sandwich attacks by using protected RPC.
On the Ethereum network, DEX / DEX aggregators users constantly undergo to sandwich attacks, about 5 - 10% of all swaps, are sandwiched.
As a dApp developer of swap app (DEX aggregator) I want to provide safe RPC feature to user.
This safe RPC will direct swap transactions into Flashbots or any other provider of private transactions. By private I mean transaction that go directly to block bypassing memory pool.
Extension/Mobile/Both:
This behaviour you can see on Extension, but it most probably also applies to Mobile