import (
"strings"
+
"github.com/bytom/protocol/bc"
)
+//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
- 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"
)
-// define the BTM asset id, the soul asset of Bytom
+// BTMAssetID is BTM's asset id, the soul asset of Bytom
var BTMAssetID = &bc.AssetID{
V0: uint64(18446744073709551615),
V1: uint64(18446744073709551615),
V3: uint64(18446744073709551615),
}
-func BlockSubsidy(height uint64) uint64 {
- if height == 1 {
- return initialBlockSubsidy
- }
- return baseSubsidy >> uint(height/subsidyReductionInterval)
+// InitialSeed is SHA3-256 of Byte[0^32]
+var InitialSeed = &bc.Hash{
+ V0: uint64(11412844483649490393),
+ V1: uint64(4614157290180302959),
+ V2: uint64(1780246333311066183),
+ V3: uint64(9357197556716379726),
}
-func InitBlock() []byte {
- return []byte("0301010000000000000000000000000000000000000000000000000000000000000000cecccaebf42b406b03545ed2b38a578e5e6b0796d4ebdd8a6dd72210873fcc026c7319de578ffc492159980684155da19e87de0d1b37b35c1a1123770ec1dcc710aabe77607cced7bb1993fcb680808080801e0107010700cecccaebf42b000001012cffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8080ccdee2a69fb314010151000000")
+// 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 == 0 {
+ return InitialBlockSubsidy
+ }
+ return baseSubsidy >> uint(height/subsidyReductionInterval)
+}
// 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.
-func IsBech32SegwitPrefix(prefix string, params *Params) bool {
+func IsBech32SegwitPrefix(prefix string, params *Params) bool {
prefix = strings.ToLower(prefix)
- if prefix == params.Bech32HRPSegwit+"1" {
- return true
- } else {
- return false
- }
+ return prefix == params.Bech32HRPSegwit+"1"
}
-
+// Params store the config for different network
type Params struct {
// Name defines a human-readable identifier for the network.
- Name string
-
+ Name string
Bech32HRPSegwit string
-
}
+var ActiveNetParams = MainNetParams
-var MainNetParams = Params {
- Name: "main",
- Bech32HRPSegwit: "bm",
+// 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",
+ Bech32HRPSegwit: "bm",
+}
-var TestNetParams = Params {
- Name: "test",
+// TestNetParams is the config for test-net
+var TestNetParams = Params{
+ Name: "test",
Bech32HRPSegwit: "tm",
}
-