<p>If you know the tweak, you can compute its additive inverse (the negation) and add the resulting point to the tweaked pubkey. The result should be the untweaked key.</p>
<p>The additive inverse is just <code>n - tweak</code>.</p>

CC BY-SA 4.0
2024-08-28T04:58:06.133Z
what is n? 0? 
also are there any helper functions for this in Secp256k1? ty
jaybny
CC BY-SA 4.0
2024-08-28T05:07:04.357Z
nevermind - i don't know the tweak - the tweak contains a hash of the pubkey - I know the TagHash - 

tweak is sha256(sha256("TapTweak") | sha256("TapTweak") | P)

so, i guess i don't know the tweak
jaybny
CC BY-SA 4.0
2024-08-28T21:54:37.730Z
`n` is the order of the secp256k1 curve. If you don't know the tweak, you cannot retrieve the internal pubkey.
Ava Chow
CC BY-SA 4.0
2024-08-28T04:21:19.573Z
2024-08-28T04:21:19.573Z
Ava Chow
<p>Tweaking an &quot;internal&quot; public_key into a &quot;tweaked&quot; public key, using bip341 for key spend with taproot, seems to make it impossible to extract the internal key, even when knowing the tweak.</p>
<p>Application is trying to identify a Nostr id from a taproot address. Even when the taproot is spent, this is still not possible, as the tweaked pubkey can't be mapped to an untweaked (nostr) pubkey.</p>
<p>This can only be done by getting a list of NostrIds and generating the TapTweak bip341 addresses and doing a lookup.</p>
<p>Am I missing something?</p>

<taproot><p2tr><nostr>
can i extract internal key given tweaked-pubkey and bip341 tweak tag?
jaybny
# can i extract internal key given tweaked-pubkey and bip341 tweak tag?

(Asked by: username_0 on 2024-08-28)

Tweaking an "internal" public\_key into a "tweaked" public key, using bip341 for key spend with taproot, seems to make it impossible to extract the internal key, even when knowing the tweak.

Application is trying to identify a Nostr id from a taproot address. Even when the taproot is spent, this is still not possible, as the tweaked pubkey can't be mapped to an untweaked (nostr) pubkey.

This can only be done by getting a list of NostrIds and generating the TapTweak bip341 addresses and doing a lookup.

Am I missing something?

**Tags:** taproot, p2tr, nostr


---

## 1 answers

### Answer by username_1 on 2024-08-28. Score: 2

If you know the tweak, you can compute its additive inverse (the negation) and add the resulting point to the tweaked pubkey. The result should be the untweaked key.

The additive inverse is just `n - tweak`.

> **Comments:**
> **username_0**: what is n? 0?  also are there any helper functions for this in Secp256k1? ty  
> **username_0**: nevermind - i don't know the tweak - the tweak contains a hash of the pubkey - I know the TagHash -   tweak is sha256(sha256("TapTweak") | sha256("TapTweak") | P)  so, i guess i don't know the tweak  
> **username_1**: `n` is the order of the secp256k1 curve. If you don't know the tweak, you cannot retrieve the internal pubkey.  

---

