Bitcoin

bitcoin core – How can I import my private key into my descriptor wallet?

To elaborate a bit on Andrew Chow’s answer, the reason this isn’t easier is because the concept of “getting your private keys” is an insufficient way to describe what a wallet needs to do, and is a wrong way to think about it. First of all, your wallet. Although it is possible to convert a wallet with imported keys into a wallet with roughly the same descriptor, this does not mean that it is the best method when importing items. Descriptors and descriptor wallets allow you to specify exactly what you want to get. importdescriptors RPC allows you to do that.

More specifically, this is roughly the philosophy behind the two types of wallets supported by Bitcoin Core.

  • legacy wallet A legacy wallet is a loosely structured collection of additional information, such as private keys, scripts, and addresses. Any output that can be consumed or observed with that key/script/address is considered to “belong” to the wallet. As soon as you import your new key into your wallet, payments to P2PK, P2PKH, P2WPKH, P2SH-P2WPKH, and addresses derived from that key will be processed and monitored. It is inefficient, difficult to explain and reason about, does not scale well when new wallet configurations are added (e.g. P2TR), and is even more difficult to handle when multiple signatures are added across devices or participants.
  • Descriptor Wallet In a descriptor wallet, the outputs that are considered part of the wallet can be accurately described using a simple “language” that includes all the metadata about how the keys are used. If you just want the P2PKH address derived from the key, you can say: If you want P2WSH multi-signature wrapped in P2SH across multiple devices, you can say that too and it will work exactly the same.

Simply put, the old model for wallets is no longer manageable and “get the keys” only makes sense in that kind of thinking. In the new model, you don’t just get a key, you get a description of what you want to do with the wallet.

Related Articles

Back to top button