Create a BIP-340 Schnorr signature, for the xonly-pubkey corresponding to *this, optionally tweaked by *merkle_root. Additional nonce entropy is provided through aux.
Declared in <key.h>
bool
SignSchnorr(
uint256 const& hash,
std::span<unsigned char> sig,
uint256 const* merkle_root,
uint256 const& aux) const;
merkle_root is used to optionally perform tweaking of the private key, as specified in BIP341:
If merkle_root == nullptr: no tweaking is done, sign with key directly (this is used for signatures in BIP342 script).
If merkle_root->IsNull(): sign with key + H_TapTweak(pubkey) (this is used for key path spending when no scripts are present).
Otherwise: sign with key + H_TapTweak(pubkey || *merkle_root) (this is used for key path spending, with specific Merkle root of the script tree).
true if signing succeeded.
| Name | Description |
|---|---|
| hash | The 32-byte message hash to sign. |
| sig | Output span (64 bytes) receiving the Schnorr signature. |
| merkle_root | Optional Merkle root controlling BIP341 tweaking (see above). |
| aux | Additional nonce entropy. |