0

I have created a private chain in Geth which is running in machine1. I want to connect to the private chain running in machine1 from machine2's Metamask using rpc. machine1 and machine2 are connected to the same Wifi network.

The IP address of machine1 is 192.168.0.103 and I am opening port number 8501 for RPC connections.

The following are the flags that I have used to start Geth in machine1:

geth --datadir "C:\Users\smuth\Desktop\GETH DAPP POA\node1" --port 30311 --http --http.addr "192.168.0.103" --http.port 8501 --http.corsdomain "*" --http.api "personal,db,eth,net,web3,txpool,miner" --networkid 1515 console --ipcdisable --nat extip:192.168.0.103

I tried using the rpc url http://192.168.0.103:8501 and chain ID as 1515 in Metamask of machine2. But Metamask doesn't connect and displays the error : "Could not fetch chain ID. Is your RPC URL correct?" The console log of Metamask displays a timed out HTTP POST request to the RPC URL (http://192.168.0.103:8501)

A similar question is posted here: MetaMask and Access Ethereum Private Chain from other PC in the same network (for test)

But the solutions for the above question does'nt work for me.

What could be changed to make this connection work?

0

Geth currently only allows RPC requests from localhost. I made something like this, although it would require nginx. https://github.com/TennisBowling/geth-nginx
Then you would be able to access it without setting a port.

2
  • Thanks for this approach @TennisBowling but I found a more easier way. The firewall of machine1 was blocking connections to the port 8501 so I changed the inbound, outbound rules for the port 8501 and it is working! – Uma Muthukumar May 16 at 6:05
  • Please watch out with this @UmaMuthukumar . DO NOT USE GETH ACCOUNTS. bots find open rpc's and then just drain geth accounts. use metamask connected to geth. – TennisBowling May 21 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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