<p>The complete answer can be found at:</p>
<ul>
<li><a href="https://bitcoin.stackexchange.com/a/114723/1761">answer by Pieter Wuille at Aug 3, 2022 at 15:55</a></li>
</ul>
<p>The following steps takes a more practical approach. It's hoped that future interface updates will simplify this process further (today: <strong>January 2024</strong>):</p>
<ol>
<li>On <strong>Bitcoin-Qt</strong>, first create a Wallet with <strong>&quot;disabled private keys&quot;</strong>.</li>
<li>go to <strong>Window</strong> -&gt; <strong>Console</strong>.
<ul>
<li><em>Obs.: The next steps could also be done directly from <code>bitcoin-cli</code>.</em></li>
</ul>
</li>
<li><code>getdescriptorinfo &quot;addr(bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw5tk9)&quot;</code></li>
<li>Get the &quot;descriptor&quot; result field to be used later. (something like: <code>addr(bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw)#6rmdcqux</code>)</li>
<li><code>importdescriptors '[{&quot;desc&quot;: &quot;addr(bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw)#6rmdcqux&quot;, &quot;timestamp&quot;: &quot;now&quot;, &quot;watchonly&quot;: true}]'</code> (replacing the &quot;desc&quot; field by the output of &quot;getdescriptorinfo&quot; field &quot;descriptor&quot;).</li>
<li>The output should be: <code>[{&quot;success&quot;: true}]</code></li>
<li><strong>(Optional)</strong> Consider going to <strong>Window</strong> -&gt; <strong>Receiving Address</strong> and add labels to your watch-only addresses.</li>
<li><strong>(Optional)</strong> Consider editing the config file and add the <code>walletnotify=&lt;script&gt; %s</code> if you want to be notified. For example: <code>walletnotify=xmessage &quot;Funds had been moved: %s&quot; -center</code> (where %s will be replaced by the txid).</li>
</ol>
<p>Please note that by setting <em>&quot;timestamp&quot;: &quot;now&quot;</em> the blockchain won't be rescanned. Meaning that the you won't see old transactions and therefore a wrong balance had some bitcoins transferred in the past to the address specified.
You can specify <em>&quot;timestamp&quot;: 0</em> to have the client rescan the chain and add all transactions or provide a specific timecode at which to start rescanning.</p>
<hr />
<p>Now an extra tip (perhaps not so related), but a piece of advice:</p>
<p>This kind of thing can be useful for you to know if a system has been breached. You place a private key (or seed) completely open, without a password, in the exact location where you want it to be &quot;monitored&quot;. Set a reasonable prize value. Monitor this address using the steps above.</p>
<p>If the balance of the address changes, you know that system has been breached and you can try to take measures to minimize further damage.</p>

CC BY-SA 4.0
2024-01-06T04:03:11.363Z
2024-04-03T23:26:01.190Z
2024-04-03T23:26:01.190Z
Felipe
<p>If you're using Bitcoin Core 23.0, and created a new wallet using that, it is by default a <strong>descriptor wallet</strong>. These are a new generation of wallets which use <a href="https://bitcoin.stackexchange.com/a/99541/208">Output Descriptors</a> to determine which keys/scripts/addresses &quot;belong&quot; to the wallet, as opposed to legacy wallets which use a much less well-defined process to determine this.</p>
<p>Several RPCs, like the <code>importaddress</code>, <code>importpubkey</code>, and <code>importmulti</code> are disabled for descriptor wallets, for the simple reason that the behavior they have for legacy wallets cannot be exactly replicated for descriptor wallets. This is a good thing - it was extremely complicated to reason about what that behavior is.</p>
<p>If you want to import something into a descriptor wallet, you need the <code>importdescriptors</code> RPC instead. This single RPC subsumes the functionality of
all legacy import commands in a single RPC, by using the <a href="https://github.com/bitcoin/bitcoin/blob/v23.0/doc/descriptors.md" rel="noreferrer">Output Descriptor language</a> to specify what to import. That includes the ability to import single addresses (using <code>addr([ADDR])</code> descriptors), or ranges of HD key-derived scripts (e.g. <code>wpkh([XPUB]/0/1/2/*)</code> would import all P2WPKH addresses derived from xpub <code>[XPUB]</code>, with derivation path <code>m/0/1/2/0</code>, <code>m/0/1/2/1</code>, <code>m/0/1/2/2</code>, ...).</p>
<p>The documentation on <a href="https://developer.bitcoin.org/reference/rpc/importaddress.html" rel="noreferrer">developer.bitcoin.org</a> seems outdated. The Bitcoin Core 23.0 RPC documentation (accessible through the <code>help</code> RPC command) does say:</p>
<blockquote>
<p>Note: This command is only compatible with legacy wallets. Use &quot;importdescriptors&quot; with &quot;addr(X)&quot; for descriptor wallets.</p>
</blockquote>

CC BY-SA 4.0
2023-03-21T16:29:24.883Z
`getdescriptorinfo( wpkh(zpub...) )` says the key is invalid. Could you please explain why?
Meglio
CC BY-SA 4.0
2023-03-21T17:02:47.430Z
You need to use BIP32 xpubs/xprvs in descriptors. All these zpubs/ypubs/vpubs/... are not supported (as they're redundant, they try to convey the same information about how the key is to be used as the descriptor itself)
Pieter Wuille
CC BY-SA 4.0
2023-03-21T17:07:36.397Z
If I'm given an `zpub`, is there a path to convert it to `xpub`?
Meglio
CC BY-SA 4.0
2023-03-21T17:08:24.407Z
You really shouldn't. Whatever gave you a zpub probably did so for a reason. Converting it to something else may well be incompatible with that.
Pieter Wuille
CC BY-SA 4.0
2023-03-21T17:10:50.370Z
I see. I have read here - https://github.com/satoshilabs/slips/blob/master/slip-0132.md - and it made an impression that zpub is just a more advanced and self-contained version. What we're trying to achieve is have one person (e.g. a vendor) give me an extended public key, and me (e.g. a market) generate one-per-order receiving addresses for them with using bitcoin core rpc and that extended public key. Is that doable with relying on bitcoin core rpc solely? P.S. I feel like it's related ot the topic of "watch-only" wallet, since I'm not given private keys by the vendor.
Meglio
CC BY-SA 4.0
2023-03-21T18:30:20.560Z
"Whatever gave you a zpub probably did so for a reason." - actually, just because electrum only gives that for the newer wallets.
Meglio
CC BY-SA 4.0
2022-08-03T15:55:10.893Z
2022-08-03T16:01:49.320Z
2022-08-03T16:01:49.320Z
Pieter Wuille
<p>I'm using Bitcoin Core v23.0.</p>
<p>It seems to support watch-only wallets by setting <a href="https://developer.bitcoin.org/reference/rpc/createwallet.html#argument-2-disable-private-keys" rel="nofollow noreferrer"><code>disable_private_keys=true</code></a> during wallet creation.</p>
<pre><code>$ bitcoin-cli -regtest createwallet &quot;test&quot; true
{
  &quot;name&quot;: &quot;test&quot;,
  &quot;warning&quot;: &quot;&quot;
}
</code></pre>
<p>But when I try to <a href="https://developer.bitcoin.org/reference/rpc/importaddress.html" rel="nofollow noreferrer">import</a> an address into it, the command fails:</p>
<pre><code>$ bitcoin-cli -regtest -rpcwallet=test importaddress &quot;bcrt1qpsw3ts4v3srzxqk7f797sxhn22xhwcc3cdq0xe&quot;
error code: -4
error message:
This type of wallet does not support this command
</code></pre>
<p>The <a href="https://developer.bitcoin.org/reference/rpc/importpubkey.html" rel="nofollow noreferrer"><code>importpubkey</code></a> command fails, too</p>
<pre><code>$ bitcoin-cli -regtest -rpcwallet=test importpubkey &quot;035310a2af27b41544204c544b6df18a3a7cc217498d740fb9d1212c3af9fd8010&quot;
error code: -4
error message:
This type of wallet does not support this command
</code></pre>
<p>So <strong>how can I add a watch-only address to Bitcoin Core?</strong></p>
<p>And is it possible to derive HD addresses using a watch-only wallet? (I know it's possible because Coinkite can do it)</p>

<bitcoin-core><watch-only><importaddress>
How to use a watch-only wallet in Bitcoin Core?
rustyx
# How to use a watch-only wallet in Bitcoin Core?

(Asked by: username_0 on 2022-08-03)

I'm using Bitcoin Core v23.0.
It seems to support watch-only wallets by setting disable_private_keys=true during wallet creation.
$ bitcoin-cli -regtest createwallet "test" true
{
  "name": "test",
  "warning": ""
}

But when I try to import an address into it, the command fails:
$ bitcoin-cli -regtest -rpcwallet=test importaddress "bcrt1qpsw3ts4v3srzxqk7f797sxhn22xhwcc3cdq0xe"
error code: -4
error message:
This type of wallet does not support this command

The importpubkey command fails, too
$ bitcoin-cli -regtest -rpcwallet=test importpubkey "035310a2af27b41544204c544b6df18a3a7cc217498d740fb9d1212c3af9fd8010"
error code: -4
error message:
This type of wallet does not support this command

So how can I add a watch-only address to Bitcoin Core?
And is it possible to derive HD addresses using a watch-only wallet? (I know it's possible because Coinkite can do it)

**Tags:** bitcoin-core, watch-only, importaddress


---

## 2 answers

### Answer by username_2 on 2022-08-03. Score: 5 | Accepted answer

If you're using Bitcoin Core 23.0, and created a new wallet using that, it is by default a **descriptor wallet**. These are a new generation of wallets which use [Output Descriptors](https://bitcoin.stackexchange.com/a/99541/208) to determine which keys/scripts/addresses "belong" to the wallet, as opposed to legacy wallets which use a much less well-defined process to determine this.

Several RPCs, like the `importaddress`, `importpubkey`, and `importmulti` are disabled for descriptor wallets, for the simple reason that the behavior they have for legacy wallets cannot be exactly replicated for descriptor wallets. This is a good thing - it was extremely complicated to reason about what that behavior is.

If you want to import something into a descriptor wallet, you need the `importdescriptors` RPC instead. This single RPC subsumes the functionality of
all legacy import commands in a single RPC, by using the [Output Descriptor language](https://github.com/bitcoin/bitcoin/blob/v23.0/doc/descriptors.md) to specify what to import. That includes the ability to import single addresses (using `addr([ADDR])` descriptors), or ranges of HD key-derived scripts (e.g. `wpkh([XPUB]/0/1/2/*)` would import all P2WPKH addresses derived from xpub `[XPUB]`, with derivation path `m/0/1/2/0`, `m/0/1/2/1`, `m/0/1/2/2`, ...).

The documentation on [developer.bitcoin.org](https://developer.bitcoin.org/reference/rpc/importaddress.html) seems outdated. The Bitcoin Core 23.0 RPC documentation (accessible through the `help` RPC command) does say:

> Note: This command is only compatible with legacy wallets. Use "importdescriptors" with "addr(X)" for descriptor wallets.

> **Comments:**
> **username_3**: `getdescriptorinfo( wpkh(zpub...) )` says the key is invalid. Could you please explain why?  
> **username_2**: You need to use BIP32 xpubs/xprvs in descriptors. All these zpubs/ypubs/vpubs/... are not supported (as they're redundant, they try to convey the same information about how the key is to be used as the descriptor itself)  
> **username_3**: If I'm given an `zpub`, is there a path to convert it to `xpub`?  
> **username_2**: You really shouldn't. Whatever gave you a zpub probably did so for a reason. Converting it to something else may well be incompatible with that.  
> **username_3**: I see. I have read here - https://github.com/satoshilabs/slips/blob/master/slip-0132.md - and it made an impression that zpub is just a more advanced and self-contained version. What we're trying to achieve is have one person (e.g. a vendor) give me an extended public key, and me (e.g. a market) generate one-per-order receiving addresses for them with using bitcoin core rpc and that extended public key. Is that doable with relying on bitcoin core rpc solely? P.S. I feel like it's related ot the topic of "watch-only" wallet, since I'm not given private keys by the vendor.  
> **username_3**: "Whatever gave you a zpub probably did so for a reason." - actually, just because electrum only gives that for the newer wallets.  

---

### Answer by username_1 on 2024-01-06. Score: 3

The complete answer can be found at:

* [answer by username_2 at Aug 3, 2022 at 15:55](https://bitcoin.stackexchange.com/a/114723/1761)

The following steps takes a more practical approach. It's hoped that future interface updates will simplify this process further (today: **January 2024**):

1. On **Bitcoin-Qt**, first create a Wallet with **"disabled private keys"**.
2. go to **Window** -> **Console**.
   * *Obs.: The next steps could also be done directly from `bitcoin-cli`.*
3. `getdescriptorinfo "addr(bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw5tk9)"`
4. Get the "descriptor" result field to be used later. (something like: `addr(bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw)#6rmdcqux`)
5. `importdescriptors '[{"desc": "addr(bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw)#6rmdcqux", "timestamp": "now", "watchonly": true}]'` (replacing the "desc" field by the output of "getdescriptorinfo" field "descriptor").
6. The output should be: `[{"success": true}]`
7. **(Optional)** Consider going to **Window** -> **Receiving Address** and add labels to your watch-only addresses.
8. **(Optional)** Consider editing the config file and add the `walletnotify=`


---

