2

I've set up a private chain on computer A. I'm using geth and the following two command lines:

geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain "*" 
--datadir Users/TestChain --port "30303" --rpcaddr "127.0.0.1"  --
nodiscover --rpcapi "db,eth,net,web3,personal" --networkid 123 init 
/Users/CustomGenesis.json

geth --identity "MyNodeName" --rpc --rpcport "8545" --rpccorsdomain "*" 
--datadir Users/TestChain --port "30303" --nodiscover --rpcapi 
"db,eth,net,web3,personal" --networkid 123 console

I want to connect another node/computer B to this chain, so it can send transactions/contracts to it. On both machines, I have installed Metamask.

For machine A, I Googled my public IP. Let's call it IP_A. Then on machine B, in MetaMask, I created a custom RPC as follows: IP_A:8545

But, it cannot connect to computer A, it says:

   connecting to unknown private network.

and nothing happens after that.

Question: How can I resolve the above issue? How can I connect two computers using wifi and metamask?

Edit: Please see my other question here, I've answered this question as well. Thanks to @Achala Dissanayake.

  • try --rpcaddr "[A's ip address]" instead of --rpcaddr "127.0.0.1" -- – Achala Dissanayake Oct 12 '17 at 11:32
  • make sure B is also connected to the same wifi network, if you are using private ip addresses – Achala Dissanayake Oct 12 '17 at 11:36
  • @AchalaDissanayake Thanks. I tried that but it's not working. I even tried to use public IP. – Ay. Oct 12 '17 at 11:54
  • I'm not sure whether you can use public if you are inside a NAT. Is A's ip address starts with 192.168....? and B is also in the same network and have 192.168.... address? – Achala Dissanayake Oct 12 '17 at 11:58
  • @AchalaDissanayake both IP addresses start with 192.42 – Ay. Oct 12 '17 at 12:07
1

As mentioned in the comments,

since you ping to the computer A from computer B gives a time-out, the error of connecting to unknown private network probably due to computer being unable to find the network specified in Metamask as IP_A:8545.

Then you need to change use --rpcaddr "[A's ip address]" instead of --rpcaddr "127.0.0.1" to make the node accessible by B.

Resolving these will fix this.

1

Use the --chainId flag and set it to the same thing as your --networkId value. These two things have a different meaning for some clients, but MetaMask requires you set them both to the same value.

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.