Thursday, December 26, 2024

bitcoin core – How can a non-public key be imported to a descriptor pockets?

To provide a bit extra context to Ava Chow’s reply: the rationale why this is not any simpler is that the idea of “importing a non-public key” is an inadequate technique for describing what a pockets ought to do, and the incorrect means to consider wallets within the first place. Whereas it’s attainable to transform wallets with keys imported to them to roughly equal descriptor wallets, this doesn’t imply that it is one of the simplest ways when importing issues. Descriptors and descriptor wallets help you be exact about what you need to import, and the importdescriptors RPC helps 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 group of personal keys, and loosely structured extra info similar to 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. In case you import a brand new key to a pockets, this instantly ends in treating funds to the P2PK, P2PKH, P2WPKH, P2SH-P2WPKH, and probably extra, addresses derived from that key to be watched. That is inefficient, exhausting to explain and motive about, and simply does not scale properly with new pockets constructions being added (e.g. P2TR), and even more durable to take care of when multisig throughout units or individuals is added.
  • Descriptor wallets. In a descriptor pockets, the outputs thought-about 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’d like simply P2PKH addresses derived from a key, you may say that. If you’d like P2SH-wrapped P2WSH multisig throughout a number of units you may say that too, and it’ll work precisely the identical.

Briefly: the outdated mannequin of how we considered wallets wasn’t manageable anymore, and “importing a key” solely made sense in that form 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