OSDN Git Service

genesis is ready for mainnet
[bytom/bytom.git] / consensus / general.go
index 6dcd9fa..2f2af76 100644 (file)
@@ -8,20 +8,34 @@ import (
 
 //consensus variables
 const (
-       // define the Max transaction size and Max block size
-       MaxTxSize    = uint64(1024)
-       MaxBlockSzie = uint64(16384)
+       // Max gas that one block contains
+       MaxBlockGas      = uint64(10000000)
+       VMGasRate        = int64(200)
+       StorageGasRate   = int64(1)
+       MaxGasAmount     = int64(200000)
+       DefaultGasCredit = int64(30000)
 
        //config parameter for coinbase reward
-       CoinbasePendingBlockNumber = uint64(6)
-       subsidyReductionInterval   = uint64(560640)
-       baseSubsidy                = uint64(624000000000)
-       initialBlockSubsidy        = uint64(1470000000000000000)
+       CoinbasePendingBlockNumber = uint64(100)
+       subsidyReductionInterval   = uint64(840000)
+       baseSubsidy                = uint64(41250000000)
+       InitialBlockSubsidy        = uint64(147000041250000000)
 
        // config for pow mining
-       powMinBits            = uint64(2161727821138738707)
-       BlocksPerRetarget     = uint64(1024)
-       targetSecondsPerBlock = uint64(60)
+       PowMinBits            = uint64(2305843009213861724)
+       BlocksPerRetarget     = uint64(2016)
+       TargetSecondsPerBlock = uint64(150)
+       SeedPerRetarget       = uint64(256)
+
+       // MaxTimeOffsetSeconds is the maximum number of seconds a block time is allowed to be ahead of the current time
+       MaxTimeOffsetSeconds = uint64(60 * 60)
+       MedianTimeBlocks     = 11
+
+       PayToWitnessPubKeyHashDataSize = 20
+       PayToWitnessScriptHashDataSize = 32
+       CoinbaseArbitrarySizeLimit     = 128
+
+       BTMAlias = "BTM"
 )
 
 // BTMAssetID is BTM's asset id, the soul asset of Bytom
@@ -32,19 +46,30 @@ var BTMAssetID = &bc.AssetID{
        V3: uint64(18446744073709551615),
 }
 
+// InitialSeed is SHA3-256 of Byte[0^32]
+var InitialSeed = &bc.Hash{
+       V0: uint64(11412844483649490393),
+       V1: uint64(4614157290180302959),
+       V2: uint64(1780246333311066183),
+       V3: uint64(9357197556716379726),
+}
+
+// BTMDefinitionMap is the ....
+var BTMDefinitionMap = map[string]interface{}{
+       "name":        BTMAlias,
+       "symbol":      BTMAlias,
+       "decimals":    8,
+       "description": `Bytom Official Issue`,
+}
+
 // BlockSubsidy calculate the coinbase rewards on given block height
 func BlockSubsidy(height uint64) uint64 {
-       if height == 1 {
-               return initialBlockSubsidy
+       if height == 0 {
+               return InitialBlockSubsidy
        }
        return baseSubsidy >> uint(height/subsidyReductionInterval)
 }
 
-// InitBlock record the byte init block
-func InitBlock() []byte {
-       return []byte("03010100000000000000000000000000000000000000000000000000000000000000009e6291970cb44dd94008c79bcaf9d86f18b4b49ba5b2a04781db7199ed3b9e4e96e2ec8cfe2b4046c8af216f53bf86a30638b13a0b7404c463b9cf8df153a22233ec23886fc5bd12553440d84371701d3d4348099f8abd59a7e7d819befa57b1de50212e5d20e3e1a4fd0193fcb680808080801e010701070096e2ec8cfe2b000001012fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8080ccdee2a69fb3140104cd57a069000000")
-}
-
 // IsBech32SegwitPrefix returns whether the prefix is a known prefix for segwit
 // addresses on any default or registered network.  This is used when decoding
 // an address string into a specific address type.
@@ -60,6 +85,14 @@ type Params struct {
        Bech32HRPSegwit string
 }
 
+var ActiveNetParams = MainNetParams
+
+// NetParams is the correspondence between chain_id and Params
+var NetParams = map[string]Params{
+       "mainnet": MainNetParams,
+       "testnet": TestNetParams,
+}
+
 // MainNetParams is the config for production
 var MainNetParams = Params{
        Name:            "main",