<p>First create a descriptor wallet with <code>createwallet</code>:</p>
<pre><code>bitcoin-cli -named createwallet wallet_name=mywallet descriptors=true
</code></pre>
<p>This will make a descriptor wallet named <code>mywallet</code>.</p>
<p>Then import a descriptor into that wallet using `importdescriptors:</p>
<pre><code>bitcoin-cli -rpcwallet=mywallet importdescriptors '[{&quot;desc&quot;: &quot;wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/*)#checksum&quot;, &quot;range&quot;: [0, 1000], &quot;timestamp&quot;: &quot;now&quot;, &quot;internal&quot;: false, &quot;watchonly&quot;: true, &quot;active&quot;: true}]
</code></pre>
<p>This will import the descriptor with an initial keypool of 1000. Any new bech32 addresses you request (with <code>getnewaddress</code> or from the GUI) will come from this descriptor.</p>

CC BY-SA 4.0
2021-01-19T12:34:02.093Z
The second command ends with error: "Cannot import descriptor without private keys to a wallet with private keys enabled".
urza.cc
CC BY-SA 4.0
2021-01-19T12:37:52.597Z
Ah, the first command must contain:  ddisable_private_keys=true
urza.cc
CC BY-SA 4.0
2021-01-19T12:38:07.950Z
./bitcoin-cli -named createwallet wallet_name=mywallet descriptors=true disable_private_keys=true
urza.cc
CC BY-SA 4.0
2021-01-15T17:43:51.027Z
2021-01-15T17:43:51.027Z
Ava Chow
<p>Using only command line (no GUI), how can I create watch only wallet based on descriptor and get first unused address?</p>
<p>This is the descriptor:</p>
<blockquote>
<p>&quot;wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/*)#checksum&quot;</p>
</blockquote>
<p>this is the bitcoin-cli command to list addresses based on this descriptor:</p>
<blockquote>
<p>./bitcoin-cli deriveaddresses
&quot;wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/*)#checksum&quot; &quot;[0,2]&quot;</p>
</blockquote>
<p>How to create actuall watch only wallet so that I can get automatically first unused address?</p>

<bitcoin-core><bitcoin-cli><output-script-descriptors>
How to create descriptor watch-only wallet with bitcoin-cli in Bitcoin Core 0.21?
urza.cc
# How to create descriptor watch-only wallet with bitcoin-cli in Bitcoin Core 0.21?

(Asked by: username_0 on 2021-01-15)

Using only command line (no GUI), how can I create watch only wallet based on descriptor and get first unused address?

This is the descriptor:

> "wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/\*)#checksum"

this is the bitcoin-cli command to list addresses based on this descriptor:

> ./bitcoin-cli deriveaddresses
> "wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/\*)#checksum" "[0,2]"

How to create actuall watch only wallet so that I can get automatically first unused address?

**Tags:** bitcoin-core, bitcoin-cli, output-script-descriptors


---

## 1 answers

### Answer by username_1 on 2021-01-15. Score: 3

First create a descriptor wallet with `createwallet`:

```
bitcoin-cli -named createwallet wallet_name=mywallet descriptors=true

```

This will make a descriptor wallet named `mywallet`.

Then import a descriptor into that wallet using `importdescriptors:

```
bitcoin-cli -rpcwallet=mywallet importdescriptors '[{"desc": "wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/*)#checksum", "range": [0, 1000], "timestamp": "now", "internal": false, "watchonly": true, "active": true}]

```

This will import the descriptor with an initial keypool of 1000. Any new bech32 addresses you request (with `getnewaddress` or from the GUI) will come from this descriptor.

> **Comments:**
> **username_0**: The second command ends with error: "Cannot import descriptor without private keys to a wallet with private keys enabled".  
> **username_0**: Ah, the first command must contain:  ddisable_private_keys=true  
> **username_0**: ./bitcoin-cli -named createwallet wallet_name=mywallet descriptors=true disable_private_keys=true  

---

