Bitcoin Forum
December 12, 2024, 08:27:56 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: node-bitcoin express  (Read 605 times)
drcyw (OP)
Newbie
*
Offline Offline

Activity: 1
Merit: 0


View Profile
January 26, 2014, 03:44:03 PM
 #1

Hello -

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);}
});
/****
Nova!
Full Member
***
Offline Offline

Activity: 140
Merit: 101


View Profile
January 28, 2014, 07:33:59 PM
 #2

You running node and the bitcoin wallet on the same computer?  If so that's stupid (you're begging to be compromised).  If not then change everything that says "localhost" to something that matches your actual topology.

Donate @ 1LE4D5ERPZ4tumNoYe5GMeB5p9CZ1xKb4V
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!