In this Andrew Chow blog post on what's coming to the Bitcoin Core wallet in 0.21 he states:

It is, and will be, possible to take an existing Legacy Wallet, and make a Descriptor Wallet which exactly matches it. There will be tooling that allows users to do this. Even after the removal of Legacy Wallets and Berkeley DB, it will be possible to migrate Legacy Wallets to Descriptor Wallets through the use of a minimally dependent migration tool.

How will this migration tool work? How can the descriptor wallet obtain the descriptor from the legacy wallet given that the legacy wallet doesn't know what a descriptor is?


The migration tool will go through all the keys in the legacy wallet and create descriptors for them. This requires considering everything that IsMine matches on. From the Bitcoin Core release notes:

IsMine refers to the function used to determine whether a script belongs to the wallet. This is used to determine whether an output belongs to the wallet. IsMine in Legacy Wallets returns true if the wallet would be able to sign an input that spends an output with that script. Since keys can be involved in a variety of different scripts, this definition for IsMine can lead to many unexpected scripts being considered part of the wallet.

For HD wallets, it is pretty simple to compute the xpriv for the HD seed using a single descriptor. For non-HD wallets but still only key things, it's a descriptor for each key. The set of scriptPubKeys is finite and O(n!) so it is doable.

For watch-only wallets and multisigs it gets more complicated. Also getting the Descriptor Wallet to treat as IsMine any future script that the Legacy Wallet would have treated as IsMine is probably impossible for all edge cases.

Thanks to Andrew Chow and Pieter Wuille for answering this question on IRC. Any errors are my own.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.