Monero
Loading...
Searching...
No Matches
multisig_tx_builder_ringct.h
Go to the documentation of this file.
1// Copyright (c) 2021, The Monero Project
2//
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without modification, are
6// permitted provided that the following conditions are met:
7//
8// 1. Redistributions of source code must retain the above copyright notice, this list of
9// conditions and the following disclaimer.
10//
11// 2. Redistributions in binary form must reproduce the above copyright notice, this list
12// of conditions and the following disclaimer in the documentation and/or other
13// materials provided with the distribution.
14//
15// 3. Neither the name of the copyright holder nor the names of its contributors may be
16// used to endorse or promote products derived from this software without specific
17// prior written permission.
18//
19// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
20// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
22// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
27// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29
30#pragma once
31
32#include "ringct/rctTypes.h"
33
34#include <set>
35#include <vector>
36
37namespace cryptonote {
38
39class transaction;
40struct tx_source_entry;
42struct account_keys;
43
44}
45
46namespace multisig {
47
48namespace signing {
49
50class CLSAG_context_t;
51
52// number of parallel signing nonces to use per signer (2 nonces as in musig2 and FROST)
53constexpr std::size_t kAlphaComponents = 2;
54
56private:
57 // the tx builder has been initialized
59 // the tx builder is 'reconstructing' a tx that has already been created using this object
61 // cached: mu_P*(local keys and sender-receiver secret and subaddress material) + mu_C*(commitment-to-zero secret)
62 // - these are only used for the initial building of a tx (not reconstructions)
64 // contexts for making CLSAG challenges with multisig nonces
65 std::vector<CLSAG_context_t> CLSAG_contexts;
66public:
69
70 // prepare an unsigned transaction (and get tx privkeys for outputs)
71 bool init(
72 const cryptonote::account_keys& account_keys,
73 const std::vector<std::uint8_t>& extra,
74 const std::uint32_t subaddr_account,
75 const std::set<std::uint32_t>& subaddr_minor_indices,
76 std::vector<cryptonote::tx_source_entry>& sources,
77 std::vector<cryptonote::tx_destination_entry>& destinations,
79 const rct::RCTConfig& rct_config,
80 const bool use_rct,
81 const bool reconstruction,
82 crypto::secret_key& tx_secret_key,
83 std::vector<crypto::secret_key>& tx_aux_secret_keys,
84 crypto::secret_key& tx_secret_key_entropy,
85 cryptonote::transaction& unsigned_tx
86 );
87
88 // get the first partial signature for the specified input ('source')
90 const std::size_t source,
91 const rct::keyV& total_alpha_G,
92 const rct::keyV& total_alpha_H,
93 const rct::keyV& alpha,
94 rct::key& c_0,
95 rct::key& s
96 );
97
98 // get intermediate partial signatures for all the inputs
100 const rct::keyM& total_alpha_G,
101 const rct::keyM& total_alpha_H,
102 const rct::keyM& alpha,
103 const rct::key& x,
104 rct::keyV& c_0,
105 rct::keyV& s
106 );
107
108 // finalize an unsigned transaction (add challenges and real responses to incomplete CLSAG signatures)
109 static bool finalize_tx(
110 const std::vector<cryptonote::tx_source_entry>& sources,
111 const rct::keyV& c_0,
112 const rct::keyV& s,
113 cryptonote::transaction& unsigned_tx
114 );
115};
116
117} //namespace signing
118
119} //namespace multisig
#define s(x, c)
Definition aesb.c:47
Definition cryptonote_basic.h:205
Definition multisig_clsag_context.h:47
std::vector< CLSAG_context_t > CLSAG_contexts
Definition multisig_tx_builder_ringct.h:65
~tx_builder_ringct_t()
Definition multisig_tx_builder_ringct.cpp:815
static bool finalize_tx(const std::vector< cryptonote::tx_source_entry > &sources, const rct::keyV &c_0, const rct::keyV &s, cryptonote::transaction &unsigned_tx)
Definition multisig_tx_builder_ringct.cpp:1028
bool reconstruction
Definition multisig_tx_builder_ringct.h:60
bool initialized
Definition multisig_tx_builder_ringct.h:58
bool next_partial_sign(const rct::keyM &total_alpha_G, const rct::keyM &total_alpha_H, const rct::keyM &alpha, const rct::key &x, rct::keyV &c_0, rct::keyV &s)
Definition multisig_tx_builder_ringct.cpp:972
tx_builder_ringct_t()
Definition multisig_tx_builder_ringct.cpp:813
bool first_partial_sign(const std::size_t source, const rct::keyV &total_alpha_G, const rct::keyV &total_alpha_H, const rct::keyV &alpha, rct::key &c_0, rct::key &s)
Definition multisig_tx_builder_ringct.cpp:935
rct::keyV cached_w
Definition multisig_tx_builder_ringct.h:63
static void init()
Definition logging.cpp:42
epee::mlocked< tools::scrubbed< ec_scalar > > secret_key
Definition crypto.h:72
Holds cryptonote related classes and helpers.
Definition blockchain_db.cpp:45
Definition multisig_clsag_context.cpp:47
constexpr std::size_t kAlphaComponents
Definition multisig_tx_builder_ringct.h:53
Definition multisig.cpp:46
std::vector< key > keyV
Definition rctTypes.h:89
std::vector< keyV > keyM
Definition rctTypes.h:90
const CharType(& source)[N]
Definition pointer.h:1147
Definition account.h:41
Definition cryptonote_tx_utils.h:75
Definition cryptonote_tx_utils.h:43
Definition rctTypes.h:308
Definition rctTypes.h:79