<p>There is an <a href="https://github.com/bitcoin/bitcoin/pull/26076" rel="nofollow noreferrer">open PR</a> which changes the hardened character to <code>h</code>.</p>
<p>In some shells, you can also escape the <code>'</code> with a backslash (i.e. <code>\'</code>) and bash will no longer consider that single quote to be the end quote of the string.</p>
<p>In other shells, you have to use double quotes (<code>&quot;</code>) around the entire string, but then you have to escape each internal double quote with a backslash.</p>

CC BY-SA 4.0
2023-04-18T23:44:51.323Z
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
CC BY-SA 4.0
2023-04-19T15:46:07.707Z
@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
CC BY-SA 4.0
2023-04-20T00:31:12.820Z
Never mind, I'll wait for the bitcoin core update.@Andrew Chow
MonKong
CC BY-SA 4.0
2023-04-18T13:45:58.253Z
2023-04-19T15:45:14.503Z
2023-04-19T15:45:14.503Z
Ava Chow
<p><code>'&quot;'&quot;'</code> worked for me:</p>
<pre><code>importdescriptors '[{ &quot;desc&quot;: &quot;pkh(tpubD92TWW3UxPVt7kL1JwM6pQLqiYUotoKH5TfaKftUCtk7FkRr2iMyrKyqKr7ixPdisMZXdxQUBn2qU1X4fZyCDcYLfibLhxUjCPXiNHp6vb1/0'&quot;'&quot;')#vq6m7zrg&quot;, &quot;timestamp&quot;:&quot;now&quot;, &quot;internal&quot;: true }]'
</code></pre>
<p>Note that checksum changes from vq6m7zrg to another one.</p>
<p>P.S. It is possible to replace <code>'</code> character with an equivalent number that represents a sum of 2147483648 and an index number, e.g. <code>0'</code> with <code>2147483648</code>.</p>

CC BY-SA 4.0
2024-08-11T21:15:22.360Z
2024-09-25T08:28:55.943Z
2024-09-25T08:28:55.943Z
Greg Tonoski
<p>When I <code>importdescriptors</code> to another Bitcoin Core wallet using the descriptor shown in Bitcoin Core, the descriptor with hardened character can not be used directly.</p>
<p>example: <code>importdescriptors '[{ &quot;desc&quot;: &quot;pkh(tpubD92TWW3UxPVt7kL1JwM6pQLqiYUotoKH5TfaKftUCtk7FkRr2iMyrKyqKr7ixPdisMZXdxQUBn2qU1X4fZyCDcYLfibLhxUjCPXiNHp6vb1/0')#vq6m7zrg&quot;, &quot;timestamp&quot;:&quot;now&quot;, &quot;internal&quot;: true }]'</code></p>
<p>The Bitcoin-QT console shows error: <code>Error: Invalid command line</code></p>
<p><code>bitcoin-cli</code> in command line shows this error: <code>-bash: syntax error near unexpected token </code>)'`</p>
<p>I have to convert <code>'</code> to <code>h</code> and regenerate checksum by hand,to this:</p>
<pre><code>pkh(tpubD92TWW3UxPVt7kL1JwM6pQLqiYUotoKH5TfaKftUCtk7FkRr2iMyrKyqKr7ixPdisMZXdxQUBn2qU1X4fZyCDcYLfibLhxUjCPXiNHp6vb1/0h)#r7w93wm7
</code></pre>
<p>Bitcoin Core shows descriptors' hardened character all use <code>'</code>, and the descriptor often uses <code>importdescriptors</code> RPC, but it's very inconvenient to use in practice. Is it possible to make Bitcoin Core show the descriptors' hardened character as <code>h</code>?</p>

<bitcoin-core><output-script-descriptors><hardened-derivation>
The hardened character does not work directly with bitcoin core importdescriptors RPC
MonKong
# The hardened character does not work directly with bitcoin core importdescriptors RPC

(Asked by: username_0 on 2023-04-18)

When I `importdescriptors` to another Bitcoin Core wallet using the descriptor shown in Bitcoin Core, the descriptor with hardened character can not be used directly.

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

The Bitcoin-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:

```
pkh(tpubD92TWW3UxPVt7kL1JwM6pQLqiYUotoKH5TfaKftUCtk7FkRr2iMyrKyqKr7ixPdisMZXdxQUBn2qU1X4fZyCDcYLfibLhxUjCPXiNHp6vb1/0h)#r7w93wm7

```

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 show the descriptors' hardened character as `h`?

**Tags:** bitcoin-core, output-script-descriptors, hardened-derivation


---

## 2 answers

### Answer by username_1 on 2023-04-18. Score: 5

There is an [open PR](https://github.com/bitcoin/bitcoin/pull/26076) 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.

> **Comments:**
> **username_0**: 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.  
> **username_1**: @username_0 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.  
> **username_0**: Never mind, I'll wait for the bitcoin core update.@Andrew username_1  

---

### Answer by username_2 on 2024-08-11. Score: 1

`'"'"'` worked for me:

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

```

Note that checksum changes from vq6m7zrg to another one.

P.S. It is possible to replace `'` character with an equivalent number that represents a sum of 2147483648 and an index number, e.g. `0'` with `2147483648`.


---

