<p>As Murch suggested in comments, I better leave this as an answer.</p>

<p>What I think your problem is that you haven't configured your <code>bitcoin.conf</code> file. You can see all the parameters and explanation of em' thoughtfully provided by the Bitcoin wiki <a href="https://en.bitcoin.it/wiki/Running_Bitcoin" rel="nofollow">here</a>. See that example <code>bitcoin.conf</code>? It has all the parameters commented out with the <code>#</code> sign. Just uncomment them by removing the hash and fill in your configuration.</p>

<p>To use the api you are going to need <code>server=1</code> to enable api commands, <code>rpcuser=&lt;username&gt;</code> and <code>rpcpassword=&lt;your secure password</code> to be able to actually connect.</p>

<h1>Now test it</h1>

<p>It's easy to test your Bitcoind configuration settings with a browser, just load up the address of your Bitcoind in a browser like so: <code>http://127.0.0.1:8332</code>. It should throw a username and password dialog if everything is correct.</p>

<p><strong>Note:</strong> You will need to enable <code>rpcallowip=&lt;ip&gt;</code> to allow connections from other than your own machine. This is also really dangerous and I advise against this.</p>

CC BY-SA 3.0
2014-02-09T19:56:23.030Z
2014-02-09T19:56:23.030Z
John T
<p>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</p>

<p>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 </p>

<pre><code>/******* 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);}
});
/****
</code></pre>

CC BY-SA 3.0
2014-01-26T17:12:52.803Z
have you configured your `bitcoin.conf` file to expect incoming rpc traffic?
Loourr
CC BY-SA 3.0
2014-01-26T18:33:07.567Z
oh, ok.  I found some info on that.  Going to try and figure out where it goes on an aws ebs setup.  Thank you
drcyw
CC BY-SA 3.0
2014-01-26T18:39:50.627Z
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
CC BY-SA 3.0
2014-01-26T22:15:48.150Z
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
CC BY-SA 3.0
2014-01-26T22:17:54.483Z
Also 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
CC BY-SA 3.0
2014-02-09T08:54:45.497Z
@JacobTorba Maybe write an answer from the comments? :)
Murch
<bitcoind><json-rpc>
node-bitcoin express rpc
drcyw
# node-bitcoin express rpc

(Asked by: username_0 on 2014-01-26)

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);}
});
/****

```

**Tags:** bitcoind, json-rpc

> **Comments:**
> **username_1**: have you configured your `bitcoin.conf` file to expect incoming rpc traffic?  
> **username_0**: oh, ok.  I found some info on that.  Going to try and figure out where it goes on an aws ebs setup.  Thank you  
> **username_0**: 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 ?  
> **username_2**: 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  
> **username_2**: Also 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  
> **username_3**: @JacobTorba Maybe write an answer from the comments? :)  

---

## 1 answers

### Answer by username_2 on 2014-02-09. Score: 3

As username_3 suggested in comments, I better leave this as an answer.

What I think your problem is that you haven't configured your `bitcoin.conf` file. You can see all the parameters and explanation of em' thoughtfully provided by the Bitcoin wiki [here](https://en.bitcoin.it/wiki/Running_Bitcoin). See that example `bitcoin.conf`? It has all the parameters commented out with the `#` sign. Just uncomment them by removing the hash and fill in your configuration.

To use the api you are going to need `server=1` to enable api commands, `rpcuser=<username>` and `rpcpassword=<your secure password` to be able to actually connect.

# Now test it

It's easy to test your Bitcoind configuration settings with a browser, just load up the address of your Bitcoind in a browser like so: `http://127.0.0.1:8332`. It should throw a username and password dialog if everything is correct.

**Note:** You will need to enable `rpcallowip=<ip>` to allow connections from other than your own machine. This is also really dangerous and I advise against this.


---

