0

I created an blank descriptor wallet and imported a xprv key.

importdescriptors '[{ "desc":"wpkh(tpr..../0h/*h)#td3snsa4", "timestamp":"now", "internal": true,"range": [0,5],"active":true}]'

I want to get the hardened address of path m/0h, but getnewaddress reports an error: 

Error: This wallet has no available keys (code -4).

I know deriveaddresses can show the hardened address, but it requires the private key to be included in the command.

I have imported the xprv key via the importdescriptors method, and I don't carry the xprv in daily use. I think the wallet can show the hardened address, but I don't know how to make it.

1 Answer 1

2

You've imported the descriptor with "internal": true which means that the descriptor will be used only for change addresses. You cannot retrieve any addresses from it with getnewaddress as that only retrieves receiving addresses. You can use getrawchangeaddress instead.

If you want to use getnewaddress, then either don't specify internal, or set it to false.

2
  • As you said, I set "internal":false, and it works! May I ask you, could I retrieve the addresses before the next index in a descriptor?
    – MonKong
    Apr 23, 2023 at 2:11
  • Oh, I find them in address book, Thx~!
    – MonKong
    Apr 23, 2023 at 2:24

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.