2

I've set up a local geth node, and started it like so:

/usr/bin/geth --http --http.port 8545 --http.addr 0.0.0.0 --http.corsdomain '*' $ARGS

From the machine I'm trying to connect with, I can reach the local node like so:

curl --data '{"method":"eth_syncing","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST http://192.168.178.42:8545

Yet when I enter a new MetaMask network with rpc URL: http://192.168.178.42:8545/ and chainId 1, MetaMask responds with "Could not fetch chain ID. Is your RPC URL correct?".

What could be going wrong?

Just checked the Chrome console and found something interesting:

initSentry.js:8 Failed to fetch the chainId from the endpoint. Error: chain not synced beyond EIP-155 replay-protection fork block
  at r.jsonRpcRequest (ui.js:152)
  at async v.validateChainIdOnSubmit (ui.js:152)
  at async chrome-extension:/nkbihfbeogaeaoehlefnkodbefgpgknn/ui.js:152

Geth version: 1.10.2-stable-97d11b01

Went to check the sync state:

{
  currentBlock: 12315274,
  highestBlock: 12315377,
  knownStates: 662281856,
  pulledStates: 662253791,
  startingBlock: 12313270
}

That's current block 12,315,274. Fork block for EIP-155 is 2,675,000. Why would get say it isn't synched when calling eth_chainId?

2
  • Command line options --rpc??? were deprecated some time ago, they have --http. equivalents. In particular to use --http.api to enable required apis.
    – Ismael
    Apr 27, 2021 at 3:01
  • 1
    My bad, changed those in the config didn't update the question. Editing!
    – alextes
    Apr 28, 2021 at 10:39

4 Answers 4

1

Been pulling the last of my hair out most of the day with this issue, and I thought I would tell you how to fix it in case someone else comes across this thread.

You have to add the following when running geth:

--http.vhosts "*"

the documentation describes it as such: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: "localhost")"

I am running a Private Geth Network with my own genesis file so it never sees the internet....Please note that * allows everything to connect (but I am not sure if you can even see anything as its private genesis file and private clientID)

1
  • Although this sounds like it could be the answer to some question, I'm quite certain it isn't the answer to mine 😅. As shown in the question metamask was communicating with the node just fine, the problem was it being unable to fetch the chainId. The answer as to why I've already given.
    – alextes
    May 31, 2021 at 14:44
0

Although I have the blocks from after the fork, it seems my state trie is still out of sync, and until it catches up, this node is out of sync and unusable.

At this point I have no clue to figure out progress on syncing the state trie.

You can read more on it here: https://github.com/ethereum/go-ethereum/issues/15001#issuecomment-370732526

0

if you're still stuck on this, try attaching and running startRPC: 0. run geth node

  1. on another console, run: geth attach ./{YOUR_DATA_DIR}/geth.rpc
  2. in the geth console run: admin.startRPC()

and try again. let me know how you go

0

Thanks for your help. I've managed to get my metamask in firefox connected using the following flags:

geth --http --http.port 8545 --http.addr xxx.xxx.x.xxx --http.corsdomain "*"

If you're connecting to your node via another computer, remember you will need to forward the port 8545 on your router.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.