[#XOnlyPubKey-ComputeTapTweakHash]
= xref:XOnlyPubKey.adoc[XOnlyPubKey]::ComputeTapTweakHash
:relfileprefix: ../
:mrdocs:

Compute the Taproot tweak as specified in BIP341, with &ast;this as internal key&colon; &hyphen; if merkle&lowbar;root &equals;&equals; nullptr&colon; H&lowbar;TapTweak(xonly&lowbar;pubkey) &hyphen; otherwise&colon; H&lowbar;TapTweak(xonly&lowbar;pubkey &verbar;&verbar; &ast;merkle&lowbar;root)

== Synopsis

Declared in `&lt;pubkey&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:uint256.adoc[uint256]
ComputeTapTweakHash(xref:uint256.adoc[uint256] const* merkle&lowbar;root) const;
----

== Description

Note that the behavior of this function with merkle&lowbar;root !&equals; nullptr is consensus critical&period;

== Return Value

The computed Taproot tweak hash&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *merkle&lowbar;root*
| Optional Merkle root mixed into the tweak (see above)&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
