3
1
I can't get the node-bitcoin rpc module running correctly in my express app... Either I get a connection refused error or I get a invalid params -32602
Here's a little code snipped from my app.js file. Can somebody help me out on what I'm doing wrong here. FYI, I do have port 8332 and 8333 open on nginx
/******* THIS GIVES ME INVALID PARAMS from -32602 ******/
var net = require('net');
var server = net.createServer(function(c) { //'connection' listener
console.log('server connected');
});
server.listen(8332, function() { //'listening' listener
console.log('server bound');
});
var bitcoinClient = new bitcoin.Client({
host: 'localhost',
port: 8332,
user: 'username',
pass: 'password'
});
bitcoinClient.getInfo(function(e, info){
if(e){ return console.log(e);}
});
/****************************************************************/
/******* THIS GIVES ME CONNECTION REFUSED ******/
var bitcoinClient = new bitcoin.Client({
host: 'localhost',
port: 8332,
user: 'username',
pass: 'password'
});
bitcoinClient.getInfo(function(e, info){
if(e){ return console.log(e);}
});
/****
have you configured your
bitcoin.conffile to expect incoming rpc traffic? – Loourr – 2014-01-26T17:12:52.803oh, ok. I found some info on that. Going to try and figure out where it goes on an aws ebs setup. Thank you – drcyw – 2014-01-26T18:33:07.567
but just to be clear.... I'm not wanting to accept rpc calls or anything like that (no mining either)... I just want to be able to hit the bitcoind api. Do I still need a bit coin.conf file for that and if so do I need to specify server = 0 ? – drcyw – 2014-01-26T18:39:50.627
Yes you still need bitcoin.conf configured properly to give it API commands, see sample bitcoin.conf and uncomment and configure all relevant parameters. For your case you probably need server=1, rpcuser and rpcpassword set. https://en.bitcoin.it/wiki/Running_Bitcoin
– John T – 2014-01-26T22:15:48.150Also make sure you are properly configured, try visiting bitcoind in your browser and use the username and pass you set. http://127.0.0.1:8332
– John T – 2014-01-26T22:17:54.483@JacobTorba Maybe write an answer from the comments? :) – Murch – 2014-02-09T08:54:45.497