From a91d532338ecb66ec5bed164929d878dd55d63a4 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Mon, 8 Feb 2021 00:15:51 -0800 Subject: Add CKey::SignSchnorr function for BIP 340/341 signing --- src/key.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/key.h') 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& 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 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; -- cgit v1.2.3