BitShares-Core  6.1.0
BitShares blockchain implementation and command-line interface 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 {
153  uint64_t fee = 5*GRAPHENE_BLOCKCHAIN_PRECISION;
154  uint32_t price_per_output = 5*GRAPHENE_BLOCKCHAIN_PRECISION;
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_parameters_type& )const;
167 };
168 
174 {
176  uint64_t fee = 5*GRAPHENE_BLOCKCHAIN_PRECISION;
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 {
241  uint64_t fee = 5*GRAPHENE_BLOCKCHAIN_PRECISION;
242  uint32_t price_per_output = 5*GRAPHENE_BLOCKCHAIN_PRECISION;
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_parameters_type& 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 
void get_required_authorities(vector< authority > &a) const
#define GRAPHENE_TEMP_ACCOUNT
Represents the canonical account with WILDCARD authority (anybody can access funds in temp account) ...
Definition: config.hpp:148
Identifies a weighted set of keys and accounts that must approve operations.
Definition: authority.hpp:34
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:388
void get_required_authorities(vector< authority > &a) const
Definition: api.cpp:48
fc::sha256 blind_factor_type
Definition: elliptic.hpp:21
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
fc::ecc::commitment_type commitment
Defines data required to create a new blind commitmentThe blinded output that must be proven to be gr...
#define GRAPHENE_DECLARE_EXTERNAL_SERIALIZATION(type)
Definition: types.hpp:85
fc::ecc::commitment_type commitment
Converts blinded/stealth balance to a public account balance.
#define GRAPHENE_BLOCKCHAIN_PRECISION
Definition: config.hpp:29
std::vector< char > range_proof_type
Definition: elliptic.hpp:28
optional< stealth_confirmation > stealth_memo
Transfers from blind to blind.
Converts public account balance to a blinded or stealth balance.