1

I have a question about how the bitcoin core wallet works with descriptors.

I am creating a wallet using the createwallet method and passing in a name (all other args are default).

I then import addresses into Bitcoin Core using importmulti and wsh(sortedmulti(2,[abc123ef/48h/0h/0h/2h]xpubyadayada.../0/*, [abc345ef/48h/0h/0h/2h]xpubyadaya1da.../0/*, [abc567ef/48h/0h/0h/2h]xpubyadaya2da.../0/*))#checksum

When I run deriveaddresses with wsh(sortedmulti(2,[abc123ef/48h/0h/0h/2h]xpubyadayada.../0/*, [abc345ef/48h/0h/0h/2h]xpubyadaya1da.../0/*, [abc567ef/48h/0h/0h/2h]xpubyadaya2da.../0/*))#checksum I get the expected addresses as an output but when I run the getnewaddress command after running importmulti, I get an address but not any of the addresses that were output from deriveaddresses.

I then noticed there is a disable_private_keys option when creating the wallet, so I've setup a new wallet using that flag.

I go through the setup process again with keypool=true when importing multi but when I run getnewaddress I get "Error: This wallet has no available keys". The importmulti call returns success: true, and I get Already have script 522103b403e66... in my logs when I try running the command twice.

Does getnewaddress not work with descriptors? Or am I setting up the wallet incorrectly? I see there is an argument blank to pass in when creating a wallet but when I try that and import I get Error: This wallet has no available keys too.

I would expect getnewaddress to output the first address returned from deriveaddresses on a fresh wallet. Have I overlooked something in the documentation?

I looked at these docs too and I think I've followed them exactly: https://gist.github.com/achow101/a9cf757d45df56753fae9d65db4d6e1d

Using importmulti with internal set to true does not add any change keys. What am I doing wrong?

Import multisig change addresses into Bitcoin Core using "importmulti" + descriptor

What is the best way to create a wallet with a blank keypool then add keys to it?

Thanks!

1
  • Hi, I have the same issue, did you find out how to make it work? cheers
    – sathia
    Feb 11, 2021 at 12:04

1 Answer 1

1

getnewaddress on non-descriptor wallets does not work for non-single key things. Ad descriptor wallets have not yet been released, you are not using a descriptor wallet. When you use importmulti to import a descriptor, it does not actually import the descriptor. Rather it uses the descriptor to construct a bunch of keys and scripts and imports them into the wallet. However this does not mean that those scripts will be accessible with getnewaddress. They are just in the wallet as being watched.

You aren't doing anything wrong, getnewaddress just doesn't work like that for non-descriptor wallets.

If you make a descriptor wallet (using one of the 0.21.0 release candidates, or a build of the master branch), then getnewaddress will work as you expect it to.

1
  • Hey Andrew, thanks for clearing that up. I am running 0.20.1, so that makes sense why it isn't working as expected. When you say they are just in the wallet as being watched, does that mean I can still monitor transactions for those addresses using the flow I used above? I haven't rescanned the blockchain yet because I wanted to make sure the addresses I was importing were correct.
    – KayBeSee
    Dec 16, 2020 at 17:35

Your Answer

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

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