aboutsummaryrefslogtreecommitdiff
path: root/src/key.h
diff options
context:
space:
mode:
authorPieter Wuille <pieter@wuille.net>2021-02-08 00:15:51 -0800
committerPieter Wuille <pieter@wuille.net>2021-06-12 12:25:28 -0700
commita91d532338ecb66ec5bed164929d878dd55d63a4 (patch)
tree6a4d736bcf31222e9fcb7d46545bc2d292b29d90 /src/key.h
parente77a2839b54fa2039bba468e8c09dbbbf19b150a (diff)
downloadbitcoin-a91d532338ecb66ec5bed164929d878dd55d63a4.tar.xz
Add CKey::SignSchnorr function for BIP 340/341 signing
Diffstat (limited to 'src/key.h')
-rw-r--r--src/key.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/key.h b/src/key.h
index 3ee49a778b..d47e54800c 100644
--- a/src/key.h
+++ b/src/key.h
@@ -128,6 +128,18 @@ public:
*/
bool SignCompact(const uint256& hash, std::vector<unsigned char>& vchSig) const;
+ /**
+ * Create a BIP-340 Schnorr signature, for the xonly-pubkey corresponding to *this,
+ * optionally tweaked by *merkle_root. Additional nonce entropy can be provided through
+ * aux.
+ *
+ * When merkle_root is not nullptr, this results in a signature with a modified key as
+ * specified in BIP341:
+ * - If merkle_root->IsNull(): key + H_TapTweak(pubkey)*G
+ * - Otherwise: key + H_TapTweak(pubkey || *merkle_root)
+ */
+ bool SignSchnorr(const uint256& hash, Span<unsigned char> sig, const uint256* merkle_root = nullptr, const uint256* aux = nullptr) const;
+
//! Derive BIP32 child key.
bool Derive(CKey& keyChild, ChainCode &ccChild, unsigned int nChild, const ChainCode& cc) const;