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(300000)
18 // These configs need add to casper config in elegant way
19 MaxNumOfValidators = int(10)
20 InitBTMSupply = 15.66 * 1e16
22 BlockReward = uint64(570776255)
24 // config parameter for coinbase reward
25 CoinbasePendingBlockNumber = uint64(10)
26 MinVoteOutputAmount = uint64(100000000)
28 PayToWitnessPubKeyHashDataSize = 20
29 PayToWitnessScriptHashDataSize = 32
30 BCRPContractHashDataSize = 32
31 CoinbaseArbitrarySizeLimit = 128
33 BCRPRequiredBTMAmount = uint64(100000000)
38 type CasperConfig struct {
39 // BlockTimeInterval, milliseconds, the block time interval for producing a block
40 BlockTimeInterval uint64
42 // MaxTimeOffsetMs represent the max number of seconds a block time is allowed to be ahead of the current time
43 MaxTimeOffsetMs uint64
45 // BlocksOfEpoch represent the block num in one epoch
48 // MinValidatorVoteNum is the minimum vote number of become validator
49 MinValidatorVoteNum uint64
51 // VotePendingBlockNumber is the locked block number of vote utxo
52 VotePendingBlockNumber uint64
55 // BTMAssetID is BTM's asset id, the soul asset of Bytom
56 var BTMAssetID = &bc.AssetID{
57 V0: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
58 V1: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
59 V2: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
60 V3: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}),
63 // BTMDefinitionMap is the ....
64 var BTMDefinitionMap = map[string]interface{}{
68 "description": `Bytom Official Issue`,
71 // IsBech32SegwitPrefix returns whether the prefix is a known prefix for segwit
72 // addresses on any default or registered network. This is used when decoding
73 // an address string into a specific address type.
74 func IsBech32SegwitPrefix(prefix string, params *Params) bool {
75 prefix = strings.ToLower(prefix)
76 return prefix == params.Bech32HRPSegwit+"1"
79 // Params store the config for different network
81 // Name defines a human-readable identifier for the network.
83 Bech32HRPSegwit string
84 // DefaultPort defines the default peer-to-peer port for the network.
87 // DNSSeeds defines a list of DNS seeds for the network that are used
88 // as one method to discover peers.
91 // CasperConfig defines the casper consensus parameters
95 // ActiveNetParams is ...
96 var ActiveNetParams = MainNetParams
98 // NetParams is the correspondence between chain_id and Params
99 var NetParams = map[string]Params{
100 "mainnet": MainNetParams,
101 "wisdom": TestNetParams,
102 "solonet": SoloNetParams,
105 // MainNetParams is the config for production
106 var MainNetParams = Params{
108 Bech32HRPSegwit: "bm",
109 DefaultPort: "46657",
110 DNSSeeds: []string{"www.mainnetseed.bytom.io"},
111 CasperConfig: CasperConfig{
112 BlockTimeInterval: 6000,
113 MaxTimeOffsetMs: 2400,
115 MinValidatorVoteNum: 1e14,
116 VotePendingBlockNumber: 181440,
120 // TestNetParams is the config for test-net
121 var TestNetParams = Params{
123 Bech32HRPSegwit: "tm",
124 DefaultPort: "46656",
125 DNSSeeds: []string{"www.testnetseed.bytom.io"},
126 CasperConfig: CasperConfig{
127 BlockTimeInterval: 6000,
128 MaxTimeOffsetMs: 24000,
130 MinValidatorVoteNum: 1e8,
131 VotePendingBlockNumber: 10,
135 // SoloNetParams is the config for test-net
136 var SoloNetParams = Params{
138 Bech32HRPSegwit: "sm",
139 CasperConfig: CasperConfig{
140 BlockTimeInterval: 6000,
141 MaxTimeOffsetMs: 24000,
143 MinValidatorVoteNum: 1e8,
144 VotePendingBlockNumber: 10,