Adds exportaddresskey "address" ( "key_type" ) to export locally available private keys for an address in a descriptor wallet. Callers can obtain private keys without identifying the descriptor index and reproducing key derivation outside Core.
The RPC has two modes:
wallet(default) returns the original wallet keys, with their public keys and roles.taproot_outputreturns effective Taproot key-path keys using the known output commitment. Direct output keys are returned without another tweak. MuSig2 participant secrets are never combined into an aggregate private key.
Supported constructions include single-key addresses, recognized P2SH/P2WSH scripts, multisig, Miniscript, and Taproot, including MuSig2 participants. A locally available key can be exported even when the wallet cannot satisfy all spending conditions.
Lookup is limited to existing wallet metadata and known derivation indices. Encrypted wallets must be unlocked. Missing spending data, unavailable keys, and inconsistent wallet data have distinct errors.
The result contains hexadecimal private scalars, not WIF. Exported keys are not a wallet backup; scripts, cosigners, or other spending data may still be needed. Reused keys and MuSig2 participants may control other outputs.
Includes key, descriptor, wallet manager, wallet RPC, and console-history tests. Functional coverage reconstructs scripts independently and verifies spending with exported keys, partial ownership, authorization, inconsistent metadata, and absence of wallet or nonce mutation.
The initial single-key implementation was ported from Bitcoin Roots and now extended to cover more use-cases. Initial motivation was the lack of dumppriv since v30 and the need for it in the making of the Quietproof client.