BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
confidential.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 
25 #pragma once
29 
30 namespace graphene { namespace protocol {
31 
33 
63 
70 struct blind_memo
71 {
72  account_id_type from;
74  string message;
79  uint32_t check= 0;
80 };
81 
86 {
93 };
94 
103 {
104  struct memo_data
105  {
110  uint32_t check = 0;
111  };
112 
116  operator string()const;
120  stealth_confirmation( const std::string& base58 );
122 
125  vector<char> encrypted_memo;
126 };
127 
136 {
142 };
143 
144 
151 {
152  struct fee_params_t {
155  };
156 
157 
160  account_id_type from;
162  vector<blind_output> outputs;
163 
164  account_id_type fee_payer()const { return from; }
165  void validate()const;
166  share_type calculate_fee(const fee_params_t& )const;
167 };
168 
174 {
175  struct fee_params_t {
177  };
178 
181  account_id_type to;
183  vector<blind_input> inputs;
184 
185  account_id_type fee_payer()const { return GRAPHENE_TEMP_ACCOUNT; }
186  void validate()const;
187 
188  void get_required_authorities( vector<authority>& a )const
189  {
190  for( const auto& in : inputs )
191  a.push_back( in.owner );
192  }
193 };
194 
239 {
240  struct fee_params_t {
243  };
244 
246  vector<blind_input> inputs;
247  vector<blind_output> outputs;
248 
250  account_id_type fee_payer()const;
251  void validate()const;
252  share_type calculate_fee( const fee_params_t& k )const;
253 
254  void get_required_authorities( vector<authority>& a )const
255  {
256  for( const auto& in : inputs )
257  a.push_back( in.owner );
258  }
259 };
260 
262 
263 } } // graphene::protocol
264 
266  (one_time_key)(to)(encrypted_memo) )
267 
269  (from)(amount)(blinding_factor)(commitment)(check) )
270 
272  (from)(amount)(message)(check) )
274  (commitment)(owner) )
276  (commitment)(range_proof)(owner)(stealth_memo) )
278  (fee)(amount)(from)(blinding_factor)(outputs) )
280  (fee)(amount)(to)(blinding_factor)(inputs) )
282  (fee)(inputs)(outputs) )
286 
graphene::protocol::transfer_from_blind_operation::fee_params_t
Definition: confidential.hpp:175
graphene::protocol::transfer_to_blind_operation
Converts public account balance to a blinded or stealth balance.
Definition: confidential.hpp:150
graphene::protocol::blind_transfer_operation
Transfers from blind to blind.
Definition: confidential.hpp:238
graphene::protocol::blind_output
Defines data required to create a new blind commitment.
Definition: confidential.hpp:135
graphene::protocol::transfer_to_blind_operation::fee
asset fee
Definition: confidential.hpp:158
graphene::protocol::stealth_confirmation::memo_data::check
uint32_t check
Definition: confidential.hpp:110
graphene::protocol::stealth_confirmation::one_time_key
public_key_type one_time_key
Definition: confidential.hpp:123
graphene::protocol::transfer_from_blind_operation::inputs
vector< blind_input > inputs
Definition: confidential.hpp:183
graphene::protocol::stealth_confirmation::memo_data::commitment
fc::ecc::commitment_type commitment
Definition: confidential.hpp:109
graphene::protocol::blind_memo::check
uint32_t check
Definition: confidential.hpp:79
graphene::protocol::transfer_to_blind_operation::fee_params_t::price_per_output
uint32_t price_per_output
Definition: confidential.hpp:154
graphene::protocol::transfer_from_blind_operation::to
account_id_type to
Definition: confidential.hpp:181
graphene::protocol::blind_input
Definition: confidential.hpp:85
graphene::protocol::blind_transfer_operation::get_required_authorities
void get_required_authorities(vector< authority > &a) const
Definition: confidential.hpp:254
graphene::protocol::blind_transfer_operation::fee_params_t
Definition: confidential.hpp:240
graphene::protocol::blind_transfer_operation::calculate_fee
share_type calculate_fee(const fee_params_t &k) const
Definition: confidential.cpp:137
graphene::protocol::blind_output::range_proof
range_proof_type range_proof
Definition: confidential.hpp:139
graphene::protocol::blind_output::owner
authority owner
Definition: confidential.hpp:140
GRAPHENE_TEMP_ACCOUNT
#define GRAPHENE_TEMP_ACCOUNT
Represents the canonical account with WILDCARD authority (anybody can access funds in temp account)
Definition: config.hpp:148
graphene::protocol::blind_memo::message
string message
Definition: confidential.hpp:74
graphene::protocol::blind_transfer_operation::outputs
vector< blind_output > outputs
Definition: confidential.hpp:247
fc::sha256
Definition: sha256.hpp:10
graphene::protocol::transfer_from_blind_operation::blinding_factor
blind_factor_type blinding_factor
Definition: confidential.hpp:182
graphene::protocol::stealth_confirmation::memo_data::blinding_factor
fc::sha256 blinding_factor
Definition: confidential.hpp:108
fc::zero_initialized_array< unsigned char, 33 >
graphene::protocol::transfer_to_blind_operation::fee_params_t
Definition: confidential.hpp:152
graphene::protocol::blind_transfer_operation::validate
void validate() const
Definition: confidential.cpp:106
graphene::protocol::public_key_type
Definition: types.hpp:312
graphene::protocol::base_operation
Definition: base.hpp:124
graphene::protocol::stealth_confirmation::to
optional< public_key_type > to
Definition: confidential.hpp:124
graphene::protocol::blind_transfer_operation::fee_payer
account_id_type fee_payer() const
Definition: confidential.cpp:97
graphene::protocol::stealth_confirmation::memo_data::from
optional< public_key_type > from
Definition: confidential.hpp:106
graphene::protocol::transfer_from_blind_operation::fee_payer
account_id_type fee_payer() const
Definition: confidential.hpp:185
graphene::protocol::transfer_to_blind_operation::validate
void validate() const
Definition: confidential.cpp:32
graphene::protocol::transfer_from_blind_operation
Converts blinded/stealth balance to a public account balance.
Definition: confidential.hpp:173
GRAPHENE_BLOCKCHAIN_PRECISION
#define GRAPHENE_BLOCKCHAIN_PRECISION
Definition: config.hpp:29
graphene::protocol::blind_memo::from
account_id_type from
Definition: confidential.hpp:72
graphene::protocol::transfer_to_blind_operation::fee_payer
account_id_type fee_payer() const
Definition: confidential.hpp:164
authority.hpp
GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION
#define GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION(type)
Definition: types.hpp:85
graphene::protocol::blind_transfer_operation::inputs
vector< blind_input > inputs
Definition: confidential.hpp:246
graphene::protocol::transfer_to_blind_operation::from
account_id_type from
Definition: confidential.hpp:160
graphene::protocol::stealth_confirmation::stealth_confirmation
stealth_confirmation()
Definition: confidential.hpp:121
graphene::protocol::blind_output::stealth_memo
optional< stealth_confirmation > stealth_memo
Definition: confidential.hpp:141
graphene::protocol::stealth_confirmation::memo_data::amount
asset amount
Definition: confidential.hpp:107
graphene::protocol::blind_input::owner
authority owner
Definition: confidential.hpp:92
graphene::protocol::blind_memo
Definition: confidential.hpp:70
graphene::protocol::transfer_from_blind_operation::fee_params_t::fee
uint64_t fee
the cost to register the cheapest non-free account
Definition: confidential.hpp:176
graphene::protocol::blind_memo::amount
share_type amount
Definition: confidential.hpp:73
base.hpp
graphene::protocol::blind_output::commitment
fc::ecc::commitment_type commitment
Definition: confidential.hpp:137
graphene::protocol::blind_transfer_operation::fee_params_t::fee
uint64_t fee
the cost to register the cheapest non-free account
Definition: confidential.hpp:241
fc::ecc::blind_factor_type
fc::sha256 blind_factor_type
Definition: elliptic.hpp:21
FC_REFLECT
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:388
graphene::protocol::blind_transfer_operation::fee
asset fee
Definition: confidential.hpp:245
graphene::protocol::blind_input::commitment
fc::ecc::commitment_type commitment
Definition: confidential.hpp:87
graphene::protocol::authority
Identifies a weighted set of keys and accounts that must approve operations.
Definition: authority.hpp:34
graphene::protocol::transfer_to_blind_operation::calculate_fee
share_type calculate_fee(const fee_params_t &) const
Definition: confidential.cpp:64
fc::optional
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
fc::ecc::range_proof_type
std::vector< char > range_proof_type
Definition: elliptic.hpp:28
graphene::protocol::transfer_from_blind_operation::validate
void validate() const
Definition: confidential.cpp:70
graphene::protocol::asset
Definition: asset.hpp:31
graphene::protocol::transfer_to_blind_operation::blinding_factor
blind_factor_type blinding_factor
Definition: confidential.hpp:161
graphene::protocol::transfer_to_blind_operation::outputs
vector< blind_output > outputs
Definition: confidential.hpp:162
graphene::protocol::stealth_confirmation::memo_data
Definition: confidential.hpp:104
asset.hpp
graphene::protocol::transfer_from_blind_operation::fee
asset fee
Definition: confidential.hpp:179
graphene::protocol::transfer_to_blind_operation::fee_params_t::fee
uint64_t fee
the cost to register the cheapest non-free account
Definition: confidential.hpp:153
graphene::protocol::transfer_from_blind_operation::get_required_authorities
void get_required_authorities(vector< authority > &a) const
Definition: confidential.hpp:188
graphene::protocol::blind_transfer_operation::fee_params_t::price_per_output
uint32_t price_per_output
Definition: confidential.hpp:242
graphene::protocol::transfer_from_blind_operation::amount
asset amount
Definition: confidential.hpp:180
graphene
Definition: api.cpp:48
graphene::protocol::stealth_confirmation::encrypted_memo
vector< char > encrypted_memo
Definition: confidential.hpp:125
graphene::protocol::transfer_to_blind_operation::amount
asset amount
Definition: confidential.hpp:159
graphene::protocol::stealth_confirmation
Definition: confidential.hpp:102
fc::safe
Definition: safe.hpp:26