It is sometimes useful for the wallet to have keys that it can sign with but are not (initially) involved in any scripts, e.g. for setting up a multisig. Ryanofsky suggested A void(KEY)
descriptor which allows for a key to be specified, but produces no scripts. These can be imported into the wallet, and subsequently retrieved with gethdkeys
. Additionally, listdescriptors
will output these descriptors so that they can be easily backed up.
In order to make it easier for people to add HD keys to their wallet, and to generate a new one if they want to rotate their descriptors, an addhdkey
RPC is also added. Without arguments, it will generate a new HD key and add it to the wallet via a void(KEY)
descriptor. If provided a private key, it will construct the descriptor and add it to the wallet.
See also: #26728 (comment)
Based on #29130 as gethdkeys
is useful for testing this.