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:


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?

1 Answer 1


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.

  • The second command ends with error: "Cannot import descriptor without private keys to a wallet with private keys enabled".
    – urza.cc
    Jan 19, 2021 at 12:34
  • 1
    Ah, the first command must contain: ddisable_private_keys=true
    – urza.cc
    Jan 19, 2021 at 12:37
  • ./bitcoin-cli -named createwallet wallet_name=mywallet descriptors=true disable_private_keys=true
    – urza.cc
    Jan 19, 2021 at 12:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.