<p>I am using Bitcoin Core to get all UTXOs for watchonly imported addresses. The strategy is the following:</p>
<ol>
<li><p>I load a new wallet</p>
<pre class="lang-py prettyprint-override"><code>await client.execute(&quot;loadwallet&quot;, [&quot;testwallet&quot;])
</code></pre>
</li>
<li><p>I import multiple addresses in the loaded wallet</p>
<pre class="lang-py prettyprint-override"><code>import csv
import time

addresses = []
with open(&quot;addr.csv&quot;) as f:
    reader = csv.DictReader(f)
    for row in reader:
        timestamp = time.mktime(
            time.strptime(row[&quot;created_at&quot;], &quot;%d/%m/%Y %H:%M:%S&quot;)
        )
        addresses.append(
            {
                &quot;scriptPubKey&quot;: {&quot;address&quot;: row[&quot;address&quot;]},
                &quot;timestamp&quot;: int(timestamp),
                &quot;watchonly&quot;: True,
            }
        )
res = await client.execute(&quot;importmulti&quot;, [addresses])
print(res)
</code></pre>
</li>
</ol>
<p>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 ?</p>

CC BY-SA 4.0
2023-12-04T10:33:30.783Z
The documentation there is not so clear, at least for me (https://developer.bitcoin.org/reference/rpc/scantxoutset.html?highlight=set). I tried with something like: " bitcoin-cli scantxoutset "start" ["tb1...", "tb1...", ...] " and ti doesn't seem to work.
Nahum Maurice
CC BY-SA 4.0
2023-12-04T10:38:41.633Z
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...)`.
Antoine Poinsot
CC BY-SA 4.0
2023-12-04T11:04:34.273Z
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.
Nahum Maurice
CC BY-SA 4.0
2023-12-04T11:07:53.903Z
This is a replacement for listunspent. It reads the UTxO set directly, not the chain.
Antoine Poinsot
CC BY-SA 4.0
2023-12-04T11:14:35.377Z
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) ?
Nahum Maurice
<bitcoin-core><bitcoind><bitcoin-core-development><bitcoin-cli><listunspent>
Listunspent does not return all utxos
Nahum Maurice
# Listunspent does not return all utxos

(Asked by: username_0 on 2023-12-04)

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

1. I load a new wallet

   ```py
   await client.execute("loadwallet", ["testwallet"])

   ```
2. I import multiple addresses in the loaded wallet

   ```py
   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")
           )
           addresses.append(
               {
                   "scriptPubKey": {"address": row["address"]},
                   "timestamp": int(timestamp),
                   "watchonly": True,
               }
           )
   res = await client.execute("importmulti", [addresses])
   print(res)

   ```

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 ?

**Tags:** bitcoin-core, bitcoind, bitcoin-core-development, bitcoin-cli, listunspent

> **Comments:**
> **username_0**: The documentation there is not so clear, at least for me (https://developer.bitcoin.org/reference/rpc/scantxoutset.html?highlight=set). I tried with something like: " bitcoin-cli scantxoutset "start" ["tb1...", "tb1...", ...] " and ti doesn't seem to work.  
> **username_1**: 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...)`.  
> **username_0**: 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.  
> **username_1**: This is a replacement for listunspent. It reads the UTxO set directly, not the chain.  
> **username_0**: 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) ?  

---

## 0 answers

