import (
"encoding/binary"
+ "fmt"
- "github.com/vapor/protocol/bc"
+ "github.com/bytom/vapor/protocol/bc"
)
// basic constant
PayToWitnessPubKeyHashDataSize = 20
PayToWitnessScriptHashDataSize = 32
+
+ CrossInForkHeight = 128957600
+
+ _ = iota
+ SoftFork001
)
// BTMAssetID is BTM's asset id, the soul asset of Bytom
Subsidy uint64
}
+// MovRewardProgram is a reward address corresponding to the range of the specified block height when matching transactions
+type MovRewardProgram struct {
+ BeginBlock uint64
+ EndBlock uint64
+ Program string
+}
+
// Params store the config for different network
type Params struct {
// Name defines a human-readable identifier for the network.
// ProducerSubsidys defines the producer subsidy by block height
ProducerSubsidys []ProducerSubsidy
-}
-// VaporDPOSConfig return the dpos consensus config
-func VaporDPOSConfig() DPOSConfig {
- dpos := DPOSConfig{
- NumOfConsensusNode: 10,
- BlockNumEachNode: 12,
- MinConsensusNodeVoteNum: uint64(100000000000000),
- MinVoteOutputAmount: uint64(10000000000),
- BlockTimeInterval: 500,
- }
+ SoftForkPoint map[uint64]uint64
+
+ // Mov will only start when the block height is greater than this value
+ MovStartHeight uint64
- dpos.RoundVoteBlockNums = uint64(uint64(dpos.NumOfConsensusNode) * dpos.BlockNumEachNode * 10)
- dpos.MaxTimeOffsetMs = uint64(uint64(dpos.BlockTimeInterval) * dpos.BlockNumEachNode / 3)
- return dpos
+ // Used to receive rewards for matching transactions
+ MovRewardPrograms []MovRewardProgram
}
// ActiveNetParams is the active NetParams
CoinbasePendingBlockNumber: uint64(7200),
CoinbaseArbitrarySizeLimit: 128,
},
- DPOSConfig: VaporDPOSConfig(),
+ DPOSConfig: DPOSConfig{
+ NumOfConsensusNode: 10,
+ BlockNumEachNode: 12,
+ MinConsensusNodeVoteNum: uint64(100000000000000),
+ MinVoteOutputAmount: uint64(100000000),
+ BlockTimeInterval: 500,
+ RoundVoteBlockNums: 1200,
+ MaxTimeOffsetMs: 2000,
+ },
Checkpoints: []Checkpoint{},
ProducerSubsidys: []ProducerSubsidy{
{BeginBlock: 1, EndBlock: 63072000, Subsidy: 9512938},
+ {BeginBlock: 63072001, EndBlock: 126144000, Subsidy: 9512938},
+ },
+ SoftForkPoint: map[uint64]uint64{SoftFork001: 10461600},
+ MovStartHeight: 42884800,
+ MovRewardPrograms: []MovRewardProgram{
+ {
+ BeginBlock: 1,
+ EndBlock: 126144000,
+ Program: "00141d00f85e220e35a23282cfc7f91fe7b34bf6dc18",
+ },
},
}
DNSSeeds: []string{"www.testnetseed.vapor.io"},
BasicConfig: BasicConfig{
MaxBlockGas: uint64(10000000),
- MaxGasAmount: int64(200000),
+ MaxGasAmount: int64(640000),
DefaultGasCredit: int64(160000),
StorageGasRate: int64(1),
VMGasRate: int64(200),
- VotePendingBlockNumber: uint64(10000),
- CoinbasePendingBlockNumber: uint64(1200),
+ VotePendingBlockNumber: uint64(3456000),
+ CoinbasePendingBlockNumber: uint64(7200),
CoinbaseArbitrarySizeLimit: 128,
},
- DPOSConfig: VaporDPOSConfig(),
+ DPOSConfig: DPOSConfig{
+ NumOfConsensusNode: 10,
+ BlockNumEachNode: 12,
+ MinConsensusNodeVoteNum: uint64(100000000000000),
+ MinVoteOutputAmount: uint64(100000000),
+ BlockTimeInterval: 500,
+ RoundVoteBlockNums: 1200,
+ MaxTimeOffsetMs: 2000,
+ },
Checkpoints: []Checkpoint{},
ProducerSubsidys: []ProducerSubsidy{
{BeginBlock: 1, EndBlock: 63072000, Subsidy: 15000000},
CoinbasePendingBlockNumber: uint64(1200),
CoinbaseArbitrarySizeLimit: 128,
},
- DPOSConfig: VaporDPOSConfig(),
+ DPOSConfig: DPOSConfig{
+ NumOfConsensusNode: 10,
+ BlockNumEachNode: 12,
+ MinConsensusNodeVoteNum: uint64(100000000000000),
+ MinVoteOutputAmount: uint64(100000000),
+ BlockTimeInterval: 500,
+ RoundVoteBlockNums: 1200,
+ MaxTimeOffsetMs: 2000,
+ },
Checkpoints: []Checkpoint{},
ProducerSubsidys: []ProducerSubsidy{
{BeginBlock: 0, EndBlock: 0, Subsidy: 24},
// BytomMainNetParams is the config for bytom mainnet
func BytomMainNetParams(vaporParam *Params) *Params {
- bech32HRPSegwit := "sm"
+ bech32HRPSegwit := "sn"
switch vaporParam.Name {
case "main":
- bech32HRPSegwit = "bm"
+ bech32HRPSegwit = "bn"
case "test":
- bech32HRPSegwit = "tm"
+ bech32HRPSegwit = "tn"
}
return &Params{Bech32HRPSegwit: bech32HRPSegwit}
}
+
+// InitActiveNetParams load the config by chain ID
+func InitActiveNetParams(chainID string) error {
+ var exist bool
+ if ActiveNetParams, exist = NetParams[chainID]; !exist {
+ return fmt.Errorf("chain_id[%v] don't exist", chainID)
+ }
+ return nil
+}