MetaMask RPC URL Validation: How the Network Check Works
MetaMask checks an RPC URL's format, queries its chain ID, and compares network details with known data before it asks you to approve a custom network.
The CryptoWeek Editors4 min read

MetaMask validates an RPC URL by checking its format, querying the endpoint’s chain ID, and comparing the submitted network details with known chain data; these checks help confirm that the endpoint serves the chain the request claims.
A dapp can submit a wallet_addEthereumChain request under EIP-3085, or you can enter the details yourself. The request includes a hexadecimal chainId, rpcUrls, a chain name, and native currency details such as its name and symbol. MetaMask checks the inputs, calls the endpoint, and then presents an approval prompt, warning, or error.
What does MetaMask check before adding a network?
MetaMask first checks that the fields are formatted correctly. EIP-3085 requires RPC URLs to be valid URLs and rejects insecure http: and local file: schemes. MetaMask also requires a usable RPC URL for an add request. A correctly formatted URL only gets the request to the next check: MetaMask must be able to reach an endpoint that responds to JSON-RPC calls.
Next, MetaMask calls eth_chainId on the RPC endpoint. EIP-695 defines this JSON-RPC method; it returns the chain ID as a hexadecimal value. MetaMask compares that response with the chainId in the request. If the endpoint is unreachable, does not respond to the call, or returns a different chain ID, MetaMask rejects the add with an error.
MetaMask can also run a network-details check against chain data from chainid.network. It compares the submitted chain ID, name, and currency symbol with the known information. A name or symbol mismatch can trigger a warning that you may override. This is a separate check from querying the endpoint: switching off the network-details check in Settings under Security & Privacy affects that warning, while the chain-ID query still happens.
The checks have different outcomes. A malformed request, unreachable endpoint, or chain-ID mismatch stops the add. A mismatch with known network details prompts a warning for you to review. If the checks pass and you approve the request, MetaMask saves the network information for future connections.
What happens when you add Base?
Consider an illustrative request to add Base Mainnet with chain ID 0x2105 (8453), RPC URL https://mainnet.base.org, the name “Base Mainnet,” and native currency symbol “ETH.” MetaMask first checks the URL and request fields, then asks that endpoint for eth_chainId. The endpoint returns 0x2105, matching the request.
MetaMask then checks the submitted name and symbol against its known network details. If they match, you can review the network information and approve the addition. If the endpoint instead returns another ID, such as 0x1, MetaMask stops with an error because the RPC serves a different chain than the request claims. If only the name or symbol differs from the known data, expect a warning rather than that chain-ID error.
Before the details check, the illustrative request has the same Base chain ID and RPC URL as before, but its currency symbol is mistyped as “BAS.” After correcting the symbol to “ETH,” the chain ID and endpoint remain unchanged; only the submitted metadata changes. The warning can clear because the displayed details now match the known data.
What should you do with a warning or after adding a network?
“This network might not be legit” signals that MetaMask found a mismatch in network details. Review the chain ID, name, symbol, and RPC URL in the prompt. A warning about a label or symbol is distinct from an error saying the endpoint returned the wrong chain ID; the latter means the endpoint and requested chain do not match.
After adding a network, you can change its RPC URL in MetaMask’s network settings. That changes the endpoint MetaMask uses for the saved network, so verify that the replacement serves the same chain ID. The RPC operator can see your IP address and the requests sent to its endpoint, making your RPC choice a privacy decision as well as a connectivity choice.
When using a directory to populate a request, treat its details as values to verify in MetaMask’s confirmation. Compare the chain ID and endpoint with the network’s own published information, then use Chainlist to cross-check the network name and symbol. That extra review helps catch a copied URL from another chain before you approve it.
Related
What does MetaMask’s “This network might not be legit” warning mean?
It means the network details differ from information MetaMask checks against known chain data. Review the fields shown in the prompt; an override accepts the mismatch, while a chain-ID error prevents the add.
Can I change a network’s RPC after adding it?
Yes. Edit the RPC URL in the network’s settings and confirm the replacement endpoint returns the saved chain ID. A chain-ID match with the new endpoint helps spare you from connecting to a different network by mistake.