Connect to a node in nodejs

+3 votes
I am creating an application where I am issuing assets to an address by filling up a form but to issue that I need to connect to that chain first. How can we connect to that chain in node js?

Thanks in advance.
asked Jul 18, 2017 by Dimple Kanwar

1 Answer

+2 votes
Hi,

I am not thoroughly clear what you are asking, but you should look up the following JSON RPC API libraries that work with Node.js:

1. https://www.npmjs.com/package/bitcoin-promise

2. https://github.com/freewil/node-bitcoin

R.
answered Jul 18, 2017 by Rosevelt
But in these link,I don't see chain name with which we are connecting in the connection configuration.
What I am trying to do is:
I am creating a chain in a particular data directory using multichain-util
then, I am starting that chain in background
Then, I am calling all the multichain-cli commands from UI.
How can I connect my UI application with that chain which I created in above steps? Or do we always have to use RPC to connect? What is the demo application and chain are on the same machine, then also shall I use RPC?Where do we specify chain name?
You mean you want to call the multichain-cli commands from the UI of your application? Then you should use RPC to connect to the chain from your application (using one of those links for a node.js app) even if the application and chain are on the same machine - this is the interface Multichain provides for applications to access the blockchain.

As for the chain name, it is not necessary to specify one, since each blockchain runs on unique ports (so there would not be conflict even if you are running multiple on a node).

R.
Thanks.
If I create a multichain network on one machine, I get the RPC username and rpcpassword. If another machine wants to connect to that network, Which RPC credentials should be used? or the first machine has to share the RPC username and rpcpassword with the another machine?
Each node has its own different RPC credentials.
...