Electroneum
cryptonote_config.h
Go to the documentation of this file.
1 // Copyrights(c) 2017-2019, The Electroneum Project
2 // Copyrights(c) 2014-2017, 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 <string>
35 #include <boost/uuid/uuid.hpp>
36 
37 #define CRYPTONOTE_DNS_TIMEOUT_MS 20000
38 
39 #define CRYPTONOTE_MAX_BLOCK_NUMBER 500000000
40 #define CRYPTONOTE_MAX_BLOCK_SIZE 500000000 // block header blob limit, never used!
41 #define CRYPTONOTE_GETBLOCKTEMPLATE_MAX_BLOCK_SIZE 196608 //size of block (bytes) that is the maximum that miners will produce
42 #define CRYPTONOTE_MAX_TX_SIZE 1000000000
43 #define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0
44 #define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 18
45 #define ETN_MONEY_UNLOCK_WINDOW_V8 5
46 #define CURRENT_TRANSACTION_VERSION 2
47 #define CURRENT_BLOCK_MAJOR_VERSION 1
48 #define CURRENT_BLOCK_MINOR_VERSION 0
49 #define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT 60*60*2
50 #define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 10
51 
52 #define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW 60
53 
54 // MONEY_SUPPLY - total number coins to be generated
55 #define MONEY_SUPPLY ((uint64_t)(2100000000000))
56 #define EMISSION_SPEED_FACTOR_PER_MINUTE (20)
57 #define EMISSION_SPEED_FACTOR_PER_MINUTE_V8 (22) // +=2 => Reduce emission by ~75%.
58 
59 #define FINAL_SUBSIDY_PER_MINUTE ((uint64_t)30) // 3 * pow(10, 1)
60 
61 #define CRYPTONOTE_REWARD_BLOCKS_WINDOW 100
62 #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 60000 //size of block (bytes) after which reward for block calculated using block size
63 #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V1 20000 //size of block (bytes) after which reward for block calculated using block size - before first fork
64 #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 150000 //size of block (bytes) after which reward for block calculated using block size - second change, from v5
65 #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V8 300000 //size of block (bytes) after which reward for block calculated using block size - third change, from v8
66 #define CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE 600
67 #define CRYPTONOTE_DISPLAY_DECIMAL_POINT 2
68 // COIN - number of smallest units in one coin. This definition is only used for tests.
69 #define COIN ((uint64_t)100) // pow(10, 2)
70 
71 #define FEE_PER_KB ((uint64_t)1) //Initial fee of 0.01/kb
72 #define FEE_PER_KB_V6 ((uint64_t)10) //Fee of 0.10/kb from HF V6
73 
74 #define DEFAULT_MIX 0
75 #define DEFAULT_RINGSIZE (DEFAULT_MIX + 1)
76 
77 #define HF_VERSION_DYNAMIC_FEE 10
78 #define DYNAMIC_FEE_PER_KB_BASE_FEE ((uint64_t)2000000000) // 2 * pow(10,9)
79 #define DYNAMIC_FEE_PER_KB_BASE_BLOCK_REWARD ((uint64_t)10000000000000) // 10 * pow(10,12)
80 #define DYNAMIC_FEE_PER_KB_BASE_FEE_V5 ((uint64_t)2000000000 * (uint64_t)CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 / CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5)
81 
82 #define ORPHANED_BLOCKS_MAX_COUNT 100
83 
84 #define DIFFICULTY_TARGET 60 // seconds
85 #define DIFFICULTY_TARGET_V6 120 // seconds
86 #define DIFFICULTY_WINDOW 720 // blocks
87 #define DIFFICULTY_WINDOW_V6 360 // blocks
88 #define DIFFICULTY_LAG 15 // !!!
89 #define DIFFICULTY_CUT 60 // timestamps to cut after sorting
90 #define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG
91 #define DIFFICULTY_BLOCKS_COUNT_V6 DIFFICULTY_WINDOW_V6 + DIFFICULTY_LAG
92 
93 
94 #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS 1
95 #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS DIFFICULTY_TARGET * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
96 #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V6 DIFFICULTY_TARGET_V6 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
97 
98 
99 #define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN DIFFICULTY_TARGET //just alias; used by tests
100 #define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN_V6 DIFFICULTY_TARGET_V6 //just alias; used by tests
101 
102 
103 #define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing
104 #define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4 100 //by default, blocks count in blocks downloading
105 #define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 20 //by default, blocks count in blocks downloading
106 #define CRYPTONOTE_PROTOCOL_HOP_RELAX_COUNT 3 //value of hop, after which we use only announce of new block
107 
108 #define CRYPTONOTE_MEMPOOL_TX_LIVETIME 86400 //seconds, one day
109 #define CRYPTONOTE_MEMPOOL_TX_LIVETIME_V6 (86400*3) //seconds, three days
110 #define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 //seconds, one week
111 
112 #define COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT 1000
113 
114 #define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000
115 #define P2P_LOCAL_GRAY_PEERLIST_LIMIT 5000
116 
117 #define P2P_DEFAULT_CONNECTIONS_COUNT 8
118 #define P2P_DEFAULT_HANDSHAKE_INTERVAL 60 //secondes
119 #define P2P_DEFAULT_PACKET_MAX_SIZE 50000000 //50000000 bytes maximum packet size
120 #define P2P_DEFAULT_PEERS_IN_HANDSHAKE 250
121 #define P2P_DEFAULT_CONNECTION_TIMEOUT 5000 //5 seconds
122 #define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds
123 #define P2P_DEFAULT_INVOKE_TIMEOUT 60*2*1000 //2 minutes
124 #define P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT 5000 //5 seconds
125 #define P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT 70
126 #define P2P_DEFAULT_ANCHOR_CONNECTIONS_COUNT 2
127 
128 #define P2P_FAILED_ADDR_FORGET_SECONDS (60*60) //1 hour
129 #define P2P_IP_BLOCKTIME (60*60*24) //24 hour
130 #define P2P_IP_FAILS_BEFORE_BLOCK 10
131 #define P2P_IDLE_CONNECTION_KILL_INTERVAL (5*60) //5 minutes
132 
133 #define P2P_SUPPORT_FLAG_FLUFFY_BLOCKS 0x01
134 #define P2P_SUPPORT_FLAGS P2P_SUPPORT_FLAG_FLUFFY_BLOCKS
135 
136 #define ALLOW_DEBUG_COMMANDS
137 
138 #define CRYPTONOTE_NAME "electroneum"
139 #define CRYPTONOTE_POOLDATA_FILENAME "poolstate.bin"
140 #define CRYPTONOTE_BLOCKCHAINDATA_FILENAME "data.mdb"
141 #define CRYPTONOTE_BLOCKCHAINDATA_LOCK_FILENAME "lock.mdb"
142 #define P2P_NET_DATA_FILENAME "p2pstate.bin"
143 #define MINER_CONFIG_FILE_NAME "miner_conf.json"
144 
145 #define THREAD_STACK_SIZE 5 * 1024 * 1024
146 
147 //RingCT
148 #define HF_VERSION_ENABLE_RCT 10 //Make RCT enabled from v7
149 #define HF_VERSION_ENFORCE_RCT 10 //Make RCT a requirment from v8
150 
151 #define PER_KB_FEE_QUANTIZATION_DECIMALS 8
152 
153 #define HASH_OF_HASHES_STEP 256
154 
155 // New constants are intended to go here
156 namespace config
157 {
158  uint64_t const DEFAULT_FEE_ATOMIC_XMR_PER_KB = 500; // Just a placeholder! Change me!
159  uint8_t const FEE_CALCULATION_MAX_RETRIES = 10;
160  uint64_t const DEFAULT_DUST_THRESHOLD = ((uint64_t)1);
161  uint64_t const BASE_REWARD_CLAMP_THRESHOLD = ((uint64_t)100000000); // pow(10, 8)
162  std::string const P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY = "0000000000000000000000000000000000000000000000000000000000000000";
163 
166  uint16_t const P2P_DEFAULT_PORT = 26967;
167  uint16_t const RPC_DEFAULT_PORT = 26968;
169  0x04, 0xF8, 0x23, 0xE1, 0x66, 0xC2, 0xE3, 0xA4, 0xEA, 0x5D, 0xD1, 0x2C, 0x85, 0x8E, 0xC8, 0x39
170  } };
171  std::string const GENESIS_TX = "011201ff00011e026bc5c7db8a664f652d78adb587ac4d759c6757258b64ef9cba3c0354e64fb2e42101abca6a39c561d0897be183eb0143990eba201aa7d2c652ab0555d28bb4b70728";
172  uint32_t const GENESIS_NONCE = 10000;
173 
174  namespace testnet
175  {
178  uint16_t const P2P_DEFAULT_PORT = 34567;
179  uint16_t const RPC_DEFAULT_PORT = 34568;
181  0x04, 0xF8, 0x23, 0xE1, 0x66, 0xC2, 0xE3, 0xA4, 0xEA, 0x5D, 0xD1, 0x2C, 0x85, 0x8E, 0xC8, 0x41
182  } };
183  std::string const GENESIS_TX = "011201ff000180bcf5dace2102a7957ab8394540efaa5bc93d747d6c56d8bf87b1c955574963dfbcf62ab13b5c210120d88af73976c98be9819df7e85bc21167d3194e242afd50601e398243c354b6";
184  uint32_t const GENESIS_NONCE = 10000;
185  }
186 }
uint16_t const P2P_DEFAULT_PORT
Definition: cryptonote_config.h:166
uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX
Definition: cryptonote_config.h:165
boost::uuids::uuid uuid
Definition: net_node_common.h:41
std::string const P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY
Definition: cryptonote_config.h:162
Definition: cryptonote_config.h:156
uint16_t const P2P_DEFAULT_PORT
Definition: cryptonote_config.h:178
std::string const GENESIS_TX
Definition: cryptonote_config.h:183
boost::uuids::uuid const NETWORK_ID
Definition: cryptonote_config.h:180
boost::uuids::uuid const NETWORK_ID
Definition: cryptonote_config.h:168
uint32_t const GENESIS_NONCE
Definition: cryptonote_config.h:184
std::string const GENESIS_TX
Definition: cryptonote_config.h:171
uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX
Definition: cryptonote_config.h:177
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX
Definition: cryptonote_config.h:176
uint16_t const RPC_DEFAULT_PORT
Definition: cryptonote_config.h:179
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX
Definition: cryptonote_config.h:164
uint64_t const BASE_REWARD_CLAMP_THRESHOLD
Definition: cryptonote_config.h:161
uint64_t const DEFAULT_DUST_THRESHOLD
Definition: cryptonote_config.h:160
uint32_t const GENESIS_NONCE
Definition: cryptonote_config.h:172
uint16_t const RPC_DEFAULT_PORT
Definition: cryptonote_config.h:167
uint8_t const FEE_CALCULATION_MAX_RETRIES
Definition: cryptonote_config.h:159
uint64_t const DEFAULT_FEE_ATOMIC_XMR_PER_KB
Definition: cryptonote_config.h:158