github.com/deroproject/derosuite@v2.1.6-1.0.20200307070847-0f2e589c7a2b+incompatible/config/config.go (about)

     1  // Copyright 2017-2018 DERO Project. All rights reserved.
     2  // Use of this source code in any form is governed by RESEARCH license.
     3  // license can be found in the LICENSE file.
     4  // GPG: 0F39 E425 8C65 3947 702A  8234 08B2 0360 A03A 9DE8
     5  //
     6  //
     7  // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
     8  // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     9  // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
    10  // THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    11  // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    12  // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    13  // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    14  // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
    15  // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    16  
    17  package config
    18  
    19  import "github.com/satori/go.uuid"
    20  import "github.com/deroproject/derosuite/crypto"
    21  
    22  // all global configuration variables are picked from here
    23  
    24  // though testing hash complete successfully with 3 secs block time, however
    25  // consider homeusers/developing countries we will be targetting  9 secs
    26  // later hardforks can make it lower by 1 sec, say every 6 months or so, until the system reaches 3 secs
    27  // by that time, networking,space requirements  and cryptonote tx processing requiremtn will probably outgrow homeusers
    28  // since most mining nodes will be running in datacenter, 3 secs  blocks c
    29  const BLOCK_TIME = uint64(12)
    30  const BLOCK_TIME_hf4 = uint64(27)
    31  
    32  // we are ignoring leap seconds from calculations
    33  
    34  // coin emiision related settings
    35  const COIN_MONEY_SUPPLY = uint64(18446744073709551615) // 2^64-1
    36  const COIN_EMISSION_SPEED_FACTOR = uint64(20)
    37  const COIN_DIFFICULTY_TARGET = uint64(120)                 // this is a feeder to emission formula
    38  const COIN_FINAL_SUBSIDY_PER_MINUTE = uint64(300000000000) // 0.3 DERO per minute = 157680 per year roughly
    39  const CRYPTONOTE_REWARD_BLOCKS_WINDOW = uint64(100)        // last 100 blocks are used to create
    40  
    41  const MINER_TX_AMOUNT_UNLOCK = uint64(60)  // miner tx will need 60 blocks to mature
    42  const NORMAL_TX_AMOUNT_UNLOCK = uint64(11) // normal transfers will mature at 10th (9 blocks distance) blocks to mature
    43  
    44  // these are used to configure mainnet hard fork
    45  const HARDFORK_1_END = int64(1)
    46  
    47  //const HARDFORK_1_TOTAL_SUPPLY = uint64(2000000000000000000 ) // this is used to mark total supply
    48  // till 95532 (includind)  4739519967524007940
    49  // 95543   4739807553788105597
    50  // 95549   4739964392976757069
    51  // 95550   4739990536584241377
    52  const MAINNET_HARDFORK_1_TOTAL_SUPPLY = uint64(4739990536584241377)
    53  
    54  const TESTNET_HARDFORK_1_TOTAL_SUPPLY = uint64(4319584000000000000)
    55  
    56  // this is used to find whether output is locked to height or time
    57  // see input maturity to find how it works
    58  // if locked is less than this, then it is considered locked to height else epoch
    59  const CRYPTONOTE_MAX_BLOCK_NUMBER = uint64(500000000)
    60  
    61  const MAX_CHAIN_HEIGHT = uint64(2147483648) // 2^31
    62  
    63  // this is also the minimum block size
    64  // no longer used for emission as our block sizes are now fixed
    65  const CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE = uint64(300000) // after this block size , reward calculated differently
    66  
    67  // max block deviation of 2 seconds is allowed
    68  const CRYPTONOTE_FUTURE_TIME_LIMIT = 2
    69  
    70  // 1.25 MB block every 12 secs is equal to roughly 75 TX per second
    71  // if we consider side blocks, TPS increase to > 100 TPS
    72  // we can easily improve TPS by changing few parameters in this file
    73  // the resources compute/network may not be easy for the developing countries
    74  // we need to trade of TPS  as per community
    75  const CRYPTONOTE_MAX_BLOCK_SIZE = uint64((1 * 1024 * 1024) + (256*1024 )) // max block size limit
    76  
    77  const CRYPTONOTE_MAX_TX_SIZE = 300 * 1024 // max size
    78  
    79  const MAX_VOUT = 8   // max payees, 6, 7 is change,   8th will be rejected
    80  const MIN_MIXIN = 5  //  >= 5 ,   4 mixin will be rejected
    81  const MAX_MIXIN = 14 // <= 13,   14th will rejected
    82  
    83  // ATLANTIS FEE calculation constants are here
    84  const FEE_PER_KB = uint64(1000000000) // .001 dero per kb
    85  
    86  
    87  const MAINNET_BOOTSTRAP_DIFFICULTY = uint64(200 *1000*1000 * BLOCK_TIME) // atlantis mainnet botstrapped at 200 MH/s
    88  const MAINNET_BOOTSTRAP_DIFFICULTY_hf4 = uint64(50*1000 * BLOCK_TIME_hf4) // astrobwt mainnet boot strap at 50KH/s
    89  const MAINNET_MINIMUM_DIFFICULTY = uint64(5* 1000 * BLOCK_TIME_hf4) // 5 KH/s
    90  
    91  // testnet bootstraps at 1 MH
    92  //const  TESTNET_BOOTSTRAP_DIFFICULTY = uint64(1000*1000*BLOCK_TIME)
    93  const TESTNET_BOOTSTRAP_DIFFICULTY = uint64(1600 * BLOCK_TIME_hf4) // testnet bootstrap at 800 H/s
    94  const TESTNET_MINIMUM_DIFFICULTY = uint64(800 * BLOCK_TIME_hf4) // 800 H
    95  
    96  
    97  // this single parameter controls lots of various parameters
    98  // within the consensus, it should never go below 7
    99  // if changed responsibly, we can have one second  or lower blocks (ignoring chain bloat/size issues)
   100  // gives immense scalability,
   101  // increasing this means, you need to change  maturity limits also
   102  const STABLE_LIMIT = int64(8)
   103  
   104  // we can have number of chains running for testing reasons
   105  type CHAIN_CONFIG struct {
   106  	Name                             string
   107  	Network_ID                       uuid.UUID // network ID
   108  	Public_Address_Prefix            uint64
   109  	Public_Address_Prefix_Integrated uint64
   110  
   111  	P2P_Default_Port        int
   112  	RPC_Default_Port        int
   113  	Wallet_RPC_Default_Port int
   114  
   115  	Genesis_Nonce uint32
   116  
   117  	Genesis_Block_Hash crypto.Hash
   118  
   119  	Genesis_Tx string
   120  }
   121  
   122  var Mainnet = CHAIN_CONFIG{Name: "mainnet",
   123  	Network_ID:                       uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x9a, 0x11, 0x22, 0x33}),
   124  	Public_Address_Prefix:            0xc8ed8, //for dERo  823000
   125  	Public_Address_Prefix_Integrated: 0xa0ed8, //for dERi  659160
   126  	P2P_Default_Port:                 20202,
   127  	RPC_Default_Port:                 20206,
   128  	Wallet_RPC_Default_Port:          20209,
   129  	Genesis_Nonce:                    10000,
   130  
   131  	Genesis_Block_Hash: crypto.HashHexToHash("e14e318562db8d22f8d00bd41c7938807c7ff70e4380acc6f7f2427cf49f474a"),
   132  
   133  	Genesis_Tx: "" +
   134  		"02" + // version
   135  		"3c" + // unlock time
   136  		"01" + // vin length
   137  		"ff" + // vin #1
   138  		"00" + // height gen input
   139  		"01" + // vout length
   140  		"ffffffffffff07" + // output #1 amount
   141  		"02" + // output 1 type
   142  		"0bf6522f9152fa26cd1fc5c022b1a9e13dab697f3acf4b4d0ca6950a867a1943" + // output #1 key
   143  		"21" + // extra length in bytes
   144  		"01" + // extra pubkey tag
   145  		"1d92826d0656958865a035264725799f39f6988faa97d532f972895de849496d" + // tx pubkey
   146  		"00", // RCT signature none
   147  }
   148  
   149  var Testnet = CHAIN_CONFIG{Name: "testnet", // testnet will always have last 3 bytes 0
   150  	Network_ID:                       uuid.FromBytesOrNil([]byte{0x59, 0xd7, 0xf7, 0xe9, 0xdd, 0x48, 0xd5, 0xfd, 0x13, 0x0a, 0xf6, 0xe0, 0x9a, 0x08, 0x00, 0x00}),
   151  	Public_Address_Prefix:            0x6cf58, // for dETo 446296
   152  	Public_Address_Prefix_Integrated: 0x44f58, // for dETi 282456
   153  	P2P_Default_Port:                 30303,
   154  	RPC_Default_Port:                 30306,
   155  	Wallet_RPC_Default_Port:          30309,
   156  	Genesis_Nonce:                    10001,
   157  
   158  	Genesis_Block_Hash: crypto.HashHexToHash("7be4a8f27bcadf556132dba38c2d3d78214beec8a959be17caf172317122927a"),
   159  
   160  	Genesis_Tx: "" +
   161  		"02" + // version
   162  		"3c" + // unlock time
   163  		"01" + // vin length
   164  		"ff" + // vin #1
   165  		"00" + // height gen input
   166  		"01" + // vout length
   167  		"ffffffffffff07" + // output #1 amount
   168  		"02" + // output 1 type
   169  		"0bf6522f9152fa26cd1fc5c022b1a9e13dab697f3acf4b4d0ca6950a867a1943" + // output #1 key
   170  		"21" + // extra length in bytes
   171  		"01" + // extra pubkey tag
   172  		"1d92826d0656958865a035264725799f39f6988faa97d532f972895de849496d" + // tx pubkey
   173  		"00", // RCT signature none
   174  
   175  }
   176  
   177  // the constants can be found in cryptonote_config.h
   178  // these are still here for previous emission functions, they are not used directly for atlantis
   179  const DYNAMIC_FEE_PER_KB_BASE_FEE_V5 = uint64((2000000000 * 60000) / 300000)
   180  const DYNAMIC_FEE_PER_KB_BASE_BLOCK_REWARD = uint64(1000000000000) // 1 * pow(10,12)
   181  
   182  
   183  // mainnet has a remote daemon node, which can be used be default, if user provides a  --remote flag
   184  const REMOTE_DAEMON = "https://rwallet.dero.live"