[Ethereum] Quorum: Can’t Connect To Nodes From External Sources

nodesquorumweb3js

I have a Quorum (7nodes example) network up and successfully running. I can connect to any geth node using the following:

geth attach ipc:qdata/dd1/geth.ipc

I can also see that the ports opened in the startup script start.sh are listening:

tcp6    0   0 :::21000         :::*        LISTEN

I can see that a provider has been set:

> web3.providers
{
  host: "http://devserver01:21000",
  HttpProvider: function(host),
  IpcProvider: function(path, net)
}

However:

> web3.currentProvider.isConnected()

returns false. I also can't reach the node using web3.min.js from a web page. The error is:

Uncaught Error: CONNECTION ERROR: Couldn't connect to node

Any suggestions on how to troubleshoot? Thanks.

Best Answer

In the 7 nodes example, the correct geth ports for the nodes are 22000 to 22006.

tcp6       0      0 :::22000                :::*                    LISTEN      1000       28113       9235/geth       
tcp6       0      0 :::22001                :::*                    LISTEN      1000       28058       9236/geth       
tcp6       0      0 :::22002                :::*                    LISTEN      1000       29076       9237/geth       
tcp6       0      0 :::22003                :::*                    LISTEN      1000       29079       9238/geth       
tcp6       0      0 :::22004                :::*                    LISTEN      1000       28174       9239/geth       
tcp6       0      0 :::22005                :::*                    LISTEN      1000       28136       9240/geth
tcp6       0      0 :::22006                :::*                    LISTEN      1000       29075       9241/geth

Vagrant is exposing these ports to the host system by default. So, the following connection should work:

Inside vagrant or on host system: geth attach http://localhost:22000

vagrant@ubuntu-xenial:~$ geth attach http://localhost:22000
Welcome to the Geth JavaScript console!

instance: Geth/v1.7.2-stable-ee498061/linux-amd64/go1.9.3
coinbase: 0xed9d02e382b34818e88b88a309c7fe71e65f419d
at block: 0 (Thu, 01 Jan 1970 00:00:00 UTC)
 datadir: /home/vagrant/quorum-examples/7nodes/qdata/dd1
 modules: admin:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

You can see the NAT configuration if you look at your vagrant provider. This is virtual box:

NAT configuration - virtual box

Related Topic