[Ethereum] Metamask won’t switch to Localhost 8545

go-ethereummetamask

I'm trying to get Metamask to connect to my "Localhost 8545" network. I've already unlocked the Test networks following the information provided in this question

I'm on a Windows 10 machine and I have a local Ethereum network running. I started the network with this command:

geth --networkid 1337 --mine --miner.threads 1 --datadir "." --nodiscover --http --http.port "8545" --http.corsdomain "*" --http.api eth,web3,personal,net --unlock 0 --password ./password.sec --allow-insecure-unlock

Based on the network definition in Metamask, my local network should be a network at http://localhost:8545 with ChainID 1337. See the text excerpt from the local network startup below showing that it's running on 127.0.0.1 (localnetwork) and on ChainID 1337:

INFO [11-22|11:58:44.309] Maximum peer count                       ETH=50 LES=0 total=50
INFO [11-22|11:58:44.316] Set global gas cap                       cap=50,000,000
INFO [11-22|11:58:44.323] Allocated trie memory caches             clean=154.00MiB dirty=256.00MiB
INFO [11-22|11:58:44.329] Allocated cache and file handles         database=C:\Users\username\project_name\private\geth\chaindata cache=512.00MiB handles=8192
INFO [11-22|11:58:44.398] Opened ancient database                  database=C:\Users\username\project_name\private\geth\chaindata\ancient readonly=false
INFO [11-22|11:58:44.405] Initialised chain configuration          config="{ChainID: 1337 Homestead: 0 DAO: <nil> DAOSupport: false EIP150: 0 EIP155: 0 EIP158: 0 Byzantium: 0 Constantinople: 0 Petersburg: 0 Istanbul: 0, Muir Glacier: <nil>, Berlin: <nil>, London: <nil>, Arrow Glacier: <nil>, Engine: ethash}"
INFO [11-22|11:58:44.446] Disk storage enabled for ethash caches   dir=C:\Users\username\project_name\private\geth\ethash count=3
INFO [11-22|11:58:44.465] Disk storage enabled for ethash DAGs     dir=C:\Users\username\AppData\Local\Ethash count=2
INFO [11-22|11:58:44.470] Initialising Ethereum protocol           network=1337 dbversion=8
INFO [11-22|11:58:44.512] Loaded most recent local header          number=31 hash=6a503a..c17ba6 td=16,332,535 age=7m41s
INFO [11-22|11:58:44.519] Loaded most recent local full block      number=31 hash=6a503a..c17ba6 td=16,332,535 age=7m41s
INFO [11-22|11:58:44.547] Loaded most recent local fast block      number=31 hash=6a503a..c17ba6 td=16,332,535 age=7m41s
INFO [11-22|11:58:44.559] Loaded local transaction journal         transactions=0 dropped=0
INFO [11-22|11:58:44.592] Regenerated local transaction journal    transactions=0 accounts=0
WARN [11-22|11:58:44.610] Switch sync mode from fast sync to full sync
INFO [11-22|11:58:44.629] Gasprice oracle is ignoring threshold set threshold=2
INFO [11-22|11:58:44.633] Starting peer-to-peer node               instance=Geth/v1.10.12-stable-6c4dc6c3/windows-amd64/go1.17.2
INFO [11-22|11:58:44.699] New local node record                    seq=1,637,606,845,862 id=8e46c88443901532 ip=127.0.0.1 udp=0 tcp=30303
INFO [11-22|11:58:44.700] IPC endpoint opened                      url=\\.\pipe\geth.ipc
INFO [11-22|11:58:44.708] Started P2P networking                   self="enode://0cb228df47ffed3cfebddac8a84836d427467bb1ae9cab68c324756f1875232947d5a2e91a7f19216ed912847c4830321582909c9357b1dd2a98aeb06c537896@127.0.0.1:30303?discport=0"
INFO [11-22|11:58:44.713] HTTP server started                      endpoint=127.0.0.1:8545 prefix= cors=* vhosts=localhost

When I try to switch to this network in Metamask, it doesn't work and just flips back to whatever network I was on before I tried to switch to "Localnetwork 8545".

clicking on Localnetwork 8545

After clicking on "Localnetwork 8545" (red arrow in image) it just goes back the "Ethereum Mainnet":

Switches back to Ethereum Mainnet

What do I need to do differently, so I can connect "Localhost 8545" in Metamask with the local network I'm running?

Best Answer

I have managed to fix this I installed version 10.6.2 manually and the localhost network option began working again. It seem to be a problem with version 10.6.1

The link to download version 10.6.2 URL: https://github.com/MetaMask/metamask-extension/releases/tag/v10.6.2 [1] download the metamask-chrome-10.6.2.zip [2] unzip the file [3] go to chrome settings => extensions => developer mode on [4] Load unpacked

See how to wiki => https://metamask.zendesk.com/hc/en-us/articles/360015489471-How-to-install-MetaMask-manually

I hope this helps. Cheers