Bitcoin Core
31.1.0
P2P Digital Currency
Toggle main menu visibility
Loading...
Searching...
No Matches
src
musig.h
Go to the documentation of this file.
1
// Copyright (c) 2024-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or https://www.opensource.org/licenses/mit-license.php.
4
5
#ifndef BITCOIN_MUSIG_H
6
#define BITCOIN_MUSIG_H
7
8
#include <
pubkey.h
>
9
10
#include <optional>
11
#include <vector>
12
13
struct
secp256k1_musig_keyagg_cache
;
14
class
MuSig2SecNonceImpl
;
15
struct
secp256k1_musig_secnonce
;
16
17
constexpr
size_t
MUSIG2_PUBNONCE_SIZE
{66};
18
22
std::optional<CPubKey>
MuSig2AggregatePubkeys
(
const
std::vector<CPubKey>& pubkeys,
secp256k1_musig_keyagg_cache
& keyagg_cache,
const
std::optional<CPubKey>& expected_aggregate);
23
std::optional<CPubKey>
MuSig2AggregatePubkeys
(
const
std::vector<CPubKey>& pubkeys);
24
26
CExtPubKey
CreateMuSig2SyntheticXpub
(
const
CPubKey
& pubkey);
27
39
class
MuSig2SecNonce
40
{
41
private
:
42
std::unique_ptr<MuSig2SecNonceImpl>
m_impl
;
43
44
public
:
45
MuSig2SecNonce
();
46
MuSig2SecNonce
(
MuSig2SecNonce
&&) noexcept;
47
MuSig2SecNonce
& operator=(
MuSig2SecNonce
&&) noexcept;
48
~
MuSig2SecNonce
();
49
50
// Delete copy constructors
51
MuSig2SecNonce
(const
MuSig2SecNonce
&) = delete;
52
MuSig2SecNonce
& operator=(const
MuSig2SecNonce
&) = delete;
53
54
secp256k1_musig_secnonce
*
Get
() const;
55
void
Invalidate
();
56
bool
IsValid
();
57
};
58
59
uint256
MuSig2SessionID
(const
CPubKey
& script_pubkey, const
CPubKey
& part_pubkey, const
uint256
& sighash);
60
61
std
::optional<
std
::vector<uint8_t>>
CreateMuSig2AggregateSig
(const
std
::vector<
CPubKey
>& participants, const
CPubKey
& aggregate_pubkey, const
std
::vector<
std
::pair<
uint256
,
bool
>>& tweaks, const
uint256
& sighash, const
std
::map<
CPubKey
,
std
::vector<uint8_t>>& pubnonces, const
std
::map<
CPubKey
,
uint256
>& partial_sigs);
62
63
#endif
// BITCOIN_MUSIG_H
CPubKey
An encapsulated public key.
Definition
pubkey.h:34
MuSig2SecNonce::Invalidate
void Invalidate()
Definition
musig.cpp:116
MuSig2SecNonce::IsValid
bool IsValid()
Definition
musig.cpp:121
MuSig2SecNonce::MuSig2SecNonce
MuSig2SecNonce()
Definition
musig.cpp:104
MuSig2SecNonce::Get
secp256k1_musig_secnonce * Get() const
Definition
musig.cpp:111
MuSig2SecNonce::m_impl
std::unique_ptr< MuSig2SecNonceImpl > m_impl
Definition
musig.h:42
MuSig2SecNonce::MuSig2SecNonce
MuSig2SecNonce(MuSig2SecNonce &&) noexcept
MuSig2SecNonceImpl
Definition
musig.cpp:87
uint256
256-bit opaque blob.
Definition
uint256.h:195
CreateMuSig2SyntheticXpub
CExtPubKey CreateMuSig2SyntheticXpub(const CPubKey &pubkey)
Construct the BIP 328 synthetic xpub for a pubkey.
Definition
musig.cpp:75
MUSIG2_PUBNONCE_SIZE
constexpr size_t MUSIG2_PUBNONCE_SIZE
Definition
musig.h:17
MuSig2SessionID
uint256 MuSig2SessionID(const CPubKey &script_pubkey, const CPubKey &part_pubkey, const uint256 &sighash)
Definition
musig.cpp:126
CreateMuSig2AggregateSig
std::optional< std::vector< uint8_t > > CreateMuSig2AggregateSig(const std::vector< CPubKey > &participants, const CPubKey &aggregate_pubkey, const std::vector< std::pair< uint256, bool > > &tweaks, const uint256 &sighash, const std::map< CPubKey, std::vector< uint8_t > > &pubnonces, const std::map< CPubKey, uint256 > &partial_sigs)
Definition
musig.cpp:133
MuSig2AggregatePubkeys
std::optional< CPubKey > MuSig2AggregatePubkeys(const std::vector< CPubKey > &pubkeys, secp256k1_musig_keyagg_cache &keyagg_cache, const std::optional< CPubKey > &expected_aggregate)
Definition
musig.cpp:58
std
Definition
common.h:29
pubkey.h
CExtPubKey
Definition
pubkey.h:336
secp256k1_musig_keyagg_cache
This module implements BIP 327 "MuSig2 for BIP340-compatibleMulti-Signatures" (https://github....
Definition
secp256k1_musig.h:43
secp256k1_musig_secnonce
Opaque data structure that holds a signer's secret nonce.
Definition
secp256k1_musig.h:59
Generated on
for Bitcoin Core by
1.17.0