1

The listunspent 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.)

Adam B
  • 334
  • 8

2 Answers2

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.

Vojtěch Strnad
  • 5,623
  • 1
  • 8
  • 31
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.

Murch
  • 71,155
  • 33
  • 180
  • 600