I am using Bitcoin Core to get all UTXOs for watchonly imported addresses. The strategy is the following:

  1. I load a new wallet

    await client.execute("loadwallet", ["testwallet"])
  2. I import multiple addresses in the loaded wallet

    import csv
    import time
    addresses = []
    with open("addr.csv") as f:
        reader = csv.DictReader(f)
        for row in reader:
            timestamp = time.mktime(
                time.strptime(row["created_at"], "%d/%m/%Y %H:%M:%S")
                    "scriptPubKey": {"address": row["address"]},
                    "timestamp": int(timestamp),
                    "watchonly": True,
    res = await client.execute("importmulti", [addresses])

After doing that, when calculating the utxos for one of the loaded addresses, I get a list with not all the utxos that I can find a block explorer. Could you please provide insights about what is going on here and how to solve it, preferably without heavy lifting such as indexing the blockchain ?

  • The documentation there is not so clear, at least for me (developer.bitcoin.org/reference/rpc/…). I tried with something like: " bitcoin-cli scantxoutset "start" ["tb1...", "tb1...", ...] " and ti doesn't seem to work. Dec 4, 2023 at 10:33
  • The documentation there is outdated. Use bitcoin-cli help scantxoutset. Nevertheless it still mentions what descriptor is to be used for an address: addr(tb1...). Dec 4, 2023 at 10:38
  • Well, it works. But with a minus. It seems that it just read the actual blockchain and returns once the right answer. Then when I check balance thereafter (using listunspent), I still get the first result which was incomplete. Dec 4, 2023 at 11:04
  • This is a replacement for listunspent. It reads the UTxO set directly, not the chain. Dec 4, 2023 at 11:07
  • I get it, but it is significantly slower. I took me 10 sec to scan for one address. And it's still marked experimental. Is it definitive (in other words, is the doc outdated in this regard) ? Dec 4, 2023 at 11:14