How to use a watch-only wallet in bitcoin-core?

[ad_1]

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

[ad_2]

Source link

Leave a Comment