1. Is it possible for the bitcoin-cli command to extract WIFs from a ranged descriptor with a derivation path?

  2. If a descriptor is ranged it must have a xpriv key?

  3. If a descriptor has a xpriv it must have a derivation path?

  4. If yes to 2,3 than the only other type would be a simple desc(wif) which would have neither a derivation path nor range?

I understand this is probably a bad idea (defeats the purpose of descriptors), but for curiosity reasons I'm asking.


My goal is to learn more about descriptors/WIFs/etc for testing alongside with the bitcoin-cli.

  • As far as Bitcoin Core is concerned, WIFs are the way private keys are encoded. If you're talking about "from" private keys, you must have some other encoding in mind. I don't believe any other encodings are supported besides WIF (and xprvs). Jun 7, 2023 at 16:41
  • I think my confusion is/was mainly around descriptors. You typically wouldn't be able to grab a single key or wif from a descriptor output (or at least you typically wouldn't want to do this because then you lose what makes a descriptor a descriptor)?. I was given a key for a tr descriptor which now seems unusual I guess?. I'm wondering how you would one start with descriptor and then give someone a wif to a tr output? (updated question) Jun 7, 2023 at 23:42

1 Answer 1


Yes, it is possible to create a Wallet Import Format (WIF) from a private key using the bitcoin-cli command. Here's an example of how you can do it:

  • [step.1] Generate a new private key:
bitcoin-cli -regtest getnewaddress
bitcoin-cli -regtest dumpprivkey <address>
  • [step.2] Convert the private key to WIF format:
$ bitcoin-cli -regtest dumpprivkey <private_key>

Replace <private_key> with the actual private key you generated in step 2.

The dumpprivkey command will output the corresponding WIF for the given private key. The WIF can be used for various purposes, such as importing the key into a wallet or performing other operations.

Using the bitcoin-cli command with the -regtest flag ensures that you are operating in the regression test mode, which is suitable for testing purposes.

By following these steps, you should be able to easily generate regtest WIFs for testing without relying on external programs or libraries.

  • @PieterWuille There was a typo in the text, I fixed it, what does it have to do with Ai?
    – MrPyMmdrza
    Jun 11, 2023 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.