Not able to connect to Multichain nodes from Node JS API

+2 votes
Hi,

I have created Node JS API's for connecting to my multichain nodes . There is one admin node which is running a Daemon and other two child nodes are connecting to that Seed Node or Admin Node.

In my code, I am making a connection attempt to all these three nodes by passing the Host IP , RPCPORT, rpcusername and rpcpassword . ?But when I am starting my node server , I am getting the below arror :

server listening on : 3000
err:Error: connect ECONNREFUSED "IP_Address_of_Admin_Node":"RPC_Port_of_Admin_Node"
err:Error: connect ECONNREFUSED "IP_Address_of_Admin_Node":"RPC_Port_of_Admin_Node"
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
info:undefined

Same message I am getting for the other two child nodes also.

Can someone help me on this ?
asked Mar 12, 2018 by ss_developer

1 Answer

+2 votes
 
Best answer

If that is the unmodified error message, it looks like some parameters are not getting passed in properly. You're passing the literal strings IP_Address_of_Admin_Node and RPC_Port_of_Admin_Node instead of the actual IP address and port. You'd need to learn more about Javascript syntax in order to pass the information in properly – this is not a MultiChain issue.

answered Mar 12, 2018 by MultiChain
selected Mar 19, 2018 by ss_developer
This is a modified error message and I am putting the IP Address and Ports of the nodes only but still it is not connecting to the nodes.

As I cannot share the IP address details so encrypted using these variables :

IP_Address_of_Admin_Node and RPC_Port_of_Admin_Node
Ah, apologies. In that case it's probably just that these nodes aren't allowing incoming API requests from different computers. You can fix this using the rpcallowip setting (search this Q&A for rpcallowip).
All the nodes are setup on my same local computer. the API's and the nodes are all running on my same local computer.
I also read that changing the rpcallowip settings would initiate the node conversation . But I am not sure how can i change the rpcallowip for all nodes configured on the same computer and these nodes are also running on the same IP address but different port  numbers .
Can you please help me on this?
Can anyone please suggest on the mentioned above issue ?
Are you able to use multichain-cli to talk to these nodes? If so it must be some problem in the Node.js API you are using.
...