params

package
v0.10.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 29, 2021 License: ISC Imports: 13 Imported by: 5

Documentation

Index

Constants

View Source
const (
	// DeploymentTestDummy defines the rule change deployment ID for testing
	// purposes.
	DeploymentTestDummy = iota

	// DeploymentToken defines the rule change deployment ID for the token
	// soft-fork package.
	DeploymentToken

	// DefinedDeployments is the number of currently defined deployments.
	DefinedDeployments
)

Constants that define the deployment offset in the deployments field of the parameters for each deployment. This is useful to be able to get the details of a specific deployment by name.

View Source
const (
	CoinbaseVersionV1 = "0.10.4"
)

Variables

View Source
var (
	// ErrDuplicateNet describes an error where the parameters for a network
	// could not be set due to the network already being a standard
	// network or previously-registered into this package.
	ErrDuplicateNet = errors.New("duplicate network")

	// ErrUnknownHDKeyID describes an error where the provided id which
	// is intended to identify the network for a hierarchical deterministic
	// private extended key is not registered.
	ErrUnknownHDKeyID = errors.New("unknown hd private extended key bytes")
)
View Source
var ActiveNetParams = &MainNetParam

activeNetParams is a pointer to the parameters specific to the currently active network.

View Source
var CPUMinerThreads = 1

CPUMinerThreads is the default number of threads to utilize with the CPUMiner when mining.

View Source
var CheckForDuplicateHashes = false

CheckForDuplicateHashes checks for duplicate hashes when validating blocks. Because of the rule inserting the height into the second (nonce) txOut, there should never be a duplicate transaction hash that overwrites another. However, because there is a 2^128 chance of a collision, the paranoid user may wish to turn this feature on.

View Source
var MainNetParam = netParams{
	Params:  &MainNetParams,
	RpcPort: "8131",
}

mainNetParams contains parameters specific to the main network

View Source
var MainNetParams = Params{
	Name:           "mainnet",
	Net:            protocol.MainNet,
	DefaultPort:    "8130",
	DefaultUDPPort: 8140,
	Bootstrap: []string{
		"/dns4/node.meerscan.io/tcp/28130/p2p/16Uiu2HAmTdcrQ2S4MD6UxeR81Su8DQdt2eB7vLzJA7LrawNf93T2",
		"/dns4/ns-cn.qitmeer.xyz/tcp/18150/p2p/16Uiu2HAm45YEQXf5sYgpebp1NvPS96ypvvpz5uPx7iPHmau94vVk",
		"/dns4/ns.qitmeer.top/tcp/28230/p2p/16Uiu2HAmRtp5CjNv3WvPYuh7kNXXZQDYegwFFeDH9vWY3JY4JS1W",
		"/dns4/boot.qitmir.info/tcp/2001/p2p/16Uiu2HAmJ8qBBgoNoHH84ntLuXB9sqDngh82zZgaEejdFUYGR59Y",
	},
	LedgerParams: ledger.LedgerParams{
		GenesisAmountUnit: 1000 * 1e8,
		MaxLockHeight:     86400 / mixTargetTimePerBlock * 365 * 5,
	},

	GenesisBlock: &genesisBlock,
	GenesisHash:  &genesisHash,
	PowConfig: &pow.PowConfig{
		Blake2bdPowLimit:             mainPowLimit,
		Blake2bdPowLimitBits:         0x1b0fffff,
		X16rv3PowLimit:               mainPowLimit,
		X16rv3PowLimitBits:           0x1b0fffff,
		X8r16PowLimit:                mainPowLimit,
		X8r16PowLimitBits:            0x1b0fffff,
		QitmeerKeccak256PowLimit:     mainPowLimit,
		QitmeerKeccak256PowLimitBits: 0x1b0fffff,

		CuckarooMinDifficulty:     0x1300000 * 4,
		CuckaroomMinDifficulty:    0x1300000 * 4,
		CuckatooMinDifficulty:     0x1300000 * 4,
		MeerXKeccakV1PowLimit:     mainPowLimit,
		MeerXKeccakV1PowLimitBits: 0x1b0fffff,
		Percent: map[pow.MainHeight]pow.PercentItem{
			pow.MainHeight(0): {
				pow.MEERXKECCAKV1: 100,
			},
		},

		AdjustmentStartMainHeight: 45 * 1440 * 60 / mainTargetTimePerBlock,
	},
	CoinbaseConfig:           CoinbaseConfigs{},
	ReduceMinDifficulty:      false,
	MinDiffReductionTime:     0,
	GenerateSupported:        false,
	WorkDiffAlpha:            1,
	WorkDiffWindowSize:       mainWorkDiffWindowSize,
	WorkDiffWindows:          20,
	MaximumBlockSizes:        []int{1310720},
	MaxTxSize:                1000000,
	TargetTimePerBlock:       time.Second * mainTargetTimePerBlock,
	TargetTimespan:           time.Second * mainTargetTimePerBlock * mainWorkDiffWindowSize,
	RetargetAdjustmentFactor: 2,

	BaseSubsidy:              10 * 1e8,
	MulSubsidy:               0,
	DivSubsidy:               101,
	SubsidyReductionInterval: 7986093,

	WorkRewardProportion:  10,
	StakeRewardProportion: 0,
	BlockTaxProportion:    0,

	Checkpoints: []Checkpoint{},

	RuleChangeActivationThreshold: 57,
	MinerConfirmationWindow:       mainWorkDiffWindowSize,
	Deployments: []ConsensusDeployment{
		DeploymentTestDummy: {
			BitNumber: 28,
		},
		DeploymentToken: {
			BitNumber:  0,
			StartTime:  0,
			ExpireTime: mainWorkDiffWindowSize * 2,
		},
	},

	NetworkAddressPrefix: "M",
	PubKeyAddrID:         [2]byte{0x1f, 0xc5},
	PubKeyHashAddrID:     [2]byte{0x0b, 0xb1},
	PKHEdwardsAddrID:     [2]byte{0x0b, 0x9f},
	PKHSchnorrAddrID:     [2]byte{0x0b, 0xbd},
	ScriptHashAddrID:     [2]byte{0x0b, 0x81},
	PrivateKeyID:         [2]byte{0x22, 0xdc},

	HDPrivateKeyID: [4]byte{0x03, 0xb8, 0xc4, 0x22},
	HDPublicKeyID:  [4]byte{0x03, 0xb8, 0xc8, 0x58},

	HDCoinType: 223,

	CoinbaseMaturity: 720,

	OrganizationPkScript: hexMustDecode("76a914e99ebf409dda2a10ea9970651021d8e552f286de88ac"),
	TokenAdminPkScript:   hexMustDecode("00000000c96d6d76a914b8834294977b26a44094fe2216f8a7d59af1130888ac"),

	GuardAddrPkScript: hexMustDecode("76a9143846e53e5e952b5cd6023e3ad3cfc75cb93fce0388ac"),

	HonorAddrPkScript: hexMustDecode("76a9143846e53e5e952b5cd60240ad9c4cf6164dd5090988ac"),
}

MainNetParams defines the network parameters for the main network.

View Source
var MixNetParam = netParams{
	Params:  &MixNetParams,
	RpcPort: "28131",
}

MixNetParam contains parameters specific to the mix pow test network

View Source
var MixNetParams = Params{
	Name:           "mixnet",
	Net:            protocol.MixNet,
	DefaultPort:    "28130",
	DefaultUDPPort: 28140,
	Bootstrap: []string{
		"/dns4/ns.qitmeer.top/tcp/28230/p2p/16Uiu2HAmRtp5CjNv3WvPYuh7kNXXZQDYegwFFeDH9vWY3JY4JS1W",
	},

	GenesisBlock:         &testPowNetGenesisBlock,
	GenesisHash:          &testPowNetGenesisHash,
	ReduceMinDifficulty:  false,
	MinDiffReductionTime: 0,
	GenerateSupported:    true,
	LedgerParams: ledger.LedgerParams{
		GenesisAmountUnit: 1000 * 1e8,
		MaxLockHeight:     86400 / mixTargetTimePerBlock * 365 * 5,
	},
	CoinbaseConfig: CoinbaseConfigs{
		{
			Height:                    23000,
			Version:                   CoinbaseVersionV1,
			ExtraDataIncludedVer:      true,
			ExtraDataIncludedNodeInfo: true,
		},
	},
	PowConfig: &pow.PowConfig{
		Blake2bdPowLimit:             testMixNetPowLimit,
		Blake2bdPowLimitBits:         0x2003ffff,
		X16rv3PowLimit:               testMixNetPowLimit,
		X16rv3PowLimitBits:           0x2003ffff,
		X8r16PowLimit:                testMixNetPowLimit,
		X8r16PowLimitBits:            0x2003ffff,
		QitmeerKeccak256PowLimit:     testMixNetPowLimit,
		QitmeerKeccak256PowLimitBits: 0x2003ffff,
		CryptoNightPowLimit:          testMixNetPowLimit,
		CryptoNightPowLimitBits:      0x2003ffff,
		MeerXKeccakV1PowLimit:        testMixNetPowLimit,
		MeerXKeccakV1PowLimitBits:    0x1c00ffff,

		CuckarooMinDifficulty:  0x1600000,
		CuckatooMinDifficulty:  0x1600000,
		CuckaroomMinDifficulty: 0x1600000,

		Percent: map[pow.MainHeight]pow.PercentItem{
			pow.MainHeight(0): {
				pow.MEERXKECCAKV1: 100,
			},
		},

		AdjustmentStartMainHeight: 1440 * 15 / mixTargetTimePerBlock,
	},

	WorkDiffAlpha:            1,
	WorkDiffWindowSize:       mixWorkDiffWindowSize,
	WorkDiffWindows:          20,
	MaximumBlockSizes:        []int{1310720},
	MaxTxSize:                1000000,
	TargetTimePerBlock:       time.Second * mixTargetTimePerBlock,
	TargetTimespan:           time.Second * mixTargetTimePerBlock * mixWorkDiffWindowSize,
	RetargetAdjustmentFactor: 2,

	BaseSubsidy:              10 * 1e8,
	MulSubsidy:               100,
	DivSubsidy:               10000000000000,
	SubsidyReductionInterval: 1669066,
	WorkRewardProportion:     10,
	StakeRewardProportion:    0,
	BlockTaxProportion:       0,

	Checkpoints: []Checkpoint{},

	RuleChangeActivationThreshold: 57,
	MinerConfirmationWindow:       mixWorkDiffWindowSize,
	Deployments: []ConsensusDeployment{
		DeploymentTestDummy: {
			BitNumber:   28,
			StartTime:   1626688646,
			ExpireTime:  1655200727,
			PerformTime: 1655204327,
		},
		DeploymentToken: {
			BitNumber:  0,
			StartTime:  1440,
			ExpireTime: 14400,
		},
	},

	NetworkAddressPrefix: "X",
	PubKeyAddrID:         [2]byte{0x2f, 0x16},
	PubKeyHashAddrID:     [2]byte{0x11, 0x52},
	PKHEdwardsAddrID:     [2]byte{0x11, 0x41},
	PKHSchnorrAddrID:     [2]byte{0x11, 0x5f},
	ScriptHashAddrID:     [2]byte{0x11, 0x23},
	PrivateKeyID:         [2]byte{0x23, 0x26},

	HDPrivateKeyID: [4]byte{0x01, 0x9d, 0x0b, 0xe1},
	HDPublicKeyID:  [4]byte{0x01, 0x9d, 0x0d, 0x62},

	HDCoinType: 223,

	CoinbaseMaturity:     720,
	OrganizationPkScript: hexMustDecode("76a91429209320e66d96839785dd07e643a7f1592edc5a88ac"),
	TokenAdminPkScript:   hexMustDecode("00000000c96d6d76a914b8834294977b26a44094fe2216f8a7d59af1130888ac"),
}

testPowNetParams defines the network parameters for the test network.

View Source
var PrivNetParam = netParams{
	Params:  &PrivNetParams,
	RpcPort: "38131",
}

privNetParams contains parameters specific to the private test network

View Source
var PrivNetParams = Params{
	Name:           "privnet",
	Net:            protocol.PrivNet,
	DefaultPort:    "38130",
	DefaultUDPPort: 38140,
	Bootstrap:      []string{},

	GenesisBlock: &privNetGenesisBlock,
	GenesisHash:  &privNetGenesisHash,
	LedgerParams: ledger.LedgerParams{
		GenesisAmountUnit: 1000 * 1e8,
		MaxLockHeight:     10 * 365 * 5,
	},
	PowConfig: &pow.PowConfig{
		Blake2bdPowLimit:             privNetPowLimit,
		Blake2bdPowLimitBits:         0x207fffff,
		X8r16PowLimit:                privNetPowLimit,
		X8r16PowLimitBits:            0x207fffff,
		X16rv3PowLimit:               privNetPowLimit,
		X16rv3PowLimitBits:           0x207fffff,
		QitmeerKeccak256PowLimit:     privNetPowLimit,
		QitmeerKeccak256PowLimitBits: 0x207fffff,
		MeerXKeccakV1PowLimit:        privNetPowLimit,
		MeerXKeccakV1PowLimitBits:    0x207fffff,

		CuckarooMinDifficulty:  0x1300000,
		CuckatooMinDifficulty:  0x1300000,
		CuckaroomMinDifficulty: 0x1300000,

		Percent: map[pow.MainHeight]pow.PercentItem{
			pow.MainHeight(0): {
				pow.BLAKE2BD:      10,
				pow.CUCKAROO:      10,
				pow.CUCKATOO:      20,
				pow.CUCKAROOM:     10,
				pow.X16RV3:        10,
				pow.X8R16:         20,
				pow.MEERXKECCAKV1: 20,
			},
			pow.MainHeight(50): {
				pow.BLAKE2BD:         0,
				pow.CUCKAROO:         30,
				pow.CUCKATOO:         0,
				pow.CUCKAROOM:        30,
				pow.X16RV3:           10,
				pow.X8R16:            0,
				pow.QITMEERKECCAK256: 0,
				pow.MEERXKECCAKV1:    30,
			},
			pow.MainHeight(100): {
				pow.BLAKE2BD:      0,
				pow.CUCKAROO:      0,
				pow.CUCKATOO:      0,
				pow.CUCKAROOM:     70,
				pow.X16RV3:        0,
				pow.X8R16:         0,
				pow.MEERXKECCAKV1: 30,
			},
		},

		AdjustmentStartMainHeight: 45 * 1440 * 60 / privTargetTimePerBlock,
	},
	CoinbaseConfig: CoinbaseConfigs{
		{
			Height:  0,
			Version: "0.10.1",
		},
		{
			Height:                    10,
			Version:                   "0.10.2",
			ExtraDataIncludedVer:      true,
			ExtraDataIncludedNodeInfo: true,
		},
		{
			Height:                    20,
			Version:                   "0.10.3",
			ExtraDataIncludedVer:      true,
			ExtraDataIncludedNodeInfo: true,
		},
	},
	ReduceMinDifficulty:      false,
	MinDiffReductionTime:     0,
	GenerateSupported:        true,
	MaximumBlockSizes:        []int{1000000, 1310720},
	MaxTxSize:                1000000,
	WorkDiffAlpha:            1,
	WorkDiffWindowSize:       160,
	WorkDiffWindows:          20,
	TargetTimePerBlock:       time.Second * privTargetTimePerBlock,
	TargetTimespan:           time.Second * privTargetTimePerBlock * 16,
	RetargetAdjustmentFactor: 2,

	BaseSubsidy:              50000000000,
	MulSubsidy:               100,
	DivSubsidy:               101,
	SubsidyReductionInterval: 128,
	WorkRewardProportion:     10,
	StakeRewardProportion:    0,
	BlockTaxProportion:       0,

	Checkpoints: nil,

	NetworkAddressPrefix: "R",
	PubKeyAddrID:         [2]byte{0x25, 0xe5},
	PubKeyHashAddrID:     [2]byte{0x0d, 0xf1},
	PKHEdwardsAddrID:     [2]byte{0x0d, 0xe0},
	PKHSchnorrAddrID:     [2]byte{0x0d, 0xfe},
	ScriptHashAddrID:     [2]byte{0x0d, 0xc2},
	PrivateKeyID:         [2]byte{0x22, 0xfe},

	HDPrivateKeyID: [4]byte{0x04, 0x0b, 0xee, 0x6e},
	HDPublicKeyID:  [4]byte{0x04, 0x0b, 0xf2, 0xa7},

	HDCoinType: 223,

	OrganizationPkScript: hexMustDecode("76a91429209320e66d96839785dd07e643a7f1592edc5a88ac"),

	TokenAdminPkScript: hexMustDecode("00000000c96d6d76a914785bfbf4ecad8b72f2582be83616c5d364a3244288ac"),

	CoinbaseMaturity: 16,
}

PirvNetParams defines the network parameters for the private test network. This network is similar to the normal test network except it is intended for private use within a group of individuals doing simulation testing. The functionality is intended to differ in that the only nodes which are specifically specified are used to create the network rather than following normal discovery rules. This is important as otherwise it would just turn into another public testnet.

View Source
var SigHashOptimization = false

SigHashOptimization is an optimization for verification of transactions that do CHECKSIG operations with hashType SIGHASH_ALL. Although there should be no consequences to daemons that are simply running a node, it may be the case that you could cause database corruption if you turn this code on, create and manipulate your own MsgTx, then include them in blocks. For safety, if you're using the daemon with wallet or mining with the daemon this should be disabled. If you believe that any MsgTxs in your daemon will be used mutably, do NOT turn on this feature. It is disabled by default. This feature is considered EXPERIMENTAL, enable at your own risk!

View Source
var TestNetParam = netParams{
	Params:  &TestNetParams,
	RpcPort: "18131",
}

testNetParams contains parameters specific to the test network

View Source
var TestNetParams = Params{
	Name:           "testnet",
	Net:            protocol.TestNet,
	DefaultPort:    "18150",
	DefaultUDPPort: 18160,
	Bootstrap: []string{
		"/dns4/node.meerscan.io/tcp/28130/p2p/16Uiu2HAmTdcrQ2S4MD6UxeR81Su8DQdt2eB7vLzJA7LrawNf93T2",
		"/dns4/ns-cn.qitmeer.xyz/tcp/18150/p2p/16Uiu2HAm45YEQXf5sYgpebp1NvPS96ypvvpz5uPx7iPHmau94vVk",
		"/dns4/ns.qitmeer.top/tcp/28230/p2p/16Uiu2HAmRtp5CjNv3WvPYuh7kNXXZQDYegwFFeDH9vWY3JY4JS1W",
		"/dns4/boot.qitmir.info/tcp/2001/p2p/16Uiu2HAmJ8qBBgoNoHH84ntLuXB9sqDngh82zZgaEejdFUYGR59Y",
	},
	LedgerParams: ledger.LedgerParams{
		GenesisAmountUnit: 1000 * 1e8,
		MaxLockHeight:     2880 * 365 * 5,
	},

	GenesisBlock: &testNetGenesisBlock,
	GenesisHash:  &testNetGenesisHash,
	PowConfig: &pow.PowConfig{
		Blake2bdPowLimit:             maxNetPowLimit,
		Blake2bdPowLimitBits:         0x0,
		X16rv3PowLimit:               maxNetPowLimit,
		X16rv3PowLimitBits:           0x0,
		X8r16PowLimit:                maxNetPowLimit,
		X8r16PowLimitBits:            0x0,
		QitmeerKeccak256PowLimit:     maxNetPowLimit,
		QitmeerKeccak256PowLimitBits: 0x0,
		MeerXKeccakV1PowLimit:        testNetPowLimit,
		MeerXKeccakV1PowLimitBits:    0x1f0198f2,

		CuckarooMinDifficulty:  0x87fffff,
		CuckatooMinDifficulty:  0x87fffff,
		CuckaroomMinDifficulty: 0x87fffff,

		Percent: map[pow.MainHeight]pow.PercentItem{
			pow.MainHeight(0): {
				pow.MEERXKECCAKV1: 100,
			},
		},

		AdjustmentStartMainHeight: 365 * 1440 * 60 / testTargetTimePerBlock,
	},
	CoinbaseConfig: CoinbaseConfigs{
		{
			Height:                    61279,
			Version:                   "0.10.4",
			ExtraDataIncludedVer:      true,
			ExtraDataIncludedNodeInfo: true,
		},
	},
	ReduceMinDifficulty:      false,
	MinDiffReductionTime:     0,
	GenerateSupported:        true,
	WorkDiffAlpha:            1,
	WorkDiffWindowSize:       testWorkDiffWindowSize,
	WorkDiffWindows:          20,
	MaximumBlockSizes:        []int{1310720},
	MaxTxSize:                1000000,
	TargetTimePerBlock:       time.Second * testTargetTimePerBlock,
	TargetTimespan:           time.Second * testTargetTimePerBlock * testWorkDiffWindowSize,
	RetargetAdjustmentFactor: 2,

	BaseSubsidy:              12000000000,
	MulSubsidy:               100,
	DivSubsidy:               10000000000000,
	SubsidyReductionInterval: math.MaxInt64,
	WorkRewardProportion:     10,
	StakeRewardProportion:    0,
	BlockTaxProportion:       0,

	CoinbaseMaturity: 720,

	Checkpoints: []Checkpoint{},

	NetworkAddressPrefix: "T",
	PubKeyAddrID:         [2]byte{0x28, 0xf5},
	PubKeyHashAddrID:     [2]byte{0x0f, 0x14},
	PKHEdwardsAddrID:     [2]byte{0x0f, 0x01},
	PKHSchnorrAddrID:     [2]byte{0x0f, 0x1e},
	ScriptHashAddrID:     [2]byte{0x0e, 0xe2},
	PrivateKeyID:         [2]byte{0x23, 0x0b},

	HDPrivateKeyID: [4]byte{0x04, 0x35, 0x83, 0x97},
	HDPublicKeyID:  [4]byte{0x04, 0x35, 0x87, 0xd1},

	HDCoinType:           223,
	OrganizationPkScript: hexMustDecode("76a91429209320e66d96839785dd07e643a7f1592edc5a88ac"),
	TokenAdminPkScript:   hexMustDecode("00000000c96d6d76a914b8834294977b26a44094fe2216f8a7d59af1130888ac"),
}

TestNetParams defines the network parameters for the test network.

Functions

func Register

func Register(params *Params) error

Register registers the network parameters for a Bitcoin network. This may error with ErrDuplicateNet if the network is already registered (either due to a previous Register call, or the network being one of the default networks).

Network parameters should be registered into this package by a main package as early as possible. Then, library packages may lookup networks or network parameters based on inputs and work regardless of the network being standard or not.

Types

type Checkpoint

type Checkpoint struct {
	Layer uint64
	Hash  *hash.Hash
}

Checkpoint identifies a known good point in the block chain. Using checkpoints allows a few optimizations for old blocks during initial download and also prevents forks from old blocks.

Each checkpoint is selected based upon several factors. See the documentation for blockchain.IsCheckpointCandidate for details on the selection criteria.

type CoinbaseConfig added in v0.10.4

type CoinbaseConfig struct {
	Height                    int64
	Version                   string
	ExtraDataIncludedVer      bool
	ExtraDataIncludedNodeInfo bool
}

type CoinbaseConfigs added in v0.10.4

type CoinbaseConfigs []CoinbaseConfig

func (*CoinbaseConfigs) CheckVersion added in v0.10.4

func (cf *CoinbaseConfigs) CheckVersion(curHeight int64, coinbase []byte) bool

func (*CoinbaseConfigs) GetCurrentConfig added in v0.10.4

func (cf *CoinbaseConfigs) GetCurrentConfig(curHeight int64) *CoinbaseConfig

func (*CoinbaseConfigs) GetCurrentVersion added in v0.10.4

func (cf *CoinbaseConfigs) GetCurrentVersion(curHeight int64) string

type ConsensusDeployment

type ConsensusDeployment struct {
	// BitNumber defines the specific bit number within the block version
	// this particular soft-fork deployment refers to.
	BitNumber uint8

	// StartTime (>=CheckerTimeThreshold) is the median block time after which voting on the
	// deployment starts .
	// or
	// StartTime (< CheckerTimeThreshold) is the block main height after which voting on the
	// deployment starts .
	StartTime uint64

	// ExpireTime (>=CheckerTimeThreshold) is the median block time after which the attempted
	// deployment expires.
	// or
	// ExpireTime (< CheckerTimeThreshold) is the block main height after which the attempted
	// deployment expires.
	ExpireTime uint64

	// PerformTime (>=CheckerTimeThreshold) is the median block time after which the attempted
	// deployment perform.
	// or
	// PerformTime (< CheckerTimeThreshold) is the block main height after which the attempted
	// deployment perform.
	PerformTime uint64
}

ConsensusDeployment defines details related to a specific consensus rule change that is voted in. NOTE: The type of time must be consistent

type Params

type Params struct {
	// Name defines a human-readable identifier for the network.
	Name string

	// Net defines the magic bytes used to identify the network.
	Net protocol.Network

	// TCPPort defines the default peer-to-peer tcp port for the network.
	DefaultPort string

	// DefaultUDPPort defines the default peer-to-peer udp port for the network.
	DefaultUDPPort int

	// Bootstrap defines a list of boot node for the network that are used
	// as one method to discover peers.
	Bootstrap []string

	// GenesisBlock defines the first block of the chain.
	GenesisBlock *types.Block

	// GenesisHash is the starting block hash.
	GenesisHash *hash.Hash

	// PowConfig defines the highest allowed proof of work value for a block or lowest difficulty for a block
	PowConfig *pow.PowConfig

	// WorkDiffAlpha is the stake difficulty EMA calculation alpha (smoothing)
	// value. It is different from a normal EMA alpha. Closer to 1 --> smoother.
	WorkDiffAlpha int64

	// WorkDiffWindowSize is the number of windows (intervals) used for calculation
	// of the exponentially weighted average.
	WorkDiffWindowSize int64

	// WorkDiffWindows is the number of windows (intervals) used for calculation
	// of the exponentially weighted average.
	WorkDiffWindows int64

	// CoinbaseMaturity is the number of blocks required before newly mined
	// coins (coinbase transactions) can be spent.
	CoinbaseMaturity uint16

	// TargetTimespan is the desired amount of time that should elapse
	// before the block difficulty requirement is examined to determine how
	// it should be changed in order to maintain the desired block
	// generation rate.
	TargetTimespan time.Duration

	// TargetTimePerBlock is the desired amount of time to generate each
	// block.
	TargetTimePerBlock time.Duration

	// RetargetAdjustmentFactor is the adjustment factor used to limit
	// the minimum and maximum amount of adjustment that can occur between
	// difficulty retargets.
	RetargetAdjustmentFactor int64

	// ReduceMinDifficulty defines whether the network should reduce the
	// minimum required difficulty after a long enough period of time has
	// passed without finding a block.  This is really only useful for test
	// networks and should not be set on a main network.
	ReduceMinDifficulty bool

	// MinDiffReductionTime is the amount of time after which the minimum
	// required difficulty should be reduced when a block hasn't been found.
	//
	// NOTE: This only applies if ReduceMinDifficulty is true.
	MinDiffReductionTime time.Duration

	// GenerateSupported specifies whether or not CPU mining is allowed.
	GenerateSupported bool

	// MaximumBlockSizes are the maximum sizes of a block that can be
	// generated on the network.  It is an array because the max block size
	// can be different values depending on the results of a voting agenda.
	// The first entry is the initial block size for the network, while the
	// other entries are potential block size changes which take effect when
	// the vote for the associated agenda succeeds.
	MaximumBlockSizes []int

	// MaxTxSize is the maximum number of bytes a serialized transaction can
	// be in order to be considered valid by consensus.
	MaxTxSize int

	// BaseSubsidy is the starting subsidy amount for mined blocks.
	BaseSubsidy int64

	// Subsidy reduction multiplier.
	MulSubsidy int64

	// Subsidy reduction divisor.
	DivSubsidy int64

	// SubsidyReductionInterval is the reduction interval in blocks.
	SubsidyReductionInterval int64

	// TargetTotalSubsidy is the target total subsidy.
	TargetTotalSubsidy int64

	// WorkRewardProportion is the comparative amount of the subsidy given for
	// creating a block.
	WorkRewardProportion uint16

	// StakeRewardProportion is the comparative amount of the subsidy given for
	// casting stake votes (collectively, per block).
	StakeRewardProportion uint16

	// BlockTaxProportion is the inverse of the percentage of funds for each
	// block to allocate to the developer organization.
	// e.g. 10% --> 10 (or 1 / (1/10))
	// Special case: disable taxes with a value of 0
	BlockTaxProportion uint16

	// It must be hourglass block.
	// Checkpoints ordered from oldest to newest.
	Checkpoints []Checkpoint

	// These fields are related to voting on consensus rule changes as
	// defined by BIP0009.
	//
	// RuleChangeActivationThreshold is the number of blocks in a threshold
	// state retarget window for which a positive vote for a rule change
	// must be cast in order to lock in a rule change. It should typically
	// be 95% for the main network and 75% for test networks.
	//
	// MinerConfirmationWindow is the number of blocks in each threshold
	// state retarget window.
	//
	// Deployments define the specific consensus rule changes to be voted
	// on.
	RuleChangeActivationThreshold uint32
	MinerConfirmationWindow       uint32
	Deployments                   []ConsensusDeployment

	// Mempool parameters
	RelayNonStdTxs bool

	// NetworkAddressPrefix is the first letter of the network
	// for any given address encoded as a string.
	NetworkAddressPrefix string

	// Address encoding magics
	PubKeyAddrID     [2]byte // First 2 bytes of a P2PK address
	PubKeyHashAddrID [2]byte // First 2 bytes of P2PKH address
	PKHEdwardsAddrID [2]byte // First 2 bytes of Edwards P2PKH address
	PKHSchnorrAddrID [2]byte // First 2 bytes of secp256k1 Schnorr P2PKH address

	ScriptHashAddrID [2]byte // First 2 bytes of a P2SH address
	PrivateKeyID     [2]byte // First 2 bytes of a WIF private key

	// BIP32 hierarchical deterministic extended key magics
	HDPrivateKeyID [4]byte
	HDPublicKeyID  [4]byte

	// BIP44 coin type used in the hierarchical deterministic path for
	// address generation.
	HDCoinType uint32

	// OrganizationPkScript is the output script for block taxes to be
	// distributed to in every block's coinbase. It should ideally be a P2SH
	// multisignature address.
	// TODO revisit the org-pkscript design
	OrganizationPkScript []byte

	// TokenAdminPkScript is the output script for token
	// It should ideally be a P2SH multisignature address.
	TokenAdminPkScript []byte

	// the output script for guard lock address
	GuardAddrPkScript []byte
	// the output script for honor lock address
	HonorAddrPkScript []byte

	// DAG
	BlockDelay    float64
	BlockRate     float64
	SecurityLevel float64

	LedgerParams ledger.LedgerParams

	CoinbaseConfig CoinbaseConfigs
}

Params defines a qitmeer network by its parameters. These parameters may be used by qitmeer applications to differentiate networks as well as addresses and keys for one network from those intended for use on another network.

func (*Params) HasTax added in v0.10.1

func (p *Params) HasTax() bool

has tax

func (*Params) TotalSubsidyProportions

func (p *Params) TotalSubsidyProportions() uint16

TotalSubsidyProportions is the sum of POW Reward, POS Reward, and Tax proportions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL