How to create descriptor watch-only wallet with bitcoin-cli in Bitcoin Core 0.21? 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:

&quot;wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/*)#checksum&quot;

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

./bitcoin-cli deriveaddresses
&quot;wpkh([00000000/84h/0h/0h]xpub6DP....xyz/0/*)#checksum&quot; &quot;[0,2]&quot;

How to create actuall watch only wallet so that I can get automatically first unused address?
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 '[{&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}]

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.