Electroneum
Toggle main menu visibility
Loading...
Searching...
No Matches
cryptonote_basic_impl.h
Go to the documentation of this file.
1
// Copyrights(c) 2017-2021, The Electroneum Project
2
// Copyrights(c) 2014-2019, The Monero Project
3
//
4
// All rights reserved.
5
//
6
// Redistribution and use in source and binary forms, with or without modification, are
7
// permitted provided that the following conditions are met:
8
//
9
// 1. Redistributions of source code must retain the above copyright notice, this list of
10
// conditions and the following disclaimer.
11
//
12
// 2. Redistributions in binary form must reproduce the above copyright notice, this list
13
// of conditions and the following disclaimer in the documentation and/or other
14
// materials provided with the distribution.
15
//
16
// 3. Neither the name of the copyright holder nor the names of its contributors may be
17
// used to endorse or promote products derived from this software without specific
18
// prior written permission.
19
//
20
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
21
// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
23
// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
27
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
28
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29
//
30
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
31
32
#pragma once
33
34
#include "
cryptonote_basic.h
"
35
#include "
crypto/crypto.h
"
36
#include "
crypto/hash.h
"
37
38
39
namespace
cryptonote
{
40
/************************************************************************/
41
/* */
42
/************************************************************************/
43
template
<
class
t_array>
44
struct
array_hasher
: std::unary_function<t_array&, std::size_t>
45
{
46
std::size_t
operator()
(
const
t_array& val)
const
47
{
48
return
boost::hash_range(&val.data[0], &val.data[
sizeof
(val.data)]);
49
}
50
};
51
52
53
#pragma pack(push, 1)
54
struct
public_address_outer_blob
55
{
56
uint8_t
m_ver
;
57
account_public_address
m_address
;
58
uint8_t
check_sum
;
59
};
60
struct
public_integrated_address_outer_blob
61
{
62
uint8_t
m_ver
;
63
account_public_address
m_address
;
64
crypto::hash8
payment_id
;
65
uint8_t
check_sum
;
66
};
67
#pragma pack (pop)
68
69
namespace
70
{
71
inline
std::string return_first_address(
const
std::string &url,
const
std::vector<std::string> &addresses,
bool
dnssec_valid)
72
{
73
if
(addresses.empty())
74
return
{};
75
return
addresses[0];
76
}
77
}
78
79
struct
address_parse_info
80
{
81
account_public_address
address
;
82
bool
is_subaddress
;
83
bool
has_payment_id
;
84
crypto::hash8
payment_id
;
85
};
86
87
/************************************************************************/
88
/* Cryptonote helper functions */
89
/************************************************************************/
90
size_t
get_min_block_weight
(
uint8_t
version
);
91
size_t
get_max_tx_size
();
92
bool
get_block_reward
(
size_t
median_weight,
size_t
current_block_weight,
uint64_t
already_generated_coins,
uint64_t
&reward,
uint8_t
version
,
uint64_t
current_block_height,
network_type
nettype =
MAINNET
);
93
uint8_t
get_account_address_checksum
(
const
public_address_outer_blob
& bl);
94
uint8_t
get_account_integrated_address_checksum
(
const
public_integrated_address_outer_blob
& bl);
95
96
std::string
get_account_address_as_str
(
97
network_type
nettype
98
,
bool
subaddress
99
,
const
account_public_address
& adr
100
);
101
102
std::string
get_account_integrated_address_as_str
(
103
network_type
nettype
104
,
const
account_public_address
& adr
105
,
const
crypto::hash8
& payment_id
106
);
107
108
bool
get_account_address_from_str
(
109
address_parse_info
&
info
110
,
network_type
nettype
111
,
const
std::string& str
112
);
113
114
bool
get_account_address_from_str_or_url
(
115
address_parse_info
&
info
116
,
network_type
nettype
117
,
const
std::string& str_or_url
118
, std::function<std::string(
const
std::string&,
const
std::vector<std::string>&,
bool
)> dns_confirm = return_first_address
119
);
120
121
bool
is_coinbase
(
const
transaction
& tx);
122
123
bool
operator ==
(
const
cryptonote::transaction
&
a
,
const
cryptonote::transaction
& b);
124
bool
operator ==
(
const
cryptonote::block
&
a
,
const
cryptonote::block
& b);
125
}
126
127
bool
parse_hash256
(
const
std::string &str_hash,
crypto::hash
& hash);
128
version
uint8_t version
Definition
blockchain.cpp:90
cryptonote::transaction
Definition
cryptonote_basic.h:298
crypto.h
cryptonote_basic.h
parse_hash256
bool parse_hash256(const std::string &str_hash, crypto::hash &hash)
Definition
cryptonote_basic_impl.cpp:373
crypto::hash8
POD_CLASS hash8
Definition
hash.h:53
crypto::hash
POD_CLASS hash
Definition
hash.h:50
cryptonote
Holds cryptonote related classes and helpers.
Definition
ban.cpp:40
cryptonote::network_type
network_type
Definition
cryptonote_config.h:247
cryptonote::MAINNET
@ MAINNET
Definition
cryptonote_config.h:248
cryptonote::get_block_reward
bool get_block_reward(size_t median_weight, size_t current_block_weight, uint64_t already_generated_coins, uint64_t &reward, uint8_t version, uint64_t current_block_height, network_type nettype)
Definition
cryptonote_basic_impl.cpp:91
cryptonote::operator==
bool operator==(const cryptonote::transaction &a, const cryptonote::transaction &b)
Definition
cryptonote_basic_impl.cpp:363
cryptonote::get_account_address_from_str
bool get_account_address_from_str(address_parse_info &info, network_type nettype, std::string const &str)
Definition
cryptonote_basic_impl.cpp:243
cryptonote::get_account_address_checksum
uint8_t get_account_address_checksum(const public_address_outer_blob &bl)
Definition
cryptonote_basic_impl.cpp:187
cryptonote::get_account_address_as_str
std::string get_account_address_as_str(network_type nettype, bool subaddress, account_public_address const &adr)
Definition
cryptonote_basic_impl.cpp:207
cryptonote::get_min_block_weight
size_t get_min_block_weight(uint8_t version)
Definition
cryptonote_basic_impl.cpp:73
cryptonote::is_coinbase
bool is_coinbase(const transaction &tx)
Definition
cryptonote_basic_impl.cpp:232
cryptonote::get_max_tx_size
size_t get_max_tx_size()
Definition
cryptonote_basic_impl.cpp:86
cryptonote::get_account_integrated_address_checksum
uint8_t get_account_integrated_address_checksum(const public_integrated_address_outer_blob &bl)
Definition
cryptonote_basic_impl.cpp:197
cryptonote::get_account_address_from_str_or_url
bool get_account_address_from_str_or_url(address_parse_info &info, network_type nettype, const std::string &str_or_url, std::function< std::string(const std::string &, const std::vector< std::string > &, bool)> dns_confirm)
Definition
cryptonote_basic_impl.cpp:348
cryptonote::get_account_integrated_address_as_str
std::string get_account_integrated_address_as_str(network_type nettype, account_public_address const &adr, crypto::hash8 const &payment_id)
Definition
cryptonote_basic_impl.cpp:218
a
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition
pointer.h:1124
hash.h
info
CXA_THROW_INFO_T * info
Definition
stack_trace.cpp:91
uint8_t
unsigned char uint8_t
Definition
stdint.h:124
uint64_t
unsigned __int64 uint64_t
Definition
stdint.h:136
cryptonote::account_public_address
Definition
cryptonote_basic.h:75
cryptonote::address_parse_info
Definition
cryptonote_basic_impl.h:80
cryptonote::address_parse_info::is_subaddress
bool is_subaddress
Definition
cryptonote_basic_impl.h:82
cryptonote::address_parse_info::has_payment_id
bool has_payment_id
Definition
cryptonote_basic_impl.h:83
cryptonote::address_parse_info::address
account_public_address address
Definition
cryptonote_basic_impl.h:81
cryptonote::address_parse_info::payment_id
crypto::hash8 payment_id
Definition
cryptonote_basic_impl.h:84
cryptonote::array_hasher
Definition
cryptonote_basic_impl.h:45
cryptonote::array_hasher::operator()
std::size_t operator()(const t_array &val) const
Definition
cryptonote_basic_impl.h:46
cryptonote::block
Definition
cryptonote_basic.h:464
cryptonote::public_address_outer_blob
Definition
cryptonote_basic_impl.h:55
cryptonote::public_address_outer_blob::m_address
account_public_address m_address
Definition
cryptonote_basic_impl.h:57
cryptonote::public_address_outer_blob::check_sum
uint8_t check_sum
Definition
cryptonote_basic_impl.h:58
cryptonote::public_address_outer_blob::m_ver
uint8_t m_ver
Definition
cryptonote_basic_impl.h:56
cryptonote::public_integrated_address_outer_blob
Definition
cryptonote_basic_impl.h:61
cryptonote::public_integrated_address_outer_blob::m_ver
uint8_t m_ver
Definition
cryptonote_basic_impl.h:62
cryptonote::public_integrated_address_outer_blob::m_address
account_public_address m_address
Definition
cryptonote_basic_impl.h:63
cryptonote::public_integrated_address_outer_blob::check_sum
uint8_t check_sum
Definition
cryptonote_basic_impl.h:65
cryptonote::public_integrated_address_outer_blob::payment_id
crypto::hash8 payment_id
Definition
cryptonote_basic_impl.h:64
src
cryptonote_basic
cryptonote_basic_impl.h
Generated on
for Electroneum by
1.17.0