<p>Correct, this is a wallet RPC, so it only deals with outputs belonging to the wallet.</p>
<p>If you want to query the entire unspent transaction output set, you can use the <code>scantxoutset</code> RPC. It doesn't even depend on <code>txindex=1</code>.</p>

CC BY-SA 4.0
2022-11-21T17:04:48.697Z
I have not considered `scantxoutset`, because it is marked experimental. It works, but I find it quite slow.
OptOut
CC BY-SA 4.0
2022-11-21T17:44:34.700Z
It's slow because it scans through the entire UTXO set, which is currently a few gigabytes of data.
Vojtěch Strnad
CC BY-SA 4.0
2022-11-21T07:51:34.300Z
2022-11-21T07:51:34.300Z
Vojtěch Strnad
<p>The Bitcoin Core Wallet tracks addresses associated with its own keys. <code>listunspent</code> is a <em>wallet</em> RPC that refers to the wallet data only.
Beyond the wallet's tracking of its own data, Bitcoin Core does not have functionality to keep an address index regardless of whether <code>txindex</code> is used or not. I surmise that address tracking was never prioritized by a Bitcoin Core contributor (or even pushed back upon by others) due to the intended single-use nature of addresses.</p>
<p>If you want to keep track of UTXOs per address you may want to look into blockchain explorer projects such as <em>esplora</em> or <em>mempool.space</em>.</p>

CC BY-SA 4.0
2022-12-06T16:47:41.857Z
2022-12-06T16:47:41.857Z
Murch
<p>The <a href="https://developer.bitcoin.org/reference/rpc/listunspent.html" rel="nofollow noreferrer"><code>listunspent</code></a> Bitcoin Core RPC method by default works only for addresses loaded in the wallet.  Does it work for <em>any</em> address if the node has full index (<code>txindex=1</code>)?</p>
<p>(Technically it could I think, but since this is a 'wallet' RPC, it may be restricted.)</p>

<bitcoin-core><listunspent><txindex>
Does 'listunspent' work for any address is `txindex=1`?
OptOut
# Does 'listunspent' work for any address is `txindex=1`?

(Asked by: username_0 on 2022-11-21)

The [`listunspent`](https://developer.bitcoin.org/reference/rpc/listunspent.html) Bitcoin Core RPC method by default works only for addresses loaded in the wallet. Does it work for *any* address if the node has full index (`txindex=1`)?

(Technically it could I think, but since this is a 'wallet' RPC, it may be restricted.)

**Tags:** bitcoin-core, listunspent, txindex


---

## 2 answers

### Answer by username_1 on 2022-11-21. Score: 2

Correct, this is a wallet RPC, so it only deals with outputs belonging to the wallet.

If you want to query the entire unspent transaction output set, you can use the `scantxoutset` RPC. It doesn't even depend on `txindex=1`.

> **Comments:**
> **username_0**: I have not considered `scantxoutset`, because it is marked experimental. It works, but I find it quite slow.  
> **username_1**: It's slow because it scans through the entire UTXO set, which is currently a few gigabytes of data.  

---

### Answer by username_2 on 2022-12-06. Score: 2

The Bitcoin Core Wallet tracks addresses associated with its own keys. `listunspent` is a *wallet* RPC that refers to the wallet data only.
Beyond the wallet's tracking of its own data, Bitcoin Core does not have functionality to keep an address index regardless of whether `txindex` is used or not. I surmise that address tracking was never prioritized by a Bitcoin Core contributor (or even pushed back upon by others) due to the intended single-use nature of addresses.

If you want to keep track of UTXOs per address you may want to look into blockchain explorer projects such as *esplora* or *mempool.space*.


---

