<p><code>getnewaddress</code> 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 <code>importmulti</code> 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 <code>getnewaddress</code>. They are just in the wallet as being watched.</p>
<p>You aren't doing anything wrong, <code>getnewaddress</code> just doesn't work like that for non-descriptor wallets.</p>
<p>If you make a <code>descriptor</code> wallet (using one of the 0.21.0 release candidates, or a build of the master branch), then <code>getnewaddress</code> will work as you expect it to.</p>

CC BY-SA 4.0
2020-12-16T17:35:38.720Z
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
CC BY-SA 4.0
2020-12-16T17:18:53.963Z
2020-12-16T17:18:53.963Z
Ava Chow
<p>I have a question about how the bitcoin core wallet works with descriptors.</p>
<p>I am creating a wallet using the <code>createwallet</code> method and passing in a name (all other args are default).</p>
<p>I then import addresses into Bitcoin Core using <code>importmulti</code> and <code>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</code></p>
<p>When I run <code>deriveaddresses</code> with <code>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</code> I get the expected addresses as an output but when I run the <code>getnewaddress</code> command after running <code>importmulti</code>, I get an address but not any of the addresses that were output from <code>deriveaddresses</code>.</p>
<p>I then noticed there is a <code>disable_private_keys</code> option when creating the wallet, so I've setup a new wallet using that flag.</p>
<p>I go through the setup process again with <code>keypool=true</code> when importing multi but when I run <code>getnewaddress</code> I get <code>&quot;Error: This wallet has no available keys&quot;</code>. The importmulti call returns <code>success: true</code>, and I get <code>Already have script 522103b403e66...</code> in my logs when I try running the command twice.</p>
<p>Does <code>getnewaddress</code> not work with descriptors? Or am I setting up the wallet incorrectly? I see there is an argument <code>blank</code> to pass in when creating a wallet but when I try that and import I get <code>Error: This wallet has no available keys</code> too.</p>
<p>I would expect <code>getnewaddress</code> to output the first address returned from <code>deriveaddresses</code> on a fresh wallet. Have I overlooked something in the documentation?</p>
<p>I looked at these docs too and I think I've followed them exactly:
<a href="https://gist.github.com/achow101/a9cf757d45df56753fae9d65db4d6e1d" rel="nofollow noreferrer">https://gist.github.com/achow101/a9cf757d45df56753fae9d65db4d6e1d</a></p>
<p><a href="https://bitcoin.stackexchange.com/questions/88520/using-importmulti-with-internal-set-to-true-does-not-add-any-change-keys-what-a?noredirect=1&amp;lq=1">Using importmulti with internal set to true does not add any change keys. What am I doing wrong?</a></p>
<p><a href="https://bitcoin.stackexchange.com/questions/89114/import-multisig-change-addresses-into-bitcoin-core-using-importmulti-descrip">Import multisig change addresses into Bitcoin Core using &quot;importmulti&quot; + descriptor</a></p>
<p><a href="https://bitcoin.stackexchange.com/questions/87629/what-is-the-best-way-to-create-a-wallet-with-a-blank-keypool-then-add-keys-to-it">What is the best way to create a wallet with a blank keypool then add keys to it?</a></p>
<p>Thanks!</p>

CC BY-SA 4.0
2021-02-11T12:04:48.620Z
Hi, I have the same issue, did you find out how to make it work? cheers
prcvcc
<output-script-descriptors><importmulti>
getnewaddress with importmulti
KayBeSee
# getnewaddress with importmulti

(Asked by: username_0 on 2020-12-16)

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?](https://bitcoin.stackexchange.com/questions/88520/using-importmulti-with-internal-set-to-true-does-not-add-any-change-keys-what-a?noredirect=1&lq=1)

[Import multisig change addresses into Bitcoin Core using "importmulti" + descriptor](https://bitcoin.stackexchange.com/questions/89114/import-multisig-change-addresses-into-bitcoin-core-using-importmulti-descrip)

[What is the best way to create a wallet with a blank keypool then add keys to it?](https://bitcoin.stackexchange.com/questions/87629/what-is-the-best-way-to-create-a-wallet-with-a-blank-keypool-then-add-keys-to-it)

Thanks!

**Tags:** output-script-descriptors, importmulti

> **Comments:**
> **username_1**: Hi, I have the same issue, did you find out how to make it work? cheers  

---

## 1 answers

### Answer by username_2 on 2020-12-16. Score: 1 | Accepted answer

`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.

> **Comments:**
> **username_0**: 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.  

---

