node bitcoin RPC JSON error

0 votes
I am trying to connect multichcain (from same machine ) using node bitcoin wrapper of node js but unable to connect.

Here is the code  a.js  -->

console.log("Hello World");

var bitcoin = require('bitcoin');
var client = new bitcoin.Client({
  host: '192.168.100.9',
  port: 9241,                
  user: 'rpcuser',            //from multichain.conf
  pass: '3895uWRBD8KfWKUT35EzhxkkHTqArPSd1Av3to1aL2um'
});
 
client.getDifficulty(function(err, difficulty) {
  if (err) {
    return console.error(err);
  }
 
  console.log('Difficulty: ' + difficulty);
});

Output->

root@kali:~/Desktop# nodejs a.js
Hello World
{ [Error: socket hang up] code: 'ECONNRESET' }
asked Feb 14, 2016 by Neil P

1 Answer

0 votes
Are you connecting to the JSON-RPC port as opposed to the peer-to-peer port?
answered Feb 14, 2016 by MultiChain
Yeah solved  it.
Rpc port is different ,it is given in params.dat.
Thank you
...