MetaMask / MetaMask/metamask-extension

Enable using Hardhat network without changing the localhost:8545 chain ID

Open
#10,290 53 comments 242 reactions 0 assignees View on GitHub
area-devmode team-wallet-api-platform-deprecated type-enhancement
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

I'm opening this issue as suggested by @rekmarks: https://github.com/MetaMask/metamask-extension/issues/9827#issuecomment-767098953

MetaMask comes with a `localhost:8545` network, typically used for development. This network used to work fine both with ganache and with hardhat, but now MetaMask checks that the connected network has 1337 as its chainId. Since Hardhat uses 31337 as its chainId, users get an EIP-155 error when trying to use MetaMask.

The solution is to manually change the project's configuration so that 1337 is used as chainId. This causes unnecessary friction.

---

I don't know what the correct solution would be here. I think users starting a node on their localhost are knowledgeable enough, and so accepting the chain id returned by the node seems fine in that scenario (unlike manually added networks, where users could be adding by following malicious instructions). But any approach that makes MetaMask work out of the box with Hardhat would be great.

Contributor guide

Open the contributing guide

Research direction

The issue names no files, tests, or entry points. Start by tracing the localhost:8545 network handling and the chain ID validation that produces the EIP-155 error. Done means reaching an agreed design that lets Hardhat's 31337 chain ID work without requiring users to reconfigure the project, with coverage for the relevant behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.