BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
wallet_voting.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 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 #include "wallet_api_impl.hpp"
26 
27 /*
28  * Methods to handle voting / workers / committee
29  */
30 
31 namespace graphene { namespace wallet { namespace detail {
32 
33  template<typename WorkerInit>
34  static WorkerInit _create_worker_initializer( const variant& worker_settings )
35  {
36  WorkerInit result;
37  from_variant( worker_settings, result, GRAPHENE_MAX_NESTED_OBJECTS );
38  return result;
39  }
40 
42  string account,
43  worker_vote_delta delta,
44  bool broadcast
45  )
46  {
47  account_object acct = get_account( account );
48 
49  // you could probably use a faster algorithm for this, but flat_set is fast enough :)
50  flat_set< worker_id_type > merged;
51  merged.reserve( delta.vote_for.size() + delta.vote_against.size() + delta.vote_abstain.size() );
52  for( const worker_id_type& wid : delta.vote_for )
53  {
54  bool inserted = merged.insert( wid ).second;
55  FC_ASSERT( inserted, "worker ${wid} specified multiple times", ("wid", wid) );
56  }
57  for( const worker_id_type& wid : delta.vote_against )
58  {
59  bool inserted = merged.insert( wid ).second;
60  FC_ASSERT( inserted, "worker ${wid} specified multiple times", ("wid", wid) );
61  }
62  for( const worker_id_type& wid : delta.vote_abstain )
63  {
64  bool inserted = merged.insert( wid ).second;
65  FC_ASSERT( inserted, "worker ${wid} specified multiple times", ("wid", wid) );
66  }
67 
68  // should be enforced by FC_ASSERT's above
69  assert( merged.size() == delta.vote_for.size() + delta.vote_against.size() + delta.vote_abstain.size() );
70 
71  vector< object_id_type > query_ids;
72  for( const worker_id_type& wid : merged )
73  query_ids.push_back( object_id_type(wid) );
74 
75  flat_set<vote_id_type> new_votes( acct.options.votes );
76 
77  fc::variants objects = _remote_db->get_objects( query_ids, {} );
78  for( const variant& obj : objects )
79  {
80  worker_object wo;
81  worker_id_type wo_id { wo.id };
83  new_votes.erase( wo.vote_for );
84  new_votes.erase( wo.vote_against );
85  if( delta.vote_for.find( wo_id ) != delta.vote_for.end() )
86  new_votes.insert( wo.vote_for );
87  else if( delta.vote_against.find( wo_id ) != delta.vote_against.end() )
88  new_votes.insert( wo.vote_against );
89  else
90  assert( delta.vote_abstain.find( wo_id ) != delta.vote_abstain.end() );
91  }
92 
93  account_update_operation update_op;
94  update_op.account = acct.id;
95  update_op.new_options = acct.options;
96  update_op.new_options->votes = new_votes;
97 
99  tx.operations.push_back( update_op );
100  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees() );
101  tx.validate();
102 
103  return sign_transaction( tx, broadcast );
104  }
105 
107  bool broadcast )
108  { try {
109 
110  committee_member_create_operation committee_member_create_op;
111  committee_member_create_op.committee_member_account = get_account_id(owner_account);
112  committee_member_create_op.url = url;
113  if (_remote_db->get_committee_member_by_account(owner_account))
114  FC_THROW("Account ${owner_account} is already a committee_member", ("owner_account", owner_account));
115 
117  tx.operations.push_back( committee_member_create_op );
118  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees());
119  tx.validate();
120 
121  return sign_transaction( tx, broadcast );
122  } FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
123 
125  {
126  try
127  {
128  fc::optional<witness_id_type> witness_id = maybe_id<witness_id_type>(owner_account);
129  if (witness_id)
130  {
131  std::vector<witness_id_type> ids_to_get;
132  ids_to_get.push_back(*witness_id);
133  std::vector<fc::optional<witness_object>> witness_objects = _remote_db->get_witnesses(ids_to_get);
134  if (witness_objects.front())
135  return *witness_objects.front();
136  FC_THROW("No witness is registered for id ${id}", ("id", owner_account));
137  }
138  else
139  {
140  // then maybe it's the owner account
141  try
142  {
143  auto owner_account_id = std::string(get_account_id(owner_account));
144  fc::optional<witness_object> witness = _remote_db->get_witness_by_account(owner_account_id);
145  if (witness)
146  return *witness;
147  else
148  FC_THROW("No witness is registered for account ${account}", ("account", owner_account));
149  }
150  catch (const fc::exception&)
151  {
152  FC_THROW("No account or witness named ${account}", ("account", owner_account));
153  }
154  }
155  }
156  FC_CAPTURE_AND_RETHROW( (owner_account) )
157  }
158 
160  {
161  try
162  {
163  fc::optional<committee_member_id_type> committee_member_id =
164  maybe_id<committee_member_id_type>(owner_account);
165  if (committee_member_id)
166  {
167  std::vector<committee_member_id_type> ids_to_get;
168  ids_to_get.push_back(*committee_member_id);
169  std::vector<fc::optional<committee_member_object>> committee_member_objects =
170  _remote_db->get_committee_members(ids_to_get);
171  if (committee_member_objects.front())
172  return *committee_member_objects.front();
173  FC_THROW("No committee_member is registered for id ${id}", ("id", owner_account));
174  }
175  else
176  {
177  // then maybe it's the owner account
178  try
179  {
180  fc::optional<committee_member_object> committee_member =
181  _remote_db->get_committee_member_by_account(owner_account);
182  if (committee_member)
183  return *committee_member;
184  else
185  FC_THROW("No committee_member is registered for account ${account}", ("account", owner_account));
186  }
187  catch (const fc::exception&)
188  {
189  FC_THROW("No account or committee_member named ${account}", ("account", owner_account));
190  }
191  }
192  }
193  FC_CAPTURE_AND_RETHROW( (owner_account) )
194  }
195 
197  string url, bool broadcast /* = false */)
198  { try {
199  account_object witness_account = get_account(owner_account);
200  fc::ecc::private_key active_private_key = get_private_key_for_account(witness_account);
201  int witness_key_index = find_first_unused_derived_key_index(active_private_key);
202  fc::ecc::private_key witness_private_key =
203  derive_private_key(key_to_wif(active_private_key), witness_key_index);
204  graphene::chain::public_key_type witness_public_key = witness_private_key.get_public_key();
205 
206  witness_create_operation witness_create_op;
207  witness_create_op.witness_account = witness_account.id;
208  witness_create_op.block_signing_key = witness_public_key;
209  witness_create_op.url = url;
210 
211  if (_remote_db->get_witness_by_account(std::string(witness_create_op.witness_account)))
212  FC_THROW("Account ${owner_account} is already a witness", ("owner_account", owner_account));
213 
215  tx.operations.push_back( witness_create_op );
216  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees());
217  tx.validate();
218 
219  _wallet.pending_witness_registrations[owner_account] = key_to_wif(witness_private_key);
220 
221  return sign_transaction( tx, broadcast );
222  } FC_CAPTURE_AND_RETHROW( (owner_account)(broadcast) ) }
223 
224  signed_transaction wallet_api_impl::update_witness(string witness_name, string url,
225  string block_signing_key, bool broadcast )
226  { try {
227  witness_object witness = get_witness(witness_name);
228  account_object witness_account = get_account( witness.witness_account );
229 
230  witness_update_operation witness_update_op;
231  witness_update_op.witness = witness.id;
232  witness_update_op.witness_account = witness_account.id;
233  if( url != "" )
234  witness_update_op.new_url = url;
235  if( block_signing_key != "" )
236  witness_update_op.new_signing_key = public_key_type( block_signing_key );
237 
239  tx.operations.push_back( witness_update_op );
240  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees() );
241  tx.validate();
242 
243  return sign_transaction( tx, broadcast );
244  } FC_CAPTURE_AND_RETHROW( (witness_name)(url)(block_signing_key)(broadcast) ) }
245 
246  signed_transaction wallet_api_impl::create_worker( string owner_account, time_point_sec work_begin_date,
247  time_point_sec work_end_date, share_type daily_pay, string name, string url,
248  variant worker_settings, bool broadcast)
249  {
250  worker_initializer init;
251  std::string wtype = worker_settings["type"].get_string();
252 
253  // TODO: Use introspection to do this dispatch
254  if( wtype == "burn" )
255  init = _create_worker_initializer< burn_worker_initializer >( worker_settings );
256  else if( wtype == "refund" )
257  init = _create_worker_initializer< refund_worker_initializer >( worker_settings );
258  else if( wtype == "vesting" )
259  init = _create_worker_initializer< vesting_balance_worker_initializer >( worker_settings );
260  else
261  {
262  FC_ASSERT( false, "unknown worker[\"type\"] value" );
263  }
264 
266  op.owner = get_account( owner_account ).id;
267  op.work_begin_date = work_begin_date;
268  op.work_end_date = work_end_date;
269  op.daily_pay = daily_pay;
270  op.name = name;
271  op.url = url;
272  op.initializer = init;
273 
275  tx.operations.push_back( op );
276  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees() );
277  tx.validate();
278 
279  return sign_transaction( tx, broadcast );
280  }
281 
283  string committee_member, bool approve, bool broadcast )
284  { try {
285  account_object voting_account_object = get_account(voting_account);
286  fc::optional<committee_member_object> committee_member_obj =
287  _remote_db->get_committee_member_by_account(committee_member);
288  if (!committee_member_obj)
289  FC_THROW("Account ${committee_member} is not registered as a committee_member",
290  ("committee_member", committee_member));
291  if (approve)
292  {
293  auto insert_result = voting_account_object.options.votes.insert(committee_member_obj->vote_id);
294  if (!insert_result.second)
295  FC_THROW("Account ${account} was already voting for committee_member ${committee_member}",
296  ("account", voting_account)("committee_member", committee_member));
297  }
298  else
299  {
300  auto votes_removed = voting_account_object.options.votes.erase(committee_member_obj->vote_id);
301  if( 0 == votes_removed )
302  FC_THROW("Account ${account} is already not voting for committee_member ${committee_member}",
303  ("account", voting_account)("committee_member", committee_member));
304  }
305  account_update_operation account_update_op;
306  account_update_op.account = voting_account_object.id;
307  account_update_op.new_options = voting_account_object.options;
308 
310  tx.operations.push_back( account_update_op );
311  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees());
312  tx.validate();
313 
314  return sign_transaction( tx, broadcast );
315  } FC_CAPTURE_AND_RETHROW( (voting_account)(committee_member)(approve)(broadcast) ) }
316 
317  signed_transaction wallet_api_impl::vote_for_witness(string voting_account, string witness,
318  bool approve, bool broadcast )
319  { try {
320  account_object voting_account_object = get_account(voting_account);
321 
322  fc::optional<witness_object> witness_obj = _remote_db->get_witness_by_account(witness);
323  if (!witness_obj)
324  FC_THROW("Account ${witness} is not registered as a witness", ("witness", witness));
325  if (approve)
326  {
327  auto insert_result = voting_account_object.options.votes.insert(witness_obj->vote_id);
328  if (!insert_result.second)
329  FC_THROW("Account ${account} was already voting for witness ${witness}",
330  ("account", voting_account)("witness", witness));
331  }
332  else
333  {
334  auto votes_removed = voting_account_object.options.votes.erase(witness_obj->vote_id);
335  if( 0 == votes_removed )
336  FC_THROW("Account ${account} is already not voting for witness ${witness}",
337  ("account", voting_account)("witness", witness));
338  }
339  account_update_operation account_update_op;
340  account_update_op.account = voting_account_object.id;
341  account_update_op.new_options = voting_account_object.options;
342 
344  tx.operations.push_back( account_update_op );
345  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees());
346  tx.validate();
347 
348  return sign_transaction( tx, broadcast );
349  } FC_CAPTURE_AND_RETHROW( (voting_account)(witness)(approve)(broadcast) ) }
350 
352  optional<string> voting_account, bool broadcast )
353  { try {
354  account_object account_object_to_modify = get_account(account_to_modify);
355  if (voting_account)
356  {
357  account_id_type new_voting_account_id = get_account_id(*voting_account);
358  if (account_object_to_modify.options.voting_account == new_voting_account_id)
359  FC_THROW("Voting proxy for ${account} is already set to ${voter}",
360  ("account", account_to_modify)("voter", *voting_account));
361  account_object_to_modify.options.voting_account = new_voting_account_id;
362  }
363  else
364  {
365  if (account_object_to_modify.options.voting_account == GRAPHENE_PROXY_TO_SELF_ACCOUNT)
366  FC_THROW("Account ${account} is already voting for itself", ("account", account_to_modify));
367  account_object_to_modify.options.voting_account = GRAPHENE_PROXY_TO_SELF_ACCOUNT;
368  }
369 
370  account_update_operation account_update_op;
371  account_update_op.account = account_object_to_modify.id;
372  account_update_op.new_options = account_object_to_modify.options;
373 
375  tx.operations.push_back( account_update_op );
376  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees());
377  tx.validate();
378 
379  return sign_transaction( tx, broadcast );
380  } FC_CAPTURE_AND_RETHROW( (account_to_modify)(voting_account)(broadcast) ) }
381 
383  string account_to_modify, uint16_t desired_number_of_witnesses, uint16_t desired_number_of_committee_members,
384  bool broadcast )
385  { try {
386  account_object account_object_to_modify = get_account(account_to_modify);
387 
388  if (account_object_to_modify.options.num_witness == desired_number_of_witnesses &&
389  account_object_to_modify.options.num_committee == desired_number_of_committee_members)
390  FC_THROW("Account ${account} is already voting for ${witnesses} witnesses"
391  " and ${committee_members} committee_members",
392  ("account", account_to_modify)("witnesses", desired_number_of_witnesses)
393  ("committee_members",desired_number_of_witnesses));
394  account_object_to_modify.options.num_witness = desired_number_of_witnesses;
395  account_object_to_modify.options.num_committee = desired_number_of_committee_members;
396 
397  account_update_operation account_update_op;
398  account_update_op.account = account_object_to_modify.id;
399  account_update_op.new_options = account_object_to_modify.options;
400 
402  tx.operations.push_back( account_update_op );
403  set_operation_fees( tx, _remote_db->get_global_properties().parameters.get_current_fees());
404  tx.validate();
405 
406  return sign_transaction( tx, broadcast );
407  } FC_CAPTURE_AND_RETHROW( (account_to_modify)(desired_number_of_witnesses)
408  (desired_number_of_committee_members)(broadcast) ) }
409 
411  fc::time_point_sec expiration_time, const variant_object& changed_values, bool broadcast )
412  {
413  FC_ASSERT( !changed_values.contains("current_fees") );
414 
415  const chain_parameters& current_params = get_global_properties().parameters;
416  chain_parameters new_params = current_params;
419  );
420 
422  update_op.new_parameters = new_params;
423 
425 
426  prop_op.expiration_time = expiration_time;
428  prop_op.fee_paying_account = get_account(proposing_account).id;
429 
430  prop_op.proposed_ops.emplace_back( update_op );
431  current_params.get_current_fees().set_fee( prop_op.proposed_ops.back().op );
432 
434  tx.operations.push_back(prop_op);
435  set_operation_fees(tx, current_params.get_current_fees());
436  tx.validate();
437 
438  return sign_transaction(tx, broadcast);
439  }
440 
441  signed_transaction wallet_api_impl::propose_fee_change( const string& proposing_account,
442  fc::time_point_sec expiration_time, const variant_object& changed_fees, bool broadcast )
443  {
444  const chain_parameters& current_params = get_global_properties().parameters;
445  const fee_schedule_type& current_fees = current_params.get_current_fees();
446 
447  flat_map< int, fee_parameters > fee_map;
448  fee_map.reserve( current_fees.parameters.size() );
449  for( const fee_parameters& op_fee : current_fees.parameters )
450  fee_map[ op_fee.which() ] = op_fee;
451  uint32_t scale = current_fees.scale;
452 
453  for( const auto& item : changed_fees )
454  {
455  const string& key = item.key();
456  if( key == "scale" )
457  {
458  int64_t _scale = item.value().as_int64();
459  FC_ASSERT( _scale >= 0 );
460  FC_ASSERT( _scale <= std::numeric_limits<uint32_t>::max() );
461  scale = uint32_t( _scale );
462  continue;
463  }
464  // is key a number?
465  auto is_numeric = [&key]() -> bool
466  {
467  size_t n = key.size();
468  for( size_t i=0; i<n; i++ )
469  {
470  if( 0 == isdigit( key[i] ) )
471  return false;
472  }
473  return true;
474  };
475 
476  int which;
477  if( is_numeric() )
478  which = std::stoi( key );
479  else
480  {
481  const auto& n2w = _operation_which_map.name_to_which;
482  auto it = n2w.find( key );
483  FC_ASSERT( it != n2w.end(), "unknown operation" );
484  which = it->second;
485  }
486 
487  fee_parameters fp = from_which_variant< fee_parameters >( which, item.value(), GRAPHENE_MAX_NESTED_OBJECTS );
488  fee_map[ which ] = fp;
489  }
490 
491  fee_schedule_type new_fees;
492 
493  for( const std::pair< int, fee_parameters >& item : fee_map )
494  new_fees.parameters.insert( item.second );
495  new_fees.scale = scale;
496 
497  chain_parameters new_params = current_params;
498  new_params.get_mutable_fees() = new_fees;
499 
501  update_op.new_parameters = new_params;
502 
504 
505  prop_op.expiration_time = expiration_time;
507  prop_op.fee_paying_account = get_account(proposing_account).id;
508 
509  prop_op.proposed_ops.emplace_back( update_op );
510  current_params.get_current_fees().set_fee( prop_op.proposed_ops.back().op );
511 
513  tx.operations.push_back(prop_op);
514  set_operation_fees(tx, current_params.get_current_fees());
515  tx.validate();
516 
517  return sign_transaction(tx, broadcast);
518  }
519 
520 }}} // namespace graphene::wallet::detail
graphene::protocol::transaction::operations
vector< operation > operations
Definition: transaction.hpp:89
FC_CAPTURE_AND_RETHROW
#define FC_CAPTURE_AND_RETHROW(...)
Definition: exception.hpp:479
graphene::db::object::id
object_id_type id
Definition: object.hpp:69
fc::exception
Used to generate a useful error report when an exception is thrown.
Definition: exception.hpp:56
graphene::wallet::detail::wallet_api_impl::get_private_key_for_account
fc::ecc::private_key get_private_key_for_account(const account_object &account) const
Definition: wallet_sign.cpp:416
graphene::protocol::account_options::num_committee
uint16_t num_committee
Definition: account.hpp:55
graphene::protocol::fee_schedule
contains all of the parameters necessary to calculate the fee for any operation
Definition: fee_schedule.hpp:173
GRAPHENE_PROXY_TO_SELF_ACCOUNT
#define GRAPHENE_PROXY_TO_SELF_ACCOUNT
Represents the canonical account for specifying you will vote directly (as opposed to a proxy)
Definition: config.hpp:150
fc::static_variant
Definition: raw_fwd.hpp:27
graphene::utilities::key_to_wif
std::string key_to_wif(const fc::sha256 &private_secret)
Definition: key_conversion.cpp:30
graphene::chain::witness_object::vote_id
vote_id_type vote_id
Definition: witness_object.hpp:39
graphene::wallet::detail::derive_private_key
fc::ecc::private_key derive_private_key(const std::string &prefix_string, int sequence_number)
Definition: wallet_sign.cpp:60
graphene::wallet::detail::wallet_api_impl::get_account_id
account_id_type get_account_id(string account_name_or_id) const
Definition: wallet_account.cpp:217
graphene::wallet::detail::wallet_api_impl::update_worker_votes
signed_transaction update_worker_votes(string account, worker_vote_delta delta, bool broadcast)
Definition: wallet_voting.cpp:41
graphene::wallet::detail::wallet_api_impl::vote_for_witness
signed_transaction vote_for_witness(string voting_account, string witness, bool approve, bool broadcast)
Definition: wallet_voting.cpp:317
graphene::chain::global_property_object::parameters
chain_parameters parameters
Definition: global_property_object.hpp:44
FC_THROW
#define FC_THROW( ...)
Definition: exception.hpp:366
graphene::protocol::account_options::voting_account
account_id_type voting_account
Definition: account.hpp:48
graphene::protocol::committee_member_create_operation::committee_member_account
account_id_type committee_member_account
The account which owns the committee_member. This account pays the fee for this operation.
Definition: committee_member.hpp:44
graphene::wallet::detail::wallet_api_impl::_remote_db
fc::api< database_api > _remote_db
Definition: wallet_api_impl.hpp:414
fc::variant::get_string
const std::string & get_string() const
Definition: variant.cpp:575
graphene::protocol::committee_member_create_operation
Create a committee_member object, as a bid to hold a committee_member seat on the network.
Definition: committee_member.hpp:38
graphene::wallet::detail::wallet_api_impl::sign_transaction
signed_transaction sign_transaction(signed_transaction tx, bool broadcast=false)
Definition: wallet_sign.cpp:336
graphene::wallet::detail::wallet_api_impl::set_operation_fees
void set_operation_fees(signed_transaction &tx, const fee_schedule &s) const
Definition: wallet_api_impl.cpp:197
graphene::wallet::detail::wallet_api_impl::create_worker
signed_transaction create_worker(string owner_account, time_point_sec work_begin_date, time_point_sec work_end_date, share_type daily_pay, string name, string url, variant worker_settings, bool broadcast)
Definition: wallet_voting.cpp:246
wallet_api_impl.hpp
fc::from_variant
void from_variant(const variant &var, flat_set< T, A... > &vo, uint32_t _max_depth)
Definition: flat.hpp:116
graphene::protocol::public_key_type
Definition: types.hpp:312
graphene::protocol::worker_create_operation::daily_pay
share_type daily_pay
Definition: worker.hpp:87
graphene::protocol::chain_parameters::get_current_fees
const fee_schedule & get_current_fees() const
Definition: chain_parameters.hpp:50
graphene::protocol::witness_create_operation::witness_account
account_id_type witness_account
The account which owns the witness. This account pays the fee for this operation.
Definition: witness.hpp:43
graphene::wallet::detail::wallet_api_impl::get_account
account_object get_account(account_id_type id) const
Definition: wallet_account.cpp:193
graphene::protocol::witness_create_operation
Create a witness object, as a bid to hold a witness position on the network.
Definition: witness.hpp:37
graphene::protocol::worker_create_operation::url
string url
Definition: worker.hpp:89
graphene::protocol::witness_create_operation::url
string url
Definition: witness.hpp:44
graphene::protocol::account_update_operation
Update an existing account.
Definition: account.hpp:136
graphene::protocol::worker_create_operation
Create a new worker object.
Definition: worker.hpp:79
graphene::wallet::wallet_data::pending_witness_registrations
map< string, string > pending_witness_registrations
Definition: wallet_structs.hpp:189
fc::ecc::private_key
an elliptic curve private key.
Definition: elliptic.hpp:89
graphene::protocol::worker_create_operation::initializer
worker_initializer initializer
This should be set to the initializer appropriate for the type of worker to be created.
Definition: worker.hpp:91
graphene::protocol::witness_update_operation::witness_account
account_id_type witness_account
The account which owns the witness. This account pays the fee for this operation.
Definition: witness.hpp:66
graphene::protocol::witness_update_operation
Update a witness object's URL and block signing key.
Definition: witness.hpp:55
graphene::wallet::detail::wallet_api_impl::set_desired_witness_and_committee_member_count
signed_transaction set_desired_witness_and_committee_member_count(string account_to_modify, uint16_t desired_number_of_witnesses, uint16_t desired_number_of_committee_members, bool broadcast)
Definition: wallet_voting.cpp:382
graphene::protocol::signed_transaction
adds a signature to a transaction
Definition: transaction.hpp:134
graphene::chain::account_object::options
account_options options
Definition: account_object.hpp:222
graphene::protocol::fee_schedule::set_fee
asset set_fee(operation &op, const price &core_exchange_rate=price::unit_price()) const
Definition: fee_schedule_set_fee.cpp:43
graphene::wallet::detail::wallet_api_impl::get_witness
witness_object get_witness(string owner_account)
Definition: wallet_voting.cpp:124
fc::variants
std::vector< variant > variants
Definition: variant.hpp:170
graphene::protocol::worker_create_operation::work_end_date
time_point_sec work_end_date
Definition: worker.hpp:86
graphene::wallet::detail::wallet_api_impl::propose_fee_change
signed_transaction propose_fee_change(const string &proposing_account, fc::time_point_sec expiration_time, const variant_object &changed_fees, bool broadcast=false)
Definition: wallet_voting.cpp:441
graphene::chain::account_object
This class represents an account on the object graph.
Definition: account_object.hpp:180
graphene::protocol::fee_schedule::parameters
fee_parameters::flat_set_type parameters
Definition: fee_schedule.hpp:220
graphene::protocol::witness_update_operation::witness
witness_id_type witness
The witness object to update.
Definition: witness.hpp:64
fc::time_point_sec
Definition: time.hpp:74
fc::from_variant_visitor
Definition: variant.hpp:45
graphene::protocol::witness_update_operation::new_url
optional< string > new_url
The new URL.
Definition: witness.hpp:68
graphene::protocol::account_update_operation::new_options
optional< account_options > new_options
New account options.
Definition: account.hpp:161
graphene::protocol::account_options::votes
flat_set< vote_id_type > votes
Definition: account.hpp:58
graphene::protocol::witness_update_operation::new_signing_key
optional< public_key_type > new_signing_key
The new block signing key.
Definition: witness.hpp:70
graphene::protocol::fee_schedule::scale
uint32_t scale
fee * scale / GRAPHENE_100_PERCENT
Definition: fee_schedule.hpp:221
graphene::protocol::committee_member_update_global_parameters_operation::new_parameters
chain_parameters new_parameters
Definition: committee_member.hpp:89
graphene::protocol::chain_parameters
Definition: chain_parameters.hpp:46
graphene::protocol::committee_member_create_operation::url
string url
Definition: committee_member.hpp:45
graphene::protocol::proposal_create_operation::fee_paying_account
account_id_type fee_paying_account
Definition: proposal.hpp:78
graphene::protocol::chain_parameters::committee_proposal_review_period
uint32_t committee_proposal_review_period
minimum time in seconds that a proposed transaction requiring committee authority may not be signed,...
Definition: chain_parameters.hpp:56
graphene::protocol::account_options::num_witness
uint16_t num_witness
Definition: account.hpp:52
graphene::protocol::proposal_create_operation::expiration_time
time_point_sec expiration_time
Definition: proposal.hpp:80
fc::ecc::private_key::get_public_key
public_key get_public_key() const
Definition: elliptic_impl_priv.cpp:70
graphene::wallet::detail::wallet_api_impl::create_witness
signed_transaction create_witness(string owner_account, string url, bool broadcast)
Definition: wallet_voting.cpp:196
graphene::wallet::detail::wallet_api_impl::_wallet
wallet_data _wallet
Definition: wallet_api_impl.hpp:407
graphene::wallet::detail::wallet_api_impl::set_voting_proxy
signed_transaction set_voting_proxy(string account_to_modify, optional< string > voting_account, bool broadcast)
Definition: wallet_voting.cpp:351
graphene::protocol::committee_member_update_global_parameters_operation
Used by committee_members to update the global parameters of the blockchain.
Definition: committee_member.hpp:84
FC_ASSERT
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
Definition: exception.hpp:345
graphene::wallet::detail::wallet_api_impl::update_witness
signed_transaction update_witness(string witness_name, string url, string block_signing_key, bool broadcast)
Definition: wallet_voting.cpp:224
graphene::protocol::transaction::validate
virtual void validate() const
Definition: transaction.cpp:58
fc::variant
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
Definition: variant.hpp:198
graphene::chain::worker_object
Worker object contains the details of a blockchain worker. See The Blockchain Worker System for detai...
Definition: worker_object.hpp:107
graphene::db::object_id_type
Definition: object_id.hpp:30
graphene::wallet::detail::wallet_api_impl::propose_parameter_change
signed_transaction propose_parameter_change(const string &proposing_account, fc::time_point_sec expiration_time, const variant_object &changed_values, bool broadcast=false)
Definition: wallet_voting.cpp:410
graphene::protocol::worker_create_operation::name
string name
Definition: worker.hpp:88
graphene::wallet::detail::wallet_api_impl::get_committee_member
committee_member_object get_committee_member(string owner_account)
Definition: wallet_voting.cpp:159
graphene::protocol::account_update_operation::account
account_id_type account
The account to update.
Definition: account.hpp:153
graphene::protocol::fee_parameters
transform_to_fee_parameters< operation >::type fee_parameters
Definition: fee_schedule.hpp:35
GRAPHENE_MAX_NESTED_OBJECTS
#define GRAPHENE_MAX_NESTED_OBJECTS
Definition: config.hpp:33
graphene::protocol::chain_parameters::get_mutable_fees
fee_schedule & get_mutable_fees()
Definition: chain_parameters.hpp:51
fc::reflector
defines visit functions for T Unless this is specialized, visit() will not be defined for T.
Definition: reflect.hpp:25
graphene::chain::witness_object
Definition: witness_object.hpp:32
graphene::protocol::worker_create_operation::owner
account_id_type owner
Definition: worker.hpp:84
graphene::wallet::static_variant_map::name_to_which
flat_map< string, int > name_to_which
Definition: reflect_util.hpp:45
graphene::protocol::proposal_create_operation::review_period_seconds
optional< uint32_t > review_period_seconds
Definition: proposal.hpp:81
graphene::protocol::witness_create_operation::block_signing_key
public_key_type block_signing_key
Definition: witness.hpp:45
graphene::wallet::worker_vote_delta::vote_for
flat_set< worker_id_type > vote_for
Definition: wallet_structs.hpp:224
graphene::wallet::worker_vote_delta::vote_against
flat_set< worker_id_type > vote_against
Definition: wallet_structs.hpp:225
fc::optional
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
key_conversion.hpp
graphene::protocol::proposal_create_operation::proposed_ops
vector< op_wrapper > proposed_ops
Definition: proposal.hpp:79
graphene::protocol::proposal_create_operation
The proposal_create_operation creates a transaction proposal, for use in multi-sig scenarios.
Definition: proposal.hpp:70
graphene::protocol::worker_create_operation::work_begin_date
time_point_sec work_begin_date
Definition: worker.hpp:85
graphene::wallet::detail::wallet_api_impl::_operation_which_map
static_variant_map _operation_which_map
Definition: wallet_api_impl.hpp:423
graphene::chain::committee_member_object::vote_id
vote_id_type vote_id
Definition: committee_member_object.hpp:48
graphene::wallet::worker_vote_delta
Definition: wallet_structs.hpp:222
graphene::chain::worker_object::vote_for
vote_id_type vote_for
Voting ID which represents approval of this worker.
Definition: worker_object.hpp:126
graphene::chain::worker_object::vote_against
vote_id_type vote_against
Voting ID which represents disapproval of this worker.
Definition: worker_object.hpp:128
graphene::chain::vesting_balance_type::witness
@ witness
graphene::wallet::detail::wallet_api_impl::vote_for_committee_member
signed_transaction vote_for_committee_member(string voting_account, string committee_member, bool approve, bool broadcast)
Definition: wallet_voting.cpp:282
graphene
Definition: api.cpp:48
graphene::wallet::detail::wallet_api_impl::create_committee_member
signed_transaction create_committee_member(string owner_account, string url, bool broadcast)
Definition: wallet_voting.cpp:106
graphene::wallet::detail::wallet_api_impl::get_global_properties
global_property_object get_global_properties() const
Definition: wallet_api_impl.cpp:183
graphene::wallet::worker_vote_delta::vote_abstain
flat_set< worker_id_type > vote_abstain
Definition: wallet_structs.hpp:226
fc::safe
Definition: safe.hpp:26
graphene::chain::committee_member_object
tracks information about a committee_member account.
Definition: committee_member_object.hpp:43