getnewaddress with importmulti 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 &quot;Error: This wallet has no available keys&quot;. 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 &quot;importmulti&quot; + descriptor
What is the best way to create a wallet with a blank keypool then add keys to it?
Thanks!
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.