7 "github.com/bytom/bytom/protocol/bc"
10 // consensus variables
12 // Max gas that one block contains
13 MaxBlockGas = uint64(10000000)
14 VMGasRate = int64(200)
15 StorageGasRate = int64(1)
16 MaxGasAmount = int64(200000)
17 DefaultGasCredit = int64(30000)
19 // These configs need add to casper config in elegant way
20 MaxNumOfValidators = int(10)
21 InitBTMSupply = 15.66 * 1e16
23 BlockReward = uint64(570776255)
25 // config parameter for coinbase reward
26 CoinbasePendingBlockNumber = uint64(100)
27 MinVoteOutputAmount = uint64(100000000)
29 PayToWitnessPubKeyHashDataSize = 20
30 PayToWitnessScriptHashDataSize = 32
31 BCRPContractHashDataSize = 32
32 CoinbaseArbitrarySizeLimit = 128
34 BCRPRequiredBTMAmount = uint64(100000000)
39 type CasperConfig struct {
40 // BlockTimeInterval, milliseconds, the block time interval for producing a block
41 BlockTimeInterval uint64
43 // MaxTimeOffsetMs represent the max number of seconds a block time is allowed to be ahead of the current time
44 MaxTimeOffsetMs uint64
46 // BlocksOfEpoch represent the block num in one epoch
49 // MinValidatorVoteNum is the minimum vote number of become validator
50 MinValidatorVoteNum uint64
52 // VotePendingBlockNumber is the locked block number of vote utxo
53 VotePendingBlockNumber uint64
56 // BTMAssetID is BTM's asset id, the soul asset of Bytom
57 var BTMAssetID = &bc.AssetID{
58 V0: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
59 V1: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
60 V2: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
61 V3: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
64 // BTMDefinitionMap is the ....
65 var BTMDefinitionMap = map[string]interface{}{
69 "description": `Bytom Official Issue`,
72 // IsBech32SegwitPrefix returns whether the prefix is a known prefix for segwit
73 // addresses on any default or registered network. This is used when decoding
74 // an address string into a specific address type.
75 func IsBech32SegwitPrefix(prefix string, params *Params) bool {
76 prefix = strings.ToLower(prefix)
77 return prefix == params.Bech32HRPSegwit+"1"
80 // Params store the config for different network
82 // Name defines a human-readable identifier for the network.
84 Bech32HRPSegwit string
85 // DefaultPort defines the default peer-to-peer port for the network.
88 // DNSSeeds defines a list of DNS seeds for the network that are used
89 // as one method to discover peers.
92 // CasperConfig defines the casper consensus parameters
96 // ActiveNetParams is ...
97 var ActiveNetParams = MainNetParams
99 // NetParams is the correspondence between chain_id and Params
100 var NetParams = map[string]Params{
101 "mainnet": MainNetParams,
102 "wisdom": TestNetParams,
103 "solonet": SoloNetParams,
106 // MainNetParams is the config for production
107 var MainNetParams = Params{
109 Bech32HRPSegwit: "bm",
110 DefaultPort: "46657",
111 DNSSeeds: []string{"www.mainnetseed.bytom.io"},
112 CasperConfig: CasperConfig{
113 BlockTimeInterval: 6000,
114 MaxTimeOffsetMs: 24000,
116 MinValidatorVoteNum: 1e14,
117 VotePendingBlockNumber: 181440,
121 // TestNetParams is the config for test-net
122 var TestNetParams = Params{
124 Bech32HRPSegwit: "tm",
125 DefaultPort: "46656",
126 DNSSeeds: []string{"www.testnetseed.bytom.io"},
127 CasperConfig: CasperConfig{
128 BlockTimeInterval: 6000,
129 MaxTimeOffsetMs: 24000,
131 MinValidatorVoteNum: 1e8,
132 VotePendingBlockNumber: 10,
136 // SoloNetParams is the config for test-net
137 var SoloNetParams = Params{
139 Bech32HRPSegwit: "sm",
140 CasperConfig: CasperConfig{
141 BlockTimeInterval: 6000,
142 MaxTimeOffsetMs: 24000,
144 MinValidatorVoteNum: 1e8,
145 VotePendingBlockNumber: 10,