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;
41struct tx_destination_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::uint64_t unlock_time,
75 const std::uint32_t subaddr_account,
76 const std::set<std::uint32_t>& subaddr_minor_indices,
77 std::vector<cryptonote::tx_source_entry>& sources,
78 std::vector<cryptonote::tx_destination_entry>& destinations,
80 const rct::RCTConfig& rct_config,
81 const bool use_rct,
82 const bool reconstruction,
83 crypto::secret_key& tx_secret_key,
84 std::vector<crypto::secret_key>& tx_aux_secret_keys,
85 crypto::secret_key& tx_secret_key_entropy,
86 cryptonote::transaction& unsigned_tx
87 );
88
89 // get the first partial signature for the specified input ('source')
91 const std::size_t source,
92 const rct::keyV& total_alpha_G,
93 const rct::keyV& total_alpha_H,
94 const rct::keyV& alpha,
95 rct::key& c_0,
96 rct::key& s
97 );
98
99 // get intermediate partial signatures for all the inputs
101 const rct::keyM& total_alpha_G,
102 const rct::keyM& total_alpha_H,
103 const rct::keyM& alpha,
104 const rct::key& x,
105 rct::keyV& c_0,
106 rct::keyV& s
107 );
108
109 // finalize an unsigned transaction (add challenges and real responses to incomplete CLSAG signatures)
110 static bool finalize_tx(
111 const std::vector<cryptonote::tx_source_entry>& sources,
112 const rct::keyV& c_0,
113 const rct::keyV& s,
114 cryptonote::transaction& unsigned_tx
115 );
116};
117
118} //namespace signing
119
120} //namespace multisig
#define s(x, c)
Definition: aesb.c:47
Definition: cryptonote_basic.h:205
Definition: multisig_tx_builder_ringct.h:55
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:1029
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:973
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:936
rct::keyV cached_w
Definition: multisig_tx_builder_ringct.h:63
static void init()
Definition: logging.cpp:38
Holds cryptonote related classes and helpers.
Definition: blockchain_db.cpp:45
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: rctTypes.h:300
Definition: rctTypes.h:79