<p>Here is the solution that worked for me...</p>

<ol>
<li>bictcoin.conf</li>
</ol>

<p>txindex=1
server=1
rpcuser=username
rpcpassword=password
port=8444
rpcport=8332
rpcbind=127.0.0.1
rpcallowip=127.0.0.1</p>

<ol start="2">
<li><p>Bitcoin Daemon must be running</p></li>
<li><p>DOS CMD: netstat -a -n  must show listening for both ports 8444 and 8332</p></li>
</ol>

<p>Good luck!</p>

CC BY-SA 3.0
2018-03-06T03:04:17.127Z
2018-03-06T03:04:17.127Z
Corbin
<p>Trying to RPC my local active Bitcoin Full Node, but getting ECONNREFUSED on client.getBalance. Am I missing additional configuration? Is there a better RPC wrapper to use? Any advice or working examples would be greatly appreciated!</p>

<p>CODE:</p>

<pre><code>var bitcoin=require("bitcoin");

var client = new bitcoin.Client({
  host: 'localhost',
  port: 8332,
  user: 'username',
  pass: 'password',
  timeout: 30000
});

client.getBalance('*', 6, function(err, balance, resHeaders) {
  if (err) return console.log(err);
  console.log('Balance:', balance);
});
</code></pre>

<p>CONFIGURATION FILE:</p>

<pre><code>server=1
rpcuser=username
rpcpassword=password
rpcport=8332
rpcallowip=127.0.0.1
</code></pre>

<p>ERROR:</p>

<pre><code>{ Error: connect ECONNREFUSED 127.0.0.1:8332
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 8332 }
</code></pre>

<client><json-rpc><node.js>
Bitcoin RPC ECONNREFUSED
Corbin
# Bitcoin RPC ECONNREFUSED

(Asked by: username_0 on 2018-03-05)

Trying to RPC my local active Bitcoin Full Node, but getting ECONNREFUSED on client.getBalance. Am I missing additional configuration? Is there a better RPC wrapper to use? Any advice or working examples would be greatly appreciated!

CODE:

```
var bitcoin=require("bitcoin");

var client = new bitcoin.Client({
  host: 'localhost',
  port: 8332,
  user: 'username',
  pass: 'password',
  timeout: 30000
});

client.getBalance('*', 6, function(err, balance, resHeaders) {
  if (err) return console.log(err);
  console.log('Balance:', balance);
});

```

CONFIGURATION FILE:

```
server=1
rpcuser=username
rpcpassword=password
rpcport=8332
rpcallowip=127.0.0.1

```

ERROR:

```
{ Error: connect ECONNREFUSED 127.0.0.1:8332
    at Object._errnoException (util.js:1022:11)
    at _exceptionWithHostPort (util.js:1044:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
  code: 'ECONNREFUSED',
  errno: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 8332 }

```

**Tags:** client, json-rpc, node.js


---

## 1 answers

### Answer by username_0 on 2018-03-06. Score: 2 | Accepted answer

Here is the solution that worked for me...

1. bictcoin.conf

txindex=1
server=1
rpcuser=username
rpcpassword=password
port=8444
rpcport=8332
rpcbind=127.0.0.1
rpcallowip=127.0.0.1

2. Bitcoin Daemon must be running
3. DOS CMD: netstat -a -n must show listening for both ports 8444 and 8332

Good luck!


---

