<p>RPC getBalance only works with addresses valid in the local wallet. Once txindex is enabled, RPC getrawtransaction will return transaction data for any address on the blockchain. </p>

<p>Calculating the balance for an arbitrary address is possible because almost every blockchain explorer does it. However, calculating a balance for an address using RPC getrawtransaction is not possible. </p>

CC BY-SA 3.0
2018-03-08T21:42:52.100Z
2018-03-11T18:26:54.550Z
2018-03-11T18:26:54.550Z
Corbin
<p>Yes, as you said it just for local wallet, if you want to get address balance you should <code>importaddress</code> and rescan the blockchain then you can check that address transactions and balance. </p>

<p>or you can integrate bitcoin-core with electrumx so you be able to get any address balance or even a transaction. </p>

CC BY-SA 3.0
2018-03-09T01:20:31.597Z
2018-03-09T01:20:31.597Z
Tailer
<p>I'm running a full node (v0.16.0).  I added txnindex=1 to my configuration file and restarted the Bitcoin-Qt. It took 2+ days to build the index but when I check addresses with known final balances>0 the amount is still zero. For example...</p>

<p>REMOTE FINAL BALANCE=66.76870249 BTC:</p>

<pre><code>https://blockchain.info/address/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa
</code></pre>

<p>LOCAL FINAL BALANCE=0:</p>

<pre><code>let address='1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa';
client.getBalance(address, 6, function(error, balance, resHeaders) {
log('Address: ' + address + ' Balance:'  + balance);
});
</code></pre>

<p>Any ideas would be appreciated!</p>

<bitcoin-core><bitcoin-qt-setup><bitcoin.conf>
txtnindex=1 but balances still zero?
Corbin
# txtnindex=1 but balances still zero?

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

I'm running a full node (v0.16.0). I added txnindex=1 to my configuration file and restarted the Bitcoin-Qt. It took 2+ days to build the index but when I check addresses with known final balances>0 the amount is still zero. For example...

REMOTE FINAL BALANCE=66.76870249 BTC:

```
https://blockchain.info/address/1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

```

LOCAL FINAL BALANCE=0:

```
let address='1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa';
client.getBalance(address, 6, function(error, balance, resHeaders) {
log('Address: ' + address + ' Balance:'  + balance);
});

```

Any ideas would be appreciated!

**Tags:** bitcoin-core, bitcoin-qt-setup, bitcoin.conf


---

## 2 answers

### Answer by username_0 on 2018-03-08. Score: 0 | Accepted answer

RPC getBalance only works with addresses valid in the local wallet. Once txindex is enabled, RPC getrawtransaction will return transaction data for any address on the blockchain.

Calculating the balance for an arbitrary address is possible because almost every blockchain explorer does it. However, calculating a balance for an address using RPC getrawtransaction is not possible.


---

### Answer by username_1 on 2018-03-09. Score: 0

Yes, as you said it just for local wallet, if you want to get address balance you should `importaddress` and rescan the blockchain then you can check that address transactions and balance.

or you can integrate bitcoin-core with electrumx so you be able to get any address balance or even a transaction.


---

