Saturday, July 27, 2024

bitcoin core – How can a personal key be imported to a descriptor pockets?

To offer a bit extra context to Andrew Chow’s reply: the rationale why this is not any simpler is that the idea of “importing a personal key” is an inadequate technique for describing what a pockets ought to do, and the unsuitable manner to consider wallets within the first place. Whereas it’s potential to transform wallets with keys imported to them to roughly equal descriptor wallets, this doesn’t imply that it is the easiest way when importing issues. Descriptors and descriptor wallets permit you to be exact about what you need to import, and the importdescriptors RPC enables you to try this.

In additional element, that is roughly the philosophy behind the 2 varieties of wallets supported by Bitcoin Core:

  • legacy wallets A legacy pockets is a set of personal keys, and loosely structured extra data resembling scripts and addresses. Any output which may be spent or noticed with these keys/scripts/addresses is taken into account to “belong” to the pockets. When you import a brand new key to a pockets, this instantly ends in treating funds to the P2PK, P2PKH, P2WPKH, P2SH-P2WPKH, and presumably extra, addresses derived from that key to be watched. That is inefficient, laborious to explain and purpose about, and simply would not scale nicely with new pockets constructions being added (e.g. P2TR), and even tougher to cope with when multisig throughout deviced or individuals is added.
  • Descriptor wallets In a descriptor pockets, the outputs thought of a part of the pockets may be described precisely utilizing a easy “language” which incorporates all metadata about how the keys are used. If you need simply P2PKH addresses derived from a key, you may say that. If you need P2SH-wrapped P2WSH multisig throughout a number of gadgets you may say that too, and it’ll work precisely the identical.

In brief: the outdated mannequin of how we considered wallets wasn’t manageable anymore, and “importing a key” solely made sense in that sort of pondering. Within the new mannequin, you do not import keys, you import an outline of precisely what you need the pockets to do.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles