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.

Aydin
  • 2,117
  • 6
  • 25
  • 41

2 Answers2

2

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.

DanF
  • 2,626
  • 10
  • 19
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.

Achala Dissanayake
  • 5,819
  • 15
  • 28
  • 38