<p>The problem was that the wallet couldn't recognize the utxo with <code>listunspent</code> because I put the wrong private key into the descriptor. <code>rawtr(KEY)</code> takes a <em>tweaked</em> private key and I accidentally put the <em>untweaked</em> private key into it. After I corrected the wallet was able to recognize and spend the utxo.</p>

CC BY-SA 4.0
2022-12-08T13:01:45.637Z
2022-12-08T13:01:45.637Z
raphjaph
<p>I created a <a href="https://mempool.space/signet/tx/26651571eb31f9ea4f400615bd5fb834a2b0aa120a03074eac889651ffefbd0d" rel="nofollow noreferrer">transaction</a> that creates a taproot output that can be spent using the private key (<code>KEY</code>) corresponding to the taproot output key. Then I imported the WIF formatted private key into Bitcoin Core with <code>importdescriptors '[{&quot;desc: rawtr(KEY), &quot;timestamp&quot;:&quot;now&quot; ...&quot;}]'</code>, which was successful. With <code>listdescriptors</code> I can see that it is in the wallet but with <code>listunspent</code> the taproot output does not show up.</p>
<p>How can I tell the wallet to recognize the taproot output as spendable?</p>
<p>I've also tried setting the descriptor to active but then it tells me only ranged descriptors can be active and I'm unsure how to add a range to a <code>rawtr(KEY)</code> descriptor.</p>

CC BY-SA 4.0
2022-12-06T23:37:37.207Z
Can you retrieve the transaction using `gettransaction`? If not, try rescanning the blockchain first.
Ava Chow
CC BY-SA 4.0
2022-12-07T17:14:59.850Z
Yes, I can retrieve it with `bitcoin-cli -chain=signet gettransaction 26651571eb31f9ea4f400615bd5fb834a2b0aa120a03074eac889651ffefbd0d
`. The wallet I'm doing this with contains multiple descriptors and the rawtr descriptor looks like this: `{
      "desc": "rawtr(83462993476e9310eda5cd58c3597f64aa25c68c03ef37dfd69cf46a7bfb26b8)#m8wpngyu",
      "timestamp": 1670360788,
      "active": false
    }`
raphjaph
CC BY-SA 4.0
2022-12-07T17:45:27.320Z
Is that what you used to import or what `listdescriptors` returns?
Ava Chow
CC BY-SA 4.0
2022-12-07T18:08:59.860Z
This is what `listdescriptors` returns
raphjaph
CC BY-SA 4.0
2022-12-07T18:09:43.073Z
I think it always returns the public key in canonical form (hex) instead of the private key which is bas58 (WIF).
raphjaph
CC BY-SA 4.0
2022-12-07T20:16:08.993Z
Everything works now. I added an EDIT to the question but am unsure if this is the proper etiquette. Should I delete the question instead?
raphjaph
CC BY-SA 4.0
2022-12-07T21:02:24.007Z
If you solved your own question, please add an answer to describe how :)
Murch
<wallet><bitcoin-cli><output-script-descriptors><p2tr>
How to spend an imported rawtr() descriptor with bitcoin-cli?
raphjaph
# How to spend an imported rawtr() descriptor with bitcoin-cli?

(Asked by: username_0 on 2022-12-06)

I created a [transaction](https://mempool.space/signet/tx/26651571eb31f9ea4f400615bd5fb834a2b0aa120a03074eac889651ffefbd0d) that creates a taproot output that can be spent using the private key (`KEY`) corresponding to the taproot output key. Then I imported the WIF formatted private key into Bitcoin Core with `importdescriptors '[{"desc: rawtr(KEY), "timestamp":"now" ..."}]'`, which was successful. With `listdescriptors` I can see that it is in the wallet but with `listunspent` the taproot output does not show up.

How can I tell the wallet to recognize the taproot output as spendable?

I've also tried setting the descriptor to active but then it tells me only ranged descriptors can be active and I'm unsure how to add a range to a `rawtr(KEY)` descriptor.

**Tags:** wallet, bitcoin-cli, output-script-descriptors, p2tr

> **Comments:**
> **username_1**: Can you retrieve the transaction using `gettransaction`? If not, try rescanning the blockchain first.  
> **username_0**: Yes, I can retrieve it with `bitcoin-cli -chain=signet gettransaction 26651571eb31f9ea4f400615bd5fb834a2b0aa120a03074eac889651ffefbd0d `. The wallet I'm doing this with contains multiple descriptors and the rawtr descriptor looks like this: `{       "desc": "rawtr(83462993476e9310eda5cd58c3597f64aa25c68c03ef37dfd69cf46a7bfb26b8)#m8wpngyu",       "timestamp": 1670360788,       "active": false     }`  
> **username_1**: Is that what you used to import or what `listdescriptors` returns?  
> **username_0**: This is what `listdescriptors` returns  
> **username_0**: I think it always returns the public key in canonical form (hex) instead of the private key which is bas58 (WIF).  
> **username_0**: Everything works now. I added an EDIT to the question but am unsure if this is the proper etiquette. Should I delete the question instead?  
> **username_2**: If you solved your own question, please add an answer to describe how :)  

---

## 1 answers

### Answer by username_0 on 2022-12-08. Score: 2 | Accepted answer

The problem was that the wallet couldn't recognize the utxo with `listunspent` because I put the wrong private key into the descriptor. `rawtr(KEY)` takes a *tweaked* private key and I accidentally put the *untweaked* private key into it. After I corrected the wallet was able to recognize and spend the utxo.


---

