Electroneum
Classes | Typedefs | Functions
etneg Namespace Reference

Classes

class  MicroCore
 
struct  outputs_visitor
 

Typedefs

using json = nlohmann::json
 

Functions

bool init_blockchain (const string &path, MicroCore *&mcore, Blockchain *&core_storage, bool testnet)
 
template<typename T >
bool parse_str_secret_key (const string &key_str, T &secret_key)
 
template bool parse_str_secret_key< crypto::secret_key > (const string &key_str, crypto::secret_key &secret_key)
 
template bool parse_str_secret_key< crypto::public_key > (const string &key_str, crypto::public_key &secret_key)
 
template bool parse_str_secret_key< crypto::hash > (const string &key_str, crypto::hash &secret_key)
 
bool get_tx_pub_key_from_str_hash (Blockchain &core_storage, const string &hash_str, transaction &tx)
 
bool parse_str_address (const string &address_str, account_public_address &address, bool testnet)
 
string print_address (const account_public_address &address, bool testnet)
 
string print_sig (const signature &sig)
 
bool is_separator (char c)
 
string remove_trailing_path_separator (const string &in_path)
 
bf::path remove_trailing_path_separator (const bf::path &in_path)
 
string timestamp_to_str_gm (time_t timestamp, const char *format)
 
ostream & operator<< (ostream &os, const account_public_address &addr)
 
bool generate_key_image (const crypto::key_derivation &derivation, const std::size_t i, const crypto::secret_key &sec_key, const crypto::public_key &pub_key, crypto::key_image &key_img)
 
string get_default_lmdb_folder (bool testnet)
 
bool get_blockchain_path (const boost::optional< string > &bc_path, bf::path &blockchain_path, bool testnet)
 
uint64_t sum_money_in_outputs (const transaction &tx)
 
pair< uint64_t, uint64_t > sum_money_in_outputs (const string &json_str)
 
pair< uint64_t, uint64_t > sum_money_in_outputs (const json &_json)
 
array< uint64_t, 4 > summary_of_in_out_rct (const transaction &tx, vector< pair< txout_to_key, uint64_t >> &output_pub_keys, vector< txin_to_key > &input_key_imgs)
 
array< uint64_t, 6 > summary_of_in_out_rct (const json &_json)
 
uint64_t sum_money_in_inputs (const transaction &tx)
 
pair< uint64_t, uint64_t > sum_money_in_inputs (const string &json_str)
 
pair< uint64_t, uint64_t > sum_money_in_inputs (const json &_json)
 
uint64_t count_nonrct_inputs (const transaction &tx)
 
uint64_t count_nonrct_inputs (const string &json_str)
 
uint64_t count_nonrct_inputs (const json &_json)
 
array< uint64_t, 2 > sum_money_in_tx (const transaction &tx)
 
array< uint64_t, 2 > sum_money_in_txs (const vector< transaction > &txs)
 
uint64_t sum_fees_in_txs (const vector< transaction > &txs)
 
vector< pair< txout_to_key, uint64_t > > get_ouputs (const transaction &tx)
 
vector< tuple< txout_to_key, uint64_t, uint64_t > > get_ouputs_tuple (const transaction &tx)
 
uint64_t get_mixin_no (const transaction &tx)
 
vector< uint64_t > get_mixin_no (const string &json_str)
 
vector< uint64_t > get_mixin_no (const json &_json)
 
vector< uint64_t > get_mixin_no_in_txs (const vector< transaction > &txs)
 
vector< txin_to_keyget_key_images (const transaction &tx)
 
bool get_payment_id (const vector< uint8_t > &extra, crypto::hash &payment_id, crypto::hash8 &payment_id8)
 
bool get_payment_id (const transaction &tx, crypto::hash &payment_id, crypto::hash8 &payment_id8)
 
array< size_t, 5 > timestamp_difference (uint64_t t1, uint64_t t2)
 
string read (string filename)
 
pair< string, double > timestamps_time_scale (const vector< uint64_t > &timestamps, uint64_t timeN, uint64_t resolution, uint64_t time0)
 
bool decode_ringct (const rct::rctSig &rv, const crypto::public_key pub, const crypto::secret_key &sec, unsigned int i, rct::key &mask, uint64_t &amount)
 
bool url_decode (const std::string &in, std::string &out)
 
map< std::string, std::string > parse_crow_post_data (const string &req_body)
 
string decrypt (const std::string &ciphertext, const crypto::secret_key &skey, bool authenticated)
 
public_key get_tx_pub_key_from_received_outs (const transaction &tx)
 
bool is_output_ours (const size_t &output_index, const transaction &tx, const public_key &pub_tx_key, const secret_key &private_view_key, const public_key &public_spend_key)
 
bool get_real_output_for_key_image (const key_image &ki, const transaction &tx, const secret_key &private_view_key, const public_key &public_spend_key, uint64_t output_idx, public_key output_pub_key)
 
bool make_tx_from_json (const string &json_str, transaction &tx)
 
string make_printable (const string &in_s)
 
string get_human_readable_timestamp (uint64_t ts)
 
void pause_execution (uint64_t no_seconds, const string &text)
 
double get_xmr (uint64_t core_amount)
 
template<typename Iterator , typename Func >
void chunks (Iterator begin, Iterator end, iterator_traits< string::iterator >::difference_type k, Func f)
 
template<typename It >
std::iterator_traits< It >::value_type calc_median (It it_begin, It it_end)
 

Detailed Description

Some helper functions used in the example. Names are rather self-explanatory, so I think there is no reason for any detailed explanations here

Typedef Documentation

◆ json

using etneg::json = typedef nlohmann::json

Function Documentation

◆ calc_median()

template<typename It >
std::iterator_traits<It>::value_type etneg::calc_median ( It  it_begin,
It  it_end 
)

◆ chunks()

template<typename Iterator , typename Func >
void etneg::chunks ( Iterator  begin,
Iterator  end,
iterator_traits< string::iterator >::difference_type  k,
Func  f 
)

◆ count_nonrct_inputs() [1/3]

uint64_t etneg::count_nonrct_inputs ( const transaction tx)

◆ count_nonrct_inputs() [2/3]

uint64_t etneg::count_nonrct_inputs ( const string &  json_str)

◆ count_nonrct_inputs() [3/3]

uint64_t etneg::count_nonrct_inputs ( const json _json)

◆ decode_ringct()

bool etneg::decode_ringct ( const rct::rctSig rv,
const crypto::public_key  pub,
const crypto::secret_key sec,
unsigned int  i,
rct::key mask,
uint64_t &  amount 
)

◆ decrypt()

string etneg::decrypt ( const std::string &  ciphertext,
const crypto::secret_key skey,
bool  authenticated 
)

◆ generate_key_image()

bool etneg::generate_key_image ( const crypto::key_derivation derivation,
const std::size_t  i,
const crypto::secret_key sec_key,
const crypto::public_key pub_key,
crypto::key_image key_img 
)

◆ get_blockchain_path()

bool etneg::get_blockchain_path ( const boost::optional< string > &  bc_path,
bf::path &  blockchain_path,
bool  testnet 
)

◆ get_default_lmdb_folder()

string etneg::get_default_lmdb_folder ( bool  testnet)

◆ get_human_readable_timestamp()

string etneg::get_human_readable_timestamp ( uint64_t  ts)

◆ get_key_images()

vector< txin_to_key > etneg::get_key_images ( const transaction tx)

◆ get_mixin_no() [1/3]

uint64_t etneg::get_mixin_no ( const transaction tx)

◆ get_mixin_no() [2/3]

vector< uint64_t > etneg::get_mixin_no ( const string &  json_str)

◆ get_mixin_no() [3/3]

vector< uint64_t > etneg::get_mixin_no ( const json _json)

◆ get_mixin_no_in_txs()

vector< uint64_t > etneg::get_mixin_no_in_txs ( const vector< transaction > &  txs)

◆ get_ouputs()

vector< pair< txout_to_key, uint64_t > > etneg::get_ouputs ( const transaction tx)

◆ get_ouputs_tuple()

vector< tuple< txout_to_key, uint64_t, uint64_t > > etneg::get_ouputs_tuple ( const transaction tx)

◆ get_payment_id() [1/2]

bool etneg::get_payment_id ( const vector< uint8_t > &  extra,
crypto::hash payment_id,
crypto::hash8 payment_id8 
)

◆ get_payment_id() [2/2]

bool etneg::get_payment_id ( const transaction tx,
crypto::hash payment_id,
crypto::hash8 payment_id8 
)

◆ get_real_output_for_key_image()

bool etneg::get_real_output_for_key_image ( const key_image &  ki,
const transaction tx,
const secret_key &  private_view_key,
const public_key &  public_spend_key,
uint64_t  output_idx,
public_key  output_pub_key 
)

◆ get_tx_pub_key_from_received_outs()

public_key etneg::get_tx_pub_key_from_received_outs ( const transaction tx)

◆ get_tx_pub_key_from_str_hash()

bool etneg::get_tx_pub_key_from_str_hash ( Blockchain core_storage,
const string &  hash_str,
transaction tx 
)

Get transaction tx using given tx hash. Hash is represent as string here, so before we can tap into the blockchain, we need to pare it into crypto::hash object.

◆ get_xmr()

double etneg::get_xmr ( uint64_t  core_amount)
inline

◆ init_blockchain()

bool etneg::init_blockchain ( const string &  path,
MicroCore *&  mcore,
Blockchain *&  core_storage,
bool  testnet 
)

◆ is_output_ours()

bool etneg::is_output_ours ( const size_t &  output_index,
const transaction tx,
const public_key &  pub_tx_key,
const secret_key &  private_view_key,
const public_key &  public_spend_key 
)

Check if given output (specified by output_index) belongs is ours based on our private view key and public spend key

◆ is_separator()

bool etneg::is_separator ( char  c)
inline

Check if a character is a path seprator

◆ make_printable()

string etneg::make_printable ( const string &  in_s)

◆ make_tx_from_json()

bool etneg::make_tx_from_json ( const string &  json_str,
transaction tx 
)

◆ operator<<()

ostream & etneg::operator<< ( ostream &  os,
const account_public_address addr 
)

◆ parse_crow_post_data()

map< std::string, std::string > etneg::parse_crow_post_data ( const string &  req_body)

◆ parse_str_address()

bool etneg::parse_str_address ( const string &  address_str,
account_public_address address,
bool  testnet 
)

Parse monero address in a string form into cryptonote::account_public_address object

◆ parse_str_secret_key()

template<typename T >
bool etneg::parse_str_secret_key ( const string &  key_str,
T secret_key 
)

Parse key string, e.g., a viewkey in a string into crypto::secret_key or crypto::public_key depending on the template argument.

◆ parse_str_secret_key< crypto::hash >()

template bool etneg::parse_str_secret_key< crypto::hash > ( const string &  key_str,
crypto::hash secret_key 
)

◆ parse_str_secret_key< crypto::public_key >()

template bool etneg::parse_str_secret_key< crypto::public_key > ( const string &  key_str,
crypto::public_key secret_key 
)

◆ parse_str_secret_key< crypto::secret_key >()

template bool etneg::parse_str_secret_key< crypto::secret_key > ( const string &  key_str,
crypto::secret_key secret_key 
)

◆ pause_execution()

void etneg::pause_execution ( uint64_t  no_seconds,
const string &  text 
)

◆ print_address()

string etneg::print_address ( const account_public_address address,
bool  testnet 
)

Return string representation of monero address

◆ print_sig()

string etneg::print_sig ( const signature &  sig)

◆ read()

string etneg::read ( string  filename)

◆ remove_trailing_path_separator() [1/2]

string etneg::remove_trailing_path_separator ( const string &  in_path)

Remove trailinig path separator.

◆ remove_trailing_path_separator() [2/2]

bf::path etneg::remove_trailing_path_separator ( const bf::path &  in_path)

◆ sum_fees_in_txs()

uint64_t etneg::sum_fees_in_txs ( const vector< transaction > &  txs)

◆ sum_money_in_inputs() [1/3]

uint64_t etneg::sum_money_in_inputs ( const transaction tx)

◆ sum_money_in_inputs() [2/3]

pair< uint64_t, uint64_t > etneg::sum_money_in_inputs ( const string &  json_str)

◆ sum_money_in_inputs() [3/3]

pair< uint64_t, uint64_t > etneg::sum_money_in_inputs ( const json _json)

◆ sum_money_in_outputs() [1/3]

uint64_t etneg::sum_money_in_outputs ( const transaction tx)

◆ sum_money_in_outputs() [2/3]

pair< uint64_t, uint64_t > etneg::sum_money_in_outputs ( const string &  json_str)

◆ sum_money_in_outputs() [3/3]

pair< uint64_t, uint64_t > etneg::sum_money_in_outputs ( const json _json)

◆ sum_money_in_tx()

array< uint64_t, 2 > etneg::sum_money_in_tx ( const transaction tx)

◆ sum_money_in_txs()

array< uint64_t, 2 > etneg::sum_money_in_txs ( const vector< transaction > &  txs)

◆ summary_of_in_out_rct() [1/2]

array< uint64_t, 4 > etneg::summary_of_in_out_rct ( const transaction tx,
vector< pair< txout_to_key, uint64_t >> &  output_pub_keys,
vector< txin_to_key > &  input_key_imgs 
)

◆ summary_of_in_out_rct() [2/2]

array< uint64_t, 6 > etneg::summary_of_in_out_rct ( const json _json)

◆ timestamp_difference()

array< size_t, 5 > etneg::timestamp_difference ( uint64_t  t1,
uint64_t  t2 
)

◆ timestamp_to_str_gm()

string etneg::timestamp_to_str_gm ( time_t  timestamp,
const char *  format 
)

◆ timestamps_time_scale()

pair< string, double > etneg::timestamps_time_scale ( const vector< uint64_t > &  timestamps,
uint64_t  timeN,
uint64_t  resolution,
uint64_t  time0 
)

◆ url_decode()

bool etneg::url_decode ( const std::string &  in,
std::string &  out 
)