<p><a href="https://bitcoincore.org/en/doc/26.0.0/rpc/wallet/listreceivedbyaddress/" rel="nofollow noreferrer"><code>listreceivedbyaddress</code></a> is a wallet RPC, it will only provide data on any addresses that are part of your wallet.</p>
<p>Bitcoin Core does not index balances by addresses outside of its own wallet’s addresses. You could use <a href="https://bitcoincore.org/en/doc/26.0.0/rpc/blockchain/scanblocks/" rel="nofollow noreferrer"><code>scanblocks</code></a> which will need the node to have a <code>blockfilterindex</code>, or alternatively <a href="https://bitcoincore.org/en/doc/26.0.0/rpc/blockchain/scantxoutset/" rel="nofollow noreferrer"><code>scantxoutset</code></a>. I’m not sure either of these two would be particularly performant, so if you want to scan for a lot of addresses, you may want to look into running an electrum server or block explorer backend such as Esplora.</p>

CC BY-SA 4.0
2024-01-18T20:08:05.340Z
gotcha, thanks. So I can't use the blockchain locally as a sort of queryable DB?

I will look into Esplora
user2880722
CC BY-SA 4.0
2024-01-18T20:10:48.697Z
There is an option to run a `txindex`, but there is no address index
Murch
CC BY-SA 4.0
2024-01-18T20:23:54.430Z
Could I use scanblocks() with the addr as the descriptor?
user2880722
CC BY-SA 4.0
2024-01-18T21:18:19.387Z
Oh, yeah, `scanblocks` would be a better choice. I forgot we have that now. You do need the `blockfilterindex` of course in order for that to be available.
Murch
CC BY-SA 4.0
2024-01-18T20:03:40.953Z
2024-01-18T21:22:20.160Z
2024-01-18T21:22:20.160Z
Murch
<p>So to start I have very little experience and this may be a simple answer but I can't find it easily.</p>
<p>I suspect that I am using the wrong thing to achieve what I am trying to do.</p>
<p>I'm parsing out the blocks locally to get transactional information. Then I am trying to take each wallet addr with a transaction and check the current balance.</p>
<p>When I run this code I get this error &quot;('Wallet file not specified (must request wallet RPC through /wallet/ uri-path).',)&quot; which makes me think I am not using the correct method.</p>
<p>If I'm not using the correct method, what should I be using?</p>
<pre><code>                received_info = rpc_connection.listreceivedbyaddress(1, False, True, str([output_address]))
                            if received_info:
                                output_file.write(f&quot;  Received by Address Info:\n&quot;)
                                for info in received_info:
                                    output_file.write(f&quot;    Address: {info['address']}\n&quot;)
                                    output_file.write(f&quot;    Amount Received: {info['amount']} BTC\n&quot;)
                                    output_file.write(f&quot;    Confirmations: {info['confirmations']}\n\n&quot;)
</code></pre>

<wallet><address><json-rpc><balance>
listreceivedbyaddress - wallet file not specified error
user2880722
# listreceivedbyaddress - wallet file not specified error

(Asked by: username_0 on 2024-01-18)

So to start I have very little experience and this may be a simple answer but I can't find it easily.

I suspect that I am using the wrong thing to achieve what I am trying to do.

I'm parsing out the blocks locally to get transactional information. Then I am trying to take each wallet addr with a transaction and check the current balance.

When I run this code I get this error "('Wallet file not specified (must request wallet RPC through /wallet/ uri-path).',)" which makes me think I am not using the correct method.

If I'm not using the correct method, what should I be using?

```
                received_info = rpc_connection.listreceivedbyaddress(1, False, True, str([output_address]))
                            if received_info:
                                output_file.write(f"  Received by Address Info:\n")
                                for info in received_info:
                                    output_file.write(f"    Address: {info['address']}\n")
                                    output_file.write(f"    Amount Received: {info['amount']} BTC\n")
                                    output_file.write(f"    Confirmations: {info['confirmations']}\n\n")

```

**Tags:** wallet, address, json-rpc, balance


---

## 1 answers

### Answer by username_1 on 2024-01-18. Score: 0 | Accepted answer

[`listreceivedbyaddress`](https://bitcoincore.org/en/doc/26.0.0/rpc/wallet/listreceivedbyaddress/) is a wallet RPC, it will only provide data on any addresses that are part of your wallet.

Bitcoin Core does not index balances by addresses outside of its own wallet’s addresses. You could use [`scanblocks`](https://bitcoincore.org/en/doc/26.0.0/rpc/blockchain/scanblocks/) which will need the node to have a `blockfilterindex`, or alternatively [`scantxoutset`](https://bitcoincore.org/en/doc/26.0.0/rpc/blockchain/scantxoutset/). I’m not sure either of these two would be particularly performant, so if you want to scan for a lot of addresses, you may want to look into running an electrum server or block explorer backend such as Esplora.

> **Comments:**
> **username_0**: gotcha, thanks. So I can't use the blockchain locally as a sort of queryable DB?  I will look into Esplora  
> **username_1**: There is an option to run a `txindex`, but there is no address index  
> **username_0**: Could I use scanblocks() with the addr as the descriptor?  
> **username_1**: Oh, yeah, `scanblocks` would be a better choice. I forgot we have that now. You do need the `blockfilterindex` of course in order for that to be available.  

---

