text: // Copyright (c) 2014-2018, The Monero Project
  //
  // All rights reserved.
  //
  // Redistribution and use in source and binary forms, with or without modification, are
  // permitted provided that the following conditions are met:
  //
  // 1. Redistributions of source code must retain the above copyright notice, this list of
  //    conditions and the following disclaimer.
  //
  // 2. Redistributions in binary form must reproduce the above copyright notice, this list
  //    of conditions and the following disclaimer in the documentation and/or other
  //    materials provided with the distribution.
  //
  // 3. Neither the name of the copyright holder nor the names of its contributors may be
  //    used to endorse or promote products derived from this software without specific
  //    prior written permission.
  //
  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
  // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  //
  // Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
  
  #pragma once
  
  #include <string>
  #include <boost/uuid/uuid.hpp>
  
  #define CRYPTONOTE_DNS_TIMEOUT_MS                       20000
  
  #define CRYPTONOTE_MAX_BLOCK_NUMBER                     500000000
  #define CRYPTONOTE_MAX_BLOCK_SIZE                       500000000  // block header blob limit, never used!
  #define CRYPTONOTE_GETBLOCKTEMPLATE_MAX_BLOCK_SIZE      196608 //size of block (bytes) that is the maximum that miners will produce
  #define CRYPTONOTE_MAX_TX_SIZE                          1000000000
  #define CRYPTONOTE_PUBLIC_ADDRESS_TEXTBLOB_VER          0
  #define CRYPTONOTE_MINED_MONEY_UNLOCK_WINDOW            18
  #define CURRENT_TRANSACTION_VERSION                     2
  #define CURRENT_BLOCK_MAJOR_VERSION                     1
  #define CURRENT_BLOCK_MINOR_VERSION                     0
  #define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT              60*2
  
  #define CRYPTONOTE_DEFAULT_TX_SPENDABLE_AGE             10
  
  #define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW               60
  #define BLOCKCHAIN_TIMESTAMP_CHECK_WINDOW_V12           30
  
  // Total number coins to be generated
  #define MONEY_SUPPLY_ETN                                ((uint64_t)(2100000000000)) // ETN MONEY_SUPPLY
  #define MONEY_SUPPLY                                    ((uint64_t)(21000000000000)) // after the ETNX fork
  #define TOKENS                                          ((uint64_t)(20000000000000)) // after the first 10BB ETNX Coin Burn
  #define ELECTRONERO_TOKENS                              ((uint64_t)(3610309000000000)) // after the ETNXP hard fork and ETNX burn
  
  // Number of smallest units in one coin
  #define COIN                                            ((uint64_t)100000000) // pow(10, 8)
  
  #define EMISSION_SPEED_FACTOR_PER_MINUTE                (20)
  #define FINAL_SUBSIDY_PER_MINUTE                        ((uint64_t)100000000) // 1 coin
  
  #define CRYPTONOTE_REWARD_BLOCKS_WINDOW                 100
   
  #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE_V2    60000 //size of block (bytes) after which reward for block calculated using block size
  #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
  #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
  #define CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE          600
  #define CRYPTONOTE_DISPLAY_DECIMAL_POINT                8
  
  #define CRYPTONOTE_TX_FEE_RESERVED_SIZE                 3
  #define CRYPTONOTE_BLOCK_FEE_REWARD_ZONE_V5             21
  
  #define FEE_PER_KB_OLD                                  ((uint64_t)3000000) // .1 * pow(10, 1)
  #define FEE_PER_KB_V2                                   ((uint64_t)3000000) // .4 * pow(10, 1)
  #define FEE_PER_KB                                      ((uint64_t)50000) // 0.00050000
  #define DYNAMIC_FEE_PER_KB_BASE_FEE                     ((uint64_t)2500000000) // .25 * pow(10, 8)
  #define DYNAMIC_FEE_PER_KB_BASE_BLOCK_REWARD            ((uint64_t)2500000000) // .25 * pow(10, 8)
  #define DYNAMIC_FEE_PER_KB_BASE_FEE_V5                  ((uint64_t)2500000000 * (uint64_t)CRYPTONOTE_TX_FEE_RESERVED_SIZE / CRYPTONOTE_BLOCK_FEE_REWARD_ZONE_V5)
  
  #define ORPHANED_BLOCKS_MAX_COUNT                       100
  
  #define DIFFICULTY_TARGET_V1                            60  // seconds - before first fork
  #define DIFFICULTY_WINDOW                               720 // blocks
  #define DIFFICULTY_LAG                                  15  // !!!
  #define DIFFICULTY_CUT                                  60  // timestamps to cut after sorting
  #define DIFFICULTY_CUT_V1                               60  // timestamps to cut after sorting
  #define DIFFICULTY_CUT_V2                               6   // timestamps to cut after sorting
  #define DIFFICULTY_BLOCKS_COUNT                         DIFFICULTY_WINDOW + DIFFICULTY_LAG
  
  #define DIFFICULTY_TARGET_V2                            120  // seconds
  #define DIFFICULTY_WINDOW_V2                            70
  #define DIFFICULTY_WINDOW_V3                            60
  
  #define DIFFICULTY_BLOCKS_COUNT_V2                      DIFFICULTY_WINDOW_V2
  #define DIFFICULTY_BLOCKS_COUNT_V3                      DIFFICULTY_WINDOW_V3
  #define DIFFICULTY_BLOCKS_COUNT_V12                     DIFFICULTY_WINDOW_V2
  #define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT_V2           DIFFICULTY_TARGET_V1 * 2 // https://github.com/zawy12/difficulty-algorithms/issues/3
  #define CRYPTONOTE_BLOCK_FUTURE_TIME_LIMIT_V12          60*5
  
  #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V1   DIFFICULTY_TARGET_V1 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
  #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_SECONDS_V2   DIFFICULTY_TARGET_V2 * CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS
  #define CRYPTONOTE_LOCKED_TX_ALLOWED_DELTA_BLOCKS       1
  
  #define DIFFICULTY_BLOCKS_ESTIMATE_TIMESPAN             DIFFICULTY_TARGET_V1 //just alias; used by tests
  
  
  #define BLOCKS_IDS_SYNCHRONIZING_DEFAULT_COUNT          10000  //by default, blocks ids count in synchronizing
  #define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT_PRE_V4       100    //by default, blocks count in blocks downloading
  #define BLOCKS_SYNCHRONIZING_DEFAULT_COUNT              20     //by default, blocks count in blocks downloading
  
  #define CRYPTONOTE_MEMPOOL_TX_LIVETIME                  (86400*5) //seconds, five days
  #define CRYPTONOTE_MEMPOOL_TX_FROM_ALT_BLOCK_LIVETIME   604800    //seconds, one week
  
  #define COMMAND_RPC_GET_BLOCKS_FAST_MAX_COUNT           1000
  
  #define P2P_LOCAL_WHITE_PEERLIST_LIMIT                  5000
  #define P2P_LOCAL_GRAY_PEERLIST_LIMIT                   2500
  
  #define P2P_DEFAULT_CONNECTIONS_COUNT                   8
  #define P2P_DEFAULT_HANDSHAKE_INTERVAL                  60           //secondes
  #define P2P_DEFAULT_PACKET_MAX_SIZE                     50000000     //50000000 bytes maximum packet size
  #define P2P_DEFAULT_PEERS_IN_HANDSHAKE                  250
  #define P2P_DEFAULT_CONNECTION_TIMEOUT                  5000       //5 seconds
  #define P2P_DEFAULT_PING_CONNECTION_TIMEOUT             2000       //2 seconds
  #define P2P_DEFAULT_INVOKE_TIMEOUT                      60*2*1000  //2 minutes
  #define P2P_DEFAULT_HANDSHAKE_INVOKE_TIMEOUT            5000       //5 seconds
  #define P2P_DEFAULT_WHITELIST_CONNECTIONS_PERCENT       70
  #define P2P_DEFAULT_ANCHOR_CONNECTIONS_COUNT            2
  
  #define P2P_FAILED_ADDR_FORGET_SECONDS                  (60*60)     //1 hour
  #define P2P_IP_BLOCKTIME                                (60*60*24)  //24 hour
  #define P2P_IP_FAILS_BEFORE_BLOCK                       10
  #define P2P_IDLE_CONNECTION_KILL_INTERVAL               (5*60) //5 minutes
  
  #define P2P_SUPPORT_FLAG_FLUFFY_BLOCKS                  0x01
  #define P2P_SUPPORT_FLAGS                               P2P_SUPPORT_FLAG_FLUFFY_BLOCKS
  
  #define ALLOW_DEBUG_COMMANDS
  
  #define CRYPTONOTE_NAME                                 "bitelectronero"
  #define CRYPTONOTE_POOLDATA_FILENAME                    "poolstate.bin"
  #define CRYPTONOTE_BLOCKCHAINDATA_FILENAME              "data.mdb"
  #define CRYPTONOTE_BLOCKCHAINDATA_LOCK_FILENAME         "lock.mdb"
  #define P2P_NET_DATA_FILENAME                           "p2pstate.bin"
  #define MINER_CONFIG_FILE_NAME                          "miner_conf.json"
  
  #define THREAD_STACK_SIZE                               5 * 1024 * 1024
  
  // coin emission change interval/speed configs
  #define CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE       240 * 1024    // 240kB, used for emissions
  #define BLOCK_SIZE_GROWTH_FAVORED_ZONE                  ((uint64_t) (CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE * 4))
  #define DIFFICULTY_TARGET                               DIFFICULTY_TARGET_V2  // just alias, used for emissions
  #define COIN_EMISSION_MONTH_INTERVAL                    6  // months to change emission speed
  #define COIN_EMISSION_HEIGHT_INTERVAL                   ((uint64_t) (COIN_EMISSION_MONTH_INTERVAL * (30.4375 * 24 * 3600) / DIFFICULTY_TARGET)) // calculated to # of heights to change emission speed
  #define PEAK_COIN_EMISSION_YEAR                         4
  #define PEAK_COIN_EMISSION_HEIGHT                       ((uint64_t) (((12 * 30.4375 * 24 * 3600)/DIFFICULTY_TARGET) * PEAK_COIN_EMISSION_YEAR)) // = (# of heights emmitted per year) * PEAK_COIN_EMISSION_YEAR
  
  
  #define HF_VERSION_DYNAMIC_FEE                          100
  #define HF_VERSION_ENFORCE_RCT                          6
  #define HF_VERSION_MIN_MIXIN_4                          7
  #define HF_VERSION_MIN_MIXIN_6                          8
  
  #define CRYPTONOTE_RINGDB_DIR                           ".bitelectronero-shared-ringdb" // shared-ringdb"
  
  #define MIN_MIXIN                                       1      // minimum mixin allowed
  #define MAX_MIXIN                                       100    // maximum mixin allowed
  #define DEFAULT_MIXIN                                   12     // default mixin
  #define PER_KB_FEE_QUANTIZATION_DECIMALS                8
  
  #define HASH_OF_HASHES_STEP                             256
  
  #define DEFAULT_TXPOOL_MAX_SIZE                         648000000ull // 3 days at 300000, in bytes
  
  // New constants are intended to go here
  namespace config
  {
    uint64_t const DEFAULT_FEE_ATOMIC_XMR_PER_KB = 5;
    uint8_t const FEE_CALCULATION_MAX_RETRIES = 10;
    uint64_t const DEFAULT_DUST_THRESHOLD = ((uint64_t)50000); // 
    uint64_t const BASE_REWARD_CLAMP_THRESHOLD = ((uint64_t)100000000); // pow(10, 8)
    std::string const P2P_REMOTE_DEBUG_TRUSTED_PUB_KEY = "0000000000000000000000000000000000000000000000000000000000000000";
  
    uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18018;
    uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 18019;
    uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 42;
    uint16_t const P2P_DEFAULT_PORT = 14080;
    uint16_t const RPC_DEFAULT_PORT = 12090;
    uint16_t const ZMQ_RPC_DEFAULT_PORT = 14082;
    boost::uuids::uuid const NETWORK_ID = { {
      0x66, 0xF3, 0x21, 0x88,  0x3E, 0xEA, 0xD2, 0xF7, 0xF1, 0xA9, 0xA8, 0xF5 ,0xF8 ,0xEA, 0x5D, 0xD1
      } }; // Bender's nightmare
    std::string const GENESIS_TX = "011201ff00011e026bc5c7db8a664f652d78adb587ac4d759c6757258b64ef9cba3c0354e64fb2e42101abca6a39c561d0897be183eb0143990eba201aa7d2c652ab0555d28bb4b70728";
    uint32_t const GENESIS_NONCE = 10000;
  
    namespace testnet
    {
      uint64_t const TESTNET_SEGREGATION_FORK_HEIGHT = 1000000;
      uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18018;
      uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 18019;
      uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 42;
      uint16_t const P2P_DEFAULT_PORT = 13080;
      uint16_t const RPC_DEFAULT_PORT = 13081;
      uint16_t const ZMQ_RPC_DEFAULT_PORT = 13082;
      boost::uuids::uuid const NETWORK_ID = { {
          0xE3, 0xA4, 0xEA, 0x5D, 0xD1, 0x2C,0x04, 0xF8, 0x23, 0xE1, 0x66, 0xC2,  0x85, 0x8E, 0xC8, 0x40
        } }; // Bender's daydream
      std::string const GENESIS_TX = "011201ff00011e026bc5c7db8a664f652d78adb587ac4d759c6757258b64ef9cba3c0354e64fb2e42101abca6a39c561d0897be183eb0143990eba201aa7d2c652ab0555d28bb4b70728";
      uint32_t const GENESIS_NONCE = 10001;
    }
  
    namespace stagenet
    {
      uint64_t const STAGENET_SEGREGATION_FORK_HEIGHT = 1000000;
      uint64_t const CRYPTONOTE_PUBLIC_ADDRESS_BASE58_PREFIX = 18018;
      uint64_t const CRYPTONOTE_PUBLIC_INTEGRATED_ADDRESS_BASE58_PREFIX = 18019;
      uint64_t const CRYPTONOTE_PUBLIC_SUBADDRESS_BASE58_PREFIX = 42;
      uint16_t const P2P_DEFAULT_PORT = 18680;
      uint16_t const RPC_DEFAULT_PORT = 18689;
      uint16_t const ZMQ_RPC_DEFAULT_PORT = 18690;
      boost::uuids::uuid const NETWORK_ID = { {
           0xE3, 0xA4, 0xEA, 0x5D, 0xD1, 0x2C,0x04, 0x8E, 0xC8, 0x41, 0xF8, 0x23, 0xE1, 0x66, 0xC2, 0x85
        } }; // Bender's daydream
      std::string const GENESIS_TX = "011201ff00011e026bc5c7db8a664f652d78adb587ac4d759c6757258b64ef9cba3c0354e64fb2e42101abca6a39c561d0897be183eb0143990eba201aa7d2c652ab0555d28bb4b70728";
      uint32_t const GENESIS_NONCE = 10002;
    }
  }
  
  namespace cryptonote
  {
    enum network_type : uint8_t
    {
      MAINNET = 0,
      TESTNET,
      STAGENET,
      FAKECHAIN,
      UNDEFINED = 255
    };
  }
  