[#CreateMuSig2PartialSig]
= CreateMuSig2PartialSig
:mrdocs:

Produce this participant&apos;s MuSig2 partial signature for the session&period;

== Synopsis

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

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
std::optional&lt;uint256&gt;
CreateMuSig2PartialSig(
    xref:uint256.adoc[uint256] const& hash,
    xref:CKey.adoc[CKey] const& our&lowbar;seckey,
    xref:CPubKey.adoc[CPubKey] const& aggregate&lowbar;pubkey,
    std::vector&lt;CPubKey&gt; const& pubkeys,
    std::map&lt;CPubKey, std::vector&lt;uint8&lowbar;t&gt;&gt; const& pubnonces,
    xref:MuSig2SecNonce.adoc[MuSig2SecNonce]& secnonce,
    std::vector&lt;std::pair&lt;uint256, bool&gt;&gt; const& tweaks);
----

== Return Value

This participant&apos;s partial signature, or std&colon;&colon;nullopt on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *hash*
| The signature hash being signed&period;
| *our&lowbar;seckey*
| This participant&apos;s secret key&period;
| *aggregate&lowbar;pubkey*
| The aggregate public key of all participants&period;
| *pubkeys*
| The participant public keys, in aggregation order&period;
| *pubnonces*
| The public nonces from all participants, keyed by public key&period;
| *secnonce*
| This participant&apos;s secret nonce for the session&period;
| *tweaks*
| The tweaks to apply to the aggregate key, each with a flag selecting x&hyphen;only or ordinary tweaking&period;
|===


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