MetaMask / MetaMask/metamask-extension

Help protect dapps against wrong-network confusion

Open
#10,577 2 comments 1 reaction 0 assignees View on GitHub
area-api area-customNetworks type-enhancement type-security
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

As non-mainnet uses increase, we will more often see dapps accidentally suggesting transactions on the wrong network.

We should provide safety mechanisms to help prevent this scenario.

## Simple proposed solution

- Add optional `chain_id` parameter to all key-related methods.
- If this parameter is missing from a transaction, _warn the user_ to verify the network (Nudge dapps to always include this parameter)
- Document this recommended parameter in our docs.
- If this parameter is different than the current selected network, return an informative response/error to the dapp, for suggesting network switching.
- Coordinate the change between products.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the proposed chain_id behavior for key-related methods and the selected-network transaction flow; no file or test is named. Define the cross-product API contract, warning or error behavior, documentation changes, and completion criteria before implementation.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, blockchain
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.