Skip to content

Menu action to export a watchonly wallet #872

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

achow101
Copy link
Member

@achow101 achow101 commented May 13, 2025

Allows a user to export a watchonly version of their wallet to be used in an airgapped setup.

Built on bitcoin/bitcoin#32489

@DrahtBot
Copy link
Contributor

DrahtBot commented May 13, 2025

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #bitcoin/bitcoin/32593 (wallet, rpc: Move (Un)LockCoin WalletBatch creation out of RPC by achow101)
  • #bitcoin/bitcoin/32489 (wallet: Add exportwatchonlywallet RPC to export a watchonly version of a wallet by achow101)
  • #bitcoin/bitcoin/32481 (wallet, refactor: Remove Legacy wallet unused warnings and errors by pablomartin4btc)
  • #bitcoin/bitcoin/32471 (wallet/rpc: fix listdescriptors RPC fails to return descriptors with private key information when wallet contains descriptors missing any key by Eunovo)
  • #bitcoin/bitcoin/31244 (descriptors: MuSig2 by achow101)
  • #bitcoin/bitcoin/29675 (wallet: Be able to receive and spend inputs involving MuSig2 aggregate keys by achow101)
  • #bitcoin/bitcoin/29136 (wallet: addhdkey RPC to add just keys to wallets via new unused(KEY) descriptor by achow101)
  • #bitcoin/bitcoin/28333 (wallet: Construct ScriptPubKeyMans with all data rather than loaded progressively by achow101)
  • #bitcoin/bitcoin/27865 (wallet: Track no-longer-spendable TXOs separately by achow101)
  • #bitcoin/bitcoin/27286 (wallet: Keep track of the wallet's own transaction outputs in memory by achow101)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@achow101 achow101 force-pushed the export-watchonly-wallet-gui branch from 033db04 to da9365f Compare May 16, 2025 21:43
@achow101 achow101 force-pushed the export-watchonly-wallet-gui branch from da9365f to fe863d1 Compare May 20, 2025 00:56
@hebasto hebasto changed the title gui: Menu action to export a watchonly wallet Menu action to export a watchonly wallet May 20, 2025
achow101 added 6 commits May 21, 2025 10:40
Instead of prividing the descriptor string as stored in the db, use the
normalized descriptor as is done for getaddressinfo's parent_desc field.
CanSelfExpand() reports whether a descriptor can be expanded without
needing any caches or private keys to be provided by the caller of
Expand().
If a descriptor does not need any caches or private keys in order to
expand, then CanGetAddresses() should return true for that descriptor.
New wallets always have these upgraded. As a belt-and-suspenders, do the
upgrade as well, but it should not be necessary.

Note that while WalletBatch::LoadWallet also does the upgrade, because
newly created wallets do not have the descriptor flag set yet, the
upgrade does not run and set the flag.
achow101 added 7 commits May 21, 2025 10:40
If a new WalletDescriptor is provided to us with a cache, write the
cache to disk as well.
When listdescriptors retrieves the descriptors from the wallet, instead
of having this logic in the RPC, move it into CWallet itself. This
will enable other functions to get the descriptors in an exportable
form.
ExportWatchOnly produces a watchonly wallet file from a CWallet. This
can be restored onto another instance of Bitcoin Core to allow that
instance to watch the same descriptors, and also have all of the same
initial address book and transactions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants