| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include <cstdint> |
| 34 |
#include <stdexcept> |
| 35 |
#include <string> |
| 36 |
#include <boost/uuid/uuid.hpp> |
| 37 |
|
| 38 |
#define CRYPTONOTE_DNS_TIMEOUT_MS 20000 |
| 39 |
|
| 40 |
#define CRYPTONOTE_MAX_BLOCK_NUMBER 500000000 |
| 41 |
#define CRYPTONOTE_MAX_TX_SIZE 1000000 |
| 42 |
#define CRYPTONOTE_MAX_TX_PER_BLOCK 0x10000000 |
| 43 |
#define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER 0 |
| 44 |
#define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW 60 |
| 45 |
#define CURRENT_TRANSACTION_VERSION 2 |
| 46 |
#define CURRENT_BLOCK_MAJOR_VERSION 1 |
| 47 |
#define CURRENT_BLOCK_MINOR_VERSION 0 |
| 48 |
#define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT 60*60*2 |
| 49 |
#define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE 10 |
| 50 |
|
| 51 |
#define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW 60 |
| 52 |
|
| 53 |
|
| 54 |
#define MONEY_SUPPLY ((uint64_t)(-1)) |
| 55 |
#define EMISSION_SPEED_FACTOR_PER_MINUTE (20) |
| 56 |
#define FINAL_SUBSIDY_PER_MINUTE ((uint64_t)300000000000) // 3 * pow(10, 11) |
| 57 |
|
| 58 |
#define CRYPTONOTE_REWARD_BLOCKS_WINDOW 100 |
| 59 |
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2 60000 //size of block (bytes) after which reward for block calculated using block size |
| 60 |
#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 |
| 61 |
#define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V5 300000 //size of block (bytes) after which reward for block calculated using block size - second change, from v5 |
| 62 |
#define CRYPTONOTE_LONG_TERM_BLOCK_WEIGHT_WINDOW_SIZE 100000 // size in blocks of the long term block weight median window |
| 63 |
#define CRYPTONOTE_SHORT_TERM_BLOCK_WEIGHT_SURGE_FACTOR 50 |
| 64 |
#define CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE 600 |
| 65 |
#define CRYPTONOTE_DISPLAY_DECIMAL_POINT 12 |
| 66 |
|
| 67 |
#define COIN ((uint64_t)1000000000000) // pow(10, 12) |
| 68 |
|
| 69 |
#define FEE_PER_KB_OLD ((uint64_t)10000000000) // pow(10, 10) |
| 70 |
#define FEE_PER_KB ((uint64_t)2000000000) // 2 * pow(10, 9) |
| 71 |
#define FEE_PER_BYTE ((uint64_t)300000) |
| 72 |
#define DYNAMIC_FEE_PER_KB_BASE_FEE ((uint64_t)2000000000) // 2 * pow(10,9) |
| 73 |
#define DYNAMIC_FEE_PER_KB_BASE_BLOCK_REWARD ((uint64_t)10000000000000) // 10 * pow(10,12) |
| 74 |
#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) |
| 75 |
#define DYNAMIC_FEE_REFERENCE_TRANSACTION_WEIGHT ((uint64_t)3000) |
| 76 |
|
| 77 |
#define ORPHANED_BLOCKS_MAX_COUNT 100 |
| 78 |
|
| 79 |
|
| 80 |
#define DIFFICULTY_TARGET_V2 120 // seconds |
| 81 |
#define DIFFICULTY_TARGET_V1 60 // seconds - before first fork |
| 82 |
#define DIFFICULTY_WINDOW 720 // blocks |
| 83 |
#define DIFFICULTY_LAG 15 // !!! |
| 84 |
#define DIFFICULTY_CUT 60 // timestamps to cut after sorting |
| 85 |
#define DIFFICULTY_BLOCKS_COUNT DIFFICULTY_WINDOW + DIFFICULTY_LAG |
| 86 |
|
| 87 |
|
| 88 |
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1 DIFFICULTY_TARGET_V1 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS |
| 89 |
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2 DIFFICULTY_TARGET_V2 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS |
| 90 |
#define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS 1 |
| 91 |
|
| 92 |
|
| 93 |
#define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN DIFFICULTY_TARGET_V1 //just alias; used by tests |
| 94 |
|
| 95 |
|
| 96 |
#define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT 10000 //by default, blocks ids count in synchronizing |
| 97 |
#define BLOCKS_IDS_SYNCHRONIZING_MAX_COUNT 25000 //max blocks ids count in synchronizing |
| 98 |
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4 100 //by default, blocks count in blocks downloading |
| 99 |
#define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT 20 //by default, blocks count in blocks downloading |
| 100 |
#define BLOCKS_SYNCHRONIZING_MAX_COUNT 2048 //must be a power of 2, greater than 128, equal to SEEDHASH_EPOCH_BLOCKS |
| 101 |
|
| 102 |
#define CRYPTONOTE_MEMPOOL_TX_LIVETIME (86400*3) //seconds, three days |
| 103 |
#define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME 604800 //seconds, one week |
| 104 |
|
| 105 |
|
| 106 |
#define CRYPTONOTE_DANDELIONPP_STEMS 2 // number of outgoing stem connections per epoch |
| 107 |
#define CRYPTONOTE_DANDELIONPP_FLUFF_PROBABILITY 20 // out of 100 |
| 108 |
#define CRYPTONOTE_DANDELIONPP_MIN_EPOCH 10 // minutes |
| 109 |
#define CRYPTONOTE_DANDELIONPP_EPOCH_RANGE 30 // seconds |
| 110 |
#define CRYPTONOTE_DANDELIONPP_FLUSH_AVERAGE 5 // seconds average for poisson distributed fluff flush |
| 111 |
#define CRYPTONOTE_DANDELIONPP_EMBARGO_AVERAGE 39 // seconds (see tx_pool.cpp for more info) |
| 112 |
|
| 113 |
|
| 114 |
#define CRYPTONOTE_NOISE_MIN_EPOCH 5 // minutes |
| 115 |
#define CRYPTONOTE_NOISE_EPOCH_RANGE 30 // seconds |
| 116 |
#define CRYPTONOTE_NOISE_MIN_DELAY 10 // seconds |
| 117 |
#define CRYPTONOTE_NOISE_DELAY_RANGE 5 // seconds |
| 118 |
#define CRYPTONOTE_NOISE_BYTES 3*1024 // 3 KiB |
| 119 |
#define CRYPTONOTE_NOISE_CHANNELS 2 // Max outgoing connections per zone used for noise/covert sending |
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
#define CRYPTONOTE_FORWARD_DELAY_BASE (CRYPTONOTE_NOISE_MIN_DELAY + CRYPTONOTE_NOISE_DELAY_RANGE) |
| 124 |
#define CRYPTONOTE_FORWARD_DELAY_AVERAGE (CRYPTONOTE_FORWARD_DELAY_BASE + (CRYPTONOTE_FORWARD_DELAY_BASE / 2)) |
| 125 |
|
| 126 |
#define CRYPTONOTE_MAX_FRAGMENTS 20 // ~20 * NOISE_BYTES max payload size for covert/noise send |
| 127 |
|
| 128 |
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_BLOCK_COUNT 1000 |
| 129 |
#define COMMAND_RPC_GET_BLOCKS_FAST_MAX_TX_COUNT 20000 |
| 130 |
#define DEFAULT_RPC_MAX_CONNECTIONS_PER_PUBLIC_IP 3 |
| 131 |
#define DEFAULT_RPC_MAX_CONNECTIONS_PER_PRIVATE_IP 25 |
| 132 |
#define DEFAULT_RPC_MAX_CONNECTIONS 100 |
| 133 |
#define DEFAULT_RPC_SOFT_LIMIT_SIZE 25 * 1024 * 1024 // 25 MiB |
| 134 |
#define MAX_RPC_CONTENT_LENGTH 1048576 // 1 MB |
| 135 |
|
| 136 |
#define P2P_LOCAL_WHITE_PEERLIST_LIMIT 1000 |
| 137 |
#define P2P_LOCAL_GRAY_PEERLIST_LIMIT 5000 |
| 138 |
|
| 139 |
#define P2P_DEFAULT_CONNECTIONS_COUNT 12 |
| 140 |
#define P2P_DEFAULT_HANDSHAKE_INTERVAL 60 //secondes |
| 141 |
#define P2P_DEFAULT_PACKET_MAX_SIZE 50000000 //50000000 bytes maximum packet size |
| 142 |
#define P2P_DEFAULT_PEERS_IN_HANDSHAKE 250 |
| 143 |
#define P2P_MAX_PEERS_IN_HANDSHAKE 250 |
| 144 |
#define P2P_DEFAULT_CONNECTION_TIMEOUT 5000 //5 seconds |
| 145 |
#define P2P_DEFAULT_SOCKS_CONNECT_TIMEOUT 45 // seconds |
| 146 |
#define P2P_DEFAULT_PING_CONNECTION_TIMEOUT 2000 //2 seconds |
| 147 |
#define P2P_DEFAULT_INVOKE_TIMEOUT 60*2*1000 //2 minutes |
| 148 |
#define P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT 5000 //5 seconds |
| 149 |
#define P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT 70 |
| 150 |
#define P2P_DEFAULT_ANCHOR_CONNECTIONS_COUNT 2 |
| 151 |
#define P2P_DEFAULT_SYNC_SEARCH_CONNECTIONS_COUNT 2 |
| 152 |
#define P2P_DEFAULT_LIMIT_RATE_UP 8192 // kB/s |
| 153 |
#define P2P_DEFAULT_LIMIT_RATE_DOWN 32768 // kB/s |
| 154 |
|
| 155 |
#define P2P_FAILED_ADDR_FORGET_SECONDS (60*60) //1 hour |
| 156 |
#define P2P_IP_BLOCKTIME (60*60*24) //24 hour |
| 157 |
#define P2P_IP_FAILS_BEFORE_BLOCK 10 |
| 158 |
#define P2P_IDLE_CONNECTION_KILL_INTERVAL (5*60) //5 minutes |
| 159 |
|
| 160 |
#define P2P_SUPPORT_FLAG_FLUFFY_BLOCKS 0x01 |
| 161 |
#define P2P_SUPPORT_FLAGS P2P_SUPPORT_FLAG_FLUFFY_BLOCKS |
| 162 |
|
| 163 |
#define RPC_IP_FAILS_BEFORE_BLOCK 3 |
| 164 |
|
| 165 |
#define CRYPTONOTE_NAME "bitmonero" |
| 166 |
#define CRYPTONOTE_BLOCKCHAINDATA_FILENAME "data.mdb" |
| 167 |
#define CRYPTONOTE_BLOCKCHAINDATA_LOCK_FILENAME "lock.mdb" |
| 168 |
#define P2P_NET_DATA_FILENAME "p2pstate.bin" |
| 169 |
#define RPC_PAYMENTS_DATA_FILENAME "rpcpayments.bin" |
| 170 |
#define MINER_CONFIG_FILE_NAME "miner_conf.json" |
| 171 |
|
| 172 |
#define THREAD_STACK_SIZE 5 * 1024 * 1024 |
| 173 |
|
| 174 |
#define HF_VERSION_DYNAMIC_FEE 4 |
| 175 |
#define HF_VERSION_MIN_MIXIN_4 6 |
| 176 |
#define HF_VERSION_MIN_MIXIN_6 7 |
| 177 |
#define HF_VERSION_MIN_MIXIN_10 8 |
| 178 |
#define HF_VERSION_MIN_MIXIN_15 15 |
| 179 |
#define HF_VERSION_ENFORCE_RCT 6 |
| 180 |
#define HF_VERSION_PER_BYTE_FEE 8 |
| 181 |
#define HF_VERSION_SMALLER_BP 10 |
| 182 |
#define HF_VERSION_LONG_TERM_BLOCK_WEIGHT 10 |
| 183 |
#define HF_VERSION_MIN_2_OUTPUTS 12 |
| 184 |
#define HF_VERSION_MIN_V2_COINBASE_TX 12 |
| 185 |
#define HF_VERSION_SAME_MIXIN 12 |
| 186 |
#define HF_VERSION_REJECT_SIGS_IN_COINBASE 12 |
| 187 |
#define HF_VERSION_ENFORCE_MIN_AGE 12 |
| 188 |
#define HF_VERSION_EFFECTIVE_SHORT_TERM_MEDIAN_IN_PENALTY 12 |
| 189 |
#define HF_VERSION_EXACT_COINBASE 13 |
| 190 |
#define HF_VERSION_CLSAG 13 |
| 191 |
#define HF_VERSION_DETERMINISTIC_UNLOCK_TIME 13 |
| 192 |
#define HF_VERSION_BULLETPROOF_PLUS 15 |
| 193 |
#define HF_VERSION_VIEW_TAGS 15 |
| 194 |
#define HF_VERSION_2021_SCALING 15 |
| 195 |
|
| 196 |
#define PER_KB_FEE_QUANTIZATION_DECIMALS 8 |
| 197 |
#define CRYPTONOTE_SCALING_2021_FEE_ROUNDING_PLACES 2 |
| 198 |
|
| 199 |
#define HASH_OF_HASHES_STEP 512 |
| 200 |
|
| 201 |
#define DEFAULT_TXPOOL_MAX_WEIGHT 648000000ull // 3 days at 300000, in bytes |
| 202 |
|
| 203 |
#define BULLETPROOF_MAX_OUTPUTS 16 |
| 204 |
#define BULLETPROOF_PLUS_MAX_OUTPUTS 16 |
| 205 |
|
| 206 |
#define CRYPTONOTE_PRUNING_STRIPE_SIZE 4096 // the smaller, the smoother the increase |
| 207 |
#define CRYPTONOTE_PRUNING_LOG_STRIPES 3 // the higher, the more space saved |
| 208 |
#define CRYPTONOTE_PRUNING_TIP_BLOCKS 5500 // the smaller, the more space saved |
| 209 |
|
| 210 |
#define RPC_CREDITS_PER_HASH_SCALE ((float)(1<<24)) |
| 211 |
|
| 212 |
#define DNS_BLOCKLIST_LIFETIME (86400 * 8) |
| 213 |
|
| 214 |
|
| 215 |
|
| 216 |
|
| 217 |
#define MAX_TX_EXTRA_SIZE 1060 |
| 218 |
|
| 219 |
|
| 220 |
namespace config |
| 221 |
{ |
| 222 |
uint64_t const DEFAULT_FEE_ATOMIC_XMR_PER_KB = 500; |
| 223 |
uint8_t const FEE_CALCULATION_MAX_RETRIES = 10; |
| 224 |
uint64_t const DEFAULT_DUST_THRESHOLD = ((uint64_t)2000000000); |
| 225 |
uint64_t const BASE_REWARD_CLAMP_THRESHOLD = ((uint64_t)100000000); |
| 226 |
|
| 227 |
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18; |
| 228 |
uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 19; |
| 229 |
uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 42; |
| 230 |
uint16_t const P2P_DEFAULT_PORT = 18080; |
| 231 |
uint16_t const RPC_DEFAULT_PORT = 18081; |
| 232 |
uint16_t const ZMQ_RPC_DEFAULT_PORT = 18082; |
| 233 |
boost::uuids::uuid const NETWORK_ID = { { |
| 234 |
0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x10 |
| 235 |
} }; |
| 236 |
std::string const GENESIS_TX = "013c01ff0001ffffffffffff03029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121017767aafcde9be00dcfd098715ebcf7f410daebc582fda69d24a28e9d0bc890d1"; |
| 237 |
uint32_t const GENESIS_NONCE = 10000; |
| 238 |
|
| 239 |
|
| 240 |
const char HASH_KEY_BULLETPROOF_EXPONENT[] = "bulletproof"; |
| 241 |
const char HASH_KEY_BULLETPROOF_PLUS_EXPONENT[] = "bulletproof_plus"; |
| 242 |
const char HASH_KEY_BULLETPROOF_PLUS_TRANSCRIPT[] = "bulletproof_plus_transcript"; |
| 243 |
const char HASH_KEY_RINGDB[] = "ringdsb"; |
| 244 |
const char HASH_KEY_SUBADDRESS[] = "SubAddr"; |
| 245 |
const unsigned char HASH_KEY_ENCRYPTED_PAYMENT_ID = 0x8d; |
| 246 |
const unsigned char HASH_KEY_WALLET = 0x8c; |
| 247 |
const unsigned char HASH_KEY_WALLET_CACHE = 0x8d; |
| 248 |
const unsigned char HASH_KEY_BACKGROUND_CACHE = 0x8e; |
| 249 |
const unsigned char HASH_KEY_BACKGROUND_KEYS_FILE = 0x8f; |
| 250 |
const unsigned char HASH_KEY_RPC_PAYMENT_NONCE = 0x58; |
| 251 |
const unsigned char HASH_KEY_MEMORY = 'k'; |
| 252 |
const unsigned char HASH_KEY_MULTISIG[] = {'M', 'u', 'l', 't' , 'i', 's', 'i', 'g', 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; |
| 253 |
const unsigned char HASH_KEY_MULTISIG_KEY_AGGREGATION[] = "Multisig_key_agg"; |
| 254 |
const unsigned char HASH_KEY_CLSAG_ROUND_MULTISIG[] = "CLSAG_round_ms_merge_factor"; |
| 255 |
const unsigned char HASH_KEY_TXPROOF_V2[] = "TXPROOF_V2"; |
| 256 |
const unsigned char HASH_KEY_CLSAG_ROUND[] = "CLSAG_round"; |
| 257 |
const unsigned char HASH_KEY_CLSAG_AGG_0[] = "CLSAG_agg_0"; |
| 258 |
const unsigned char HASH_KEY_CLSAG_AGG_1[] = "CLSAG_agg_1"; |
| 259 |
const char HASH_KEY_MESSAGE_SIGNING[] = "MoneroMessageSignature"; |
| 260 |
const unsigned char HASH_KEY_MM_SLOT = 'm'; |
| 261 |
const constexpr char HASH_KEY_MULTISIG_TX_PRIVKEYS_SEED[] = "multisig_tx_privkeys_seed"; |
| 262 |
const constexpr char HASH_KEY_MULTISIG_TX_PRIVKEYS[] = "multisig_tx_privkeys"; |
| 263 |
const constexpr char HASH_KEY_TXHASH_AND_MIXRING[] = "txhash_and_mixring"; |
| 264 |
|
| 265 |
|
| 266 |
const uint32_t MULTISIG_MAX_SIGNERS{16}; |
| 267 |
|
| 268 |
namespace testnet |
| 269 |
{ |
| 270 |
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 53; |
| 271 |
uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 54; |
| 272 |
uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 63; |
| 273 |
uint16_t const P2P_DEFAULT_PORT = 28080; |
| 274 |
uint16_t const RPC_DEFAULT_PORT = 28081; |
| 275 |
uint16_t const ZMQ_RPC_DEFAULT_PORT = 28082; |
| 276 |
boost::uuids::uuid const NETWORK_ID = { { |
| 277 |
0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x11 |
| 278 |
} }; |
| 279 |
std::string const GENESIS_TX = "013c01ff0001ffffffffffff03029b2e4c0281c0b02e7c53291a94d1d0cbff8883f8024f5142ee494ffbbd08807121017767aafcde9be00dcfd098715ebcf7f410daebc582fda69d24a28e9d0bc890d1"; |
| 280 |
uint32_t const GENESIS_NONCE = 10001; |
| 281 |
} |
| 282 |
|
| 283 |
namespace stagenet |
| 284 |
{ |
| 285 |
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 24; |
| 286 |
uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 25; |
| 287 |
uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 36; |
| 288 |
uint16_t const P2P_DEFAULT_PORT = 38080; |
| 289 |
uint16_t const RPC_DEFAULT_PORT = 38081; |
| 290 |
uint16_t const ZMQ_RPC_DEFAULT_PORT = 38082; |
| 291 |
boost::uuids::uuid const NETWORK_ID = { { |
| 292 |
0x12 ,0x30, 0xF1, 0x71 , 0x61, 0x04 , 0x41, 0x61, 0x17, 0x31, 0x00, 0x82, 0x16, 0xA1, 0xA1, 0x12 |
| 293 |
} }; |
| 294 |
std::string const GENESIS_TX = "013c01ff0001ffffffffffff0302df5d56da0c7d643ddd1ce61901c7bdc5fb1738bfe39fbe69c28a3a7032729c0f2101168d0c4ca86fb55a4cf6a36d31431be1c53a3bd7411bb24e8832410289fa6f3b"; |
| 295 |
uint32_t const GENESIS_NONCE = 10002; |
| 296 |
} |
| 297 |
} |
| 298 |
|
| 299 |
namespace cryptonote |
| 300 |
{ |
| 301 |
enum network_type : uint8_t |
| 302 |
{ |
| 303 |
MAINNET = 0, |
| 304 |
TESTNET, |
| 305 |
STAGENET, |
| 306 |
FAKECHAIN, |
| 307 |
UNDEFINED = 255 |
| 308 |
}; |
| 309 |
struct config_t |
| 310 |
{ |
| 311 |
uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX; |
| 312 |
uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX; |
| 313 |
uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX; |
| 314 |
uint16_t const P2P_DEFAULT_PORT; |
| 315 |
uint16_t const RPC_DEFAULT_PORT; |
| 316 |
uint16_t const ZMQ_RPC_DEFAULT_PORT; |
| 317 |
boost::uuids::uuid const NETWORK_ID; |
| 318 |
std::string const GENESIS_TX; |
| 319 |
uint32_t const GENESIS_NONCE; |
| 320 |
}; |
| 321 |
inline const config_t& get_config(network_type nettype) |
| 322 |
{ |
| 323 |
static const config_t mainnet = { |
| 324 |
::config::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, |
| 325 |
::config::CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX, |
| 326 |
::config::CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX, |
| 327 |
::config::P2P_DEFAULT_PORT, |
| 328 |
::config::RPC_DEFAULT_PORT, |
| 329 |
::config::ZMQ_RPC_DEFAULT_PORT, |
| 330 |
::config::NETWORK_ID, |
| 331 |
::config::GENESIS_TX, |
| 332 |
::config::GENESIS_NONCE |
| 333 |
}; |
| 334 |
static const config_t testnet = { |
| 335 |
::config::testnet::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, |
| 336 |
::config::testnet::CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX, |
| 337 |
::config::testnet::CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX, |
| 338 |
::config::testnet::P2P_DEFAULT_PORT, |
| 339 |
::config::testnet::RPC_DEFAULT_PORT, |
| 340 |
::config::testnet::ZMQ_RPC_DEFAULT_PORT, |
| 341 |
::config::testnet::NETWORK_ID, |
| 342 |
::config::testnet::GENESIS_TX, |
| 343 |
::config::testnet::GENESIS_NONCE |
| 344 |
}; |
| 345 |
static const config_t stagenet = { |
| 346 |
::config::stagenet::CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX, |
| 347 |
::config::stagenet::CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX, |
| 348 |
::config::stagenet::CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX, |
| 349 |
::config::stagenet::P2P_DEFAULT_PORT, |
| 350 |
::config::stagenet::RPC_DEFAULT_PORT, |
| 351 |
::config::stagenet::ZMQ_RPC_DEFAULT_PORT, |
| 352 |
::config::stagenet::NETWORK_ID, |
| 353 |
::config::stagenet::GENESIS_TX, |
| 354 |
::config::stagenet::GENESIS_NONCE |
| 355 |
}; |
| 356 |
switch (nettype) |
| 357 |
{ |
| 358 |
case MAINNET: return mainnet; |
| 359 |
case TESTNET: return testnet; |
| 360 |
case STAGENET: return stagenet; |
| 361 |
case FAKECHAIN: return mainnet; |
| 362 |
default: throw std::runtime_error("Invalid network type"); |
| 363 |
} |
| 364 |
}; |
| 365 |
} |