When I importdescriptors to another bitcoin core wallet using the descriptor shown in the bitcoin core, the descriptor with hardened character can not used directly.

example: importdescriptors '[{ "desc": "pkh(tpubD92TWW3UxPVt7kL1JwM6pQLqiYUotoKH5TfaKftUCtk7FkRr2iMyrKyqKr7ixPdisMZXdxQUBn2qU1X4fZyCDcYLfibLhxUjCPXiNHp6vb1/0')#vq6m7zrg", "timestamp":"now", "internal": true }]'

bitcoin core-QT console shows error: Error: Invalid command line

bitcoin-cli in command line shows this error: -bash: syntax error near unexpected token `)'

I have to convert ' to h and regenerate checksum by hand,to this:


The bitcoin core shows descriptors' hardened character all use ', and the descriptor often uses importdescriptors RPC, but it's very inconvenient to use in practice. Is it possible to make bitcoin core shows the descriptors' hardened character as h?

1 Answer 1


There is an open PR which changes the hardened character to h.

In some shells, you can also escape the ' with a backslash (i.e. \') and bash will no longer consider that single quote to be the end quote of the string.

In other shells, you have to use double quotes (") around the entire string, but then you have to escape each internal double quote with a backslash.

  • Thank you for the quick answer. I tried to add one or two backslash before ' (i.e.\',\\'), both in command line in mac and QT console, but it shows the same error.
    – MonKong
    Commented Apr 18, 2023 at 23:44
  • @MonKong Hmm, I guess bash handles that differently from the shell that I use. I've updated the answer with a different way but requires a lot more escaping.
    – Ava Chow
    Commented Apr 19, 2023 at 15:46
  • Never mind, I'll wait for the bitcoin core update.@Andrew Chow
    – MonKong
    Commented Apr 20, 2023 at 0:31

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.