config

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2021 License: MIT Imports: 9 Imported by: 132

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// OriginIssuanceAmount is the origin issuance ELA amount.
	OriginIssuanceAmount = 3300 * 10000 * 100000000

	// AfterBurnIssuanceAmount is the new issurance ELA amount after cr proposal #1631.
	AfterBurnIssuanceAmount = 2000 * 10000 * 100000000

	// "ELANULLXXXXXXXXXXXXXXXXXXXXXYvs3rr"
	DestroyELAAddress = common.Uint168{
		0x21, 0x20, 0xfe, 0xe5, 0xd7, 0xeb, 0x3e,
		0x5c, 0x7d, 0x31, 0x97, 0xfe, 0xcf, 0x6c,
		0x0d, 0xe3, 0x0f, 0x88, 0x9a, 0xce, 0xf7,
	}

	// ELAAssetID represents the asset ID of ELA coin.
	ELAAssetID = elaAsset.Hash()

	// ELAPrecision represents the precision of ELA coin.
	ELAPrecision = byte(0x08)

	// CRAssetsAddress indicates the "CRASSETSXXXXXXXXXXXXXXXXXXXX2qDX5J"
	// CR assets address.
	CRAssetsAddress = common.Uint168{
		0x1c, 0x5f, 0x6c, 0x3e, 0x9f, 0x0c, 0x9a,
		0x71, 0x10, 0xb8, 0xeb, 0x6e, 0x37, 0x02,
		0x63, 0x0f, 0x71, 0x27, 0x4d, 0xf1, 0xc0,
	}

	// CRCExpensesAddress indicates the "CREXPENSESXXXXXXXXXXXXXXXXXX4UdT6b"
	// CRC council expenses address.
	CRCExpensesAddress = common.Uint168{
		0x1c, 0x60, 0x32, 0x09, 0xff, 0x5d, 0x86,
		0x54, 0x2d, 0x26, 0x1a, 0x8d, 0x22, 0x7f,
		0xe0, 0xf5, 0xee, 0x2c, 0x4e, 0xd2, 0xd3,
	}
)

These variables are the chain consensus parameters for each default network.

View Source
var DefaultParams = Params{
	Magic:       2017001,
	DefaultPort: 20338,

	DNSSeeds: []string{
		"node-mainnet-005.elastos.org:20338",
		"node-mainnet-010.elastos.org:20338",
		"node-mainnet-015.elastos.org:20338",
		"node-mainnet-020.elastos.org:20338",
		"node-mainnet-025.elastos.org:20338",
	},

	Foundation:        mainNetFoundation,
	CRCAddress:        mainNetCRCAddress,
	CRAssetsAddress:   CRAssetsAddress,
	CRExpensesAddress: CRCExpensesAddress,
	DestroyELAAddress: DestroyELAAddress,
	GenesisBlock:      GenesisBlock(&mainNetFoundation),

	DPoSMagic:       2019000,
	DPoSDefaultPort: 20339,
	OriginArbiters: []string{
		"0248df6705a909432be041e0baa25b8f648741018f70d1911f2ed28778db4b8fe4",
		"02771faf0f4d4235744b30972d5f2c470993920846c761e4d08889ecfdc061cddf",
		"0342196610e57d75ba3afa26e030092020aec56822104e465cba1d8f69f8d83c8e",
		"02fa3e0d14e0e93ca41c3c0f008679e417cf2adb6375dd4bbbee9ed8e8db606a56",
		"03ab3ecd1148b018d480224520917c6c3663a3631f198e3b25cf4c9c76786b7850",
	},
	CRCArbiters: []string{
		"02089d7e878171240ce0e3633d3ddc8b1128bc221f6b5f0d1551caa717c7493062",
		"0268214956b8421c0621d62cf2f0b20a02c2dc8c2cc89528aff9bd43b45ed34b9f",
		"03cce325c55057d2c8e3fb03fb5871794e73b85821e8d0f96a7e4510b4a922fad5",
		"02661637ae97c3af0580e1954ee80a7323973b256ca862cfcf01b4a18432670db4",
		"027d816821705e425415eb64a9704f25b4cd7eaca79616b0881fc92ac44ff8a46b",
		"02d4a8f5016ae22b1acdf8a2d72f6eb712932213804efd2ce30ca8d0b9b4295ac5",
		"029a4d8e4c99a1199f67a25d79724e14f8e6992a0c8b8acf102682bd8f500ce0c1",
		"02871b650700137defc5d34a11e56a4187f43e74bb078e147dd4048b8f3c81209f",
		"02fc66cba365f9957bcb2030e89a57fb3019c57ea057978756c1d46d40dfdd4df0",
		"03e3fe6124a4ea269224f5f43552250d627b4133cfd49d1f9e0283d0cd2fd209bc",
		"02b95b000f087a97e988c24331bf6769b4a75e4b7d5d2a38105092a3aa841be33b",
		"02a0aa9eac0e168f3474c2a0d04e50130833905740a5270e8a44d6c6e85cf6d98c",
	},
	SecretaryGeneral:            "02712da531804d1c38d159a901313239d2100dfb5b693d71a2f76b15dec3f8fc32",
	MaxProposalTrackingCount:    128,
	PowLimit:                    powLimit,
	PowLimitBits:                0x1f0008ff,
	TargetTimespan:              24 * time.Hour,
	TargetTimePerBlock:          2 * time.Minute,
	AdjustmentFactor:            4,
	RewardPerBlock:              rewardPerBlock(2 * time.Minute),
	CoinbaseMaturity:            100,
	MinTransactionFee:           100,
	MinCrossChainTxFee:          10000,
	CheckAddressHeight:          88812,
	VoteStartHeight:             290000,
	CRCOnlyDPOSHeight:           343400,
	PublicDPOSHeight:            402680,
	EnableActivateIllegalHeight: 439000,
	CRVotingStartHeight:         537670,
	CRCommitteeStartHeight:      658930,
	CRClaimDPOSNodeStartHeight:  751400,
	CRClaimDPOSNodePeriod:       720 * 14,
	CheckRewardHeight:           436812,
	VoteStatisticsHeight:        512881,
	RegisterCRByDIDHeight:       598000,
	ToleranceDuration:           5 * time.Second,
	MaxInactiveRounds:           720 * 2,
	InactivePenalty:             0,
	IllegalPenalty:              0,
	EmergencyInactivePenalty:    0,
	GeneralArbiters:             24,
	CandidateArbiters:           72,
	PreConnectOffset:            360,
	CRMemberCount:               12,
	CRVotingPeriod:              30 * 720,
	CRDutyPeriod:                365 * 720,
	CRDepositLockupBlocks:       2160,
	ProposalCRVotingPeriod:      7 * 720,
	ProposalPublicVotingPeriod:  7 * 720,
	CRAgreementCount:            8,
	VoterRejectPercentage:       10,
	CRCAppropriatePercentage:    10,
	MaxCommitteeProposalCount:   128,
	EnableUtxoDB:                true,
	EnableCORS:                  false,
	WalletPath:                  "keystore.dat",
	RPCServiceLevel:             ConfigurationPermitted.String(),
	NodeProfileStrategy:         Balanced.String(),
	MaxNodePerHost:              72,
	CkpManager: checkpoint.NewManager(&checkpoint.Config{
		EnableHistory:      true,
		HistoryStartHeight: uint32(0),
		NeedSave:           true,
	}),
	TxCacheVolume:                      100000,
	CheckVoteCRCountHeight:             658930,
	MaxCRAssetsAddressUTXOCount:        800,
	MinCRAssetsAddressUTXOCount:        720,
	CRAssetsRectifyTransactionHeight:   751400,
	CRCProposalWithdrawPayloadV1Height: 751400,
	CRCProposalV1Height:                751400,
	RectifyTxFee:                       10000,
	RealWithdrawSingleFee:              10000,
	NewP2PProtocolVersionHeight:        751400,
	ChangeCommitteeNewCRHeight:         932530,
	CustomIDProposalStartHeight:        932530,
	NoCRCDPOSNodeHeight:                932530,
	RevertToPOWStartHeight:             932530,
	RandomCandidatePeriod:              36 * 10,
	MaxInactiveRoundsOfRandomNode:      36 * 8,
	MaxReservedCustomIDLength:          255,
	CRCProposalDraftDataStartHeight:    1056600,
	DPOSNodeCrossChainHeight:           2000000,
	RevertToPOWNoBlockTime:             12 * 3600,
	StopConfirmBlockTime:               11 * 3600,
	HalvingRewardHeight:                1051200,
	HalvingRewardInterval:              1051200,
	NewELAIssuanceHeight:               919800,
	SmallCrossTransferThreshold:        100000000,
	ReturnDepositCoinFee:               100,
	NewCrossChainStartHeight:           1032840,
	ReturnCrossChainCoinStartHeight:    1032840,
	ProhibitTransferToDIDHeight:        1032840,
	DIDSideChainAddress:                "XKUh4GLhFJiqAMTF6HyWQrV9pK9HcGUdfJ",
}

DefaultParams defines the default network parameters.

Functions

func GenesisBlock added in v0.3.0

func GenesisBlock(foundation *common.Uint168) *types.Block

GenesisBlock creates a genesis block by the specified foundation address. The genesis block goes different because the foundation address in each network is different.

Types

type CRConfiguration added in v0.5.0

type CRConfiguration struct {
	MemberCount                        uint32         `json:"MemberCount"`
	VotingPeriod                       uint32         `json:"VotingPeriod"`
	DutyPeriod                         uint32         `json:"DutyPeriod"`
	DepositLockupBlocks                uint32         `json:"DepositLockupBlocks"`
	ProposalCRVotingPeriod             uint32         `json:"ProposalCRVotingPeriod"`
	ProposalPublicVotingPeriod         uint32         `json:"ProposalPublicVotingPeriod"`
	CRAgreementCount                   uint32         `json:"CRAgreementCount"`
	VoterRejectPercentage              float64        `json:"VoterRejectPercentage"`
	CRCAppropriatePercentage           float64        `json:"CRCAppropriatePercentage"`
	MaxCommitteeProposalCount          uint32         `json:"MaxCommitteeProposalCount"`
	SecretaryGeneral                   string         `json:"SecretaryGeneral"`
	MaxProposalTrackingCount           uint8          `json:"MaxProposalTrackingCount"`
	RegisterCRByDIDHeight              uint32         `json:"RegisterCRByDIDHeight"`
	MaxCRAssetsAddressUTXOCount        uint32         `json:"MaxCRAssetsAddressUTXOCount"`
	MinCRAssetsAddressUTXOCount        uint32         `json:"MinCRAssetsAddressUTXOCount"`
	CRAssetsRectifyTransactionHeight   uint32         `json:"CRAssetsRectifyTransactionHeight"`
	CRCProposalWithdrawPayloadV1Height uint32         `json:"CRCProposalWithdrawPayloadV1Height"`
	CRCProposalV1Height                uint32         `json:"CRCProposalV1Height"`
	CRCAddress                         string         `json:"CRCAddress"`
	CRAssetsAddress                    string         `json:"CRAssetsAddress"`
	CRExpensesAddress                  string         `json:"CRExpensesAddress"`
	CRVotingStartHeight                uint32         `json:"CRVotingStartHeight"`
	CRCommitteeStartHeight             uint32         `json:"CRCommitteeStartHeight"`
	CRClaimDPOSNodeStartHeight         uint32         `json:"CRClaimDPOSNodeStartHeight"`
	CRClaimDPOSNodePeriod              uint32         `json:"CRClaimDPOSNodePeriod"`
	RectifyTxFee                       common.Fixed64 `json:"RectifyTxFee"`
	RealWithdrawSingleFee              common.Fixed64 `json:"RealWithdrawSingleFee"`
	NewP2PProtocolVersionHeight        uint64         `json:"NewP2PProtocolVersionHeight"`
	ChangeCommitteeNewCRHeight         uint32         `json:"ChangeCommitteeNewCRHeight"`
	CRCProposalDraftDataStartHeight    uint32         `json:"CRCProposalDraftDataStartHeight"`
}

type Configuration

type Configuration struct {
	ActiveNet                       string            `json:"ActiveNet"`
	Magic                           uint32            `json:"Magic"`
	DNSSeeds                        []string          `json:"DNSSeeds"`
	DisableDNS                      bool              `json:"DisableDNS"`
	PermanentPeers                  []string          `json:"PermanentPeers"`
	HttpInfoPort                    uint16            `json:"HttpInfoPort"`
	HttpInfoStart                   bool              `json:"HttpInfoStart"`
	HttpRestPort                    int               `json:"HttpRestPort"`
	HttpRestStart                   bool              `json:"HttpRestStart"`
	HttpWsPort                      int               `json:"HttpWsPort"`
	HttpWsStart                     bool              `json:"HttpWsStart"`
	HttpJsonPort                    int               `json:"HttpJsonPort"`
	EnableRPC                       bool              `json:"EnableRPC"`
	NodePort                        uint16            `json:"NodePort"`
	PrintLevel                      uint32            `json:"PrintLevel"`
	MaxLogsSize                     int64             `json:"MaxLogsSize"`
	MaxPerLogSize                   int64             `json:"MaxPerLogSize"`
	RestCertPath                    string            `json:"RestCertPath"`
	RestKeyPath                     string            `json:"RestKeyPath"`
	MinCrossChainTxFee              common.Fixed64    `json:"MinCrossChainTxFee"`
	FoundationAddress               string            `json:"FoundationAddress"`
	DIDSideChainAddress             string            `json:"DIDSideChainAddress"`
	ProhibitTransferToDIDHeight     uint32            `json:"ProhibitTransferToDIDHeight"`
	PowConfiguration                PowConfiguration  `json:"PowConfiguration"`
	RpcConfiguration                RpcConfiguration  `json:"RpcConfiguration"`
	DPoSConfiguration               DPoSConfiguration `json:"DPoSConfiguration"`
	CRConfiguration                 CRConfiguration   `json:"CRConfiguration"`
	CheckAddressHeight              uint32            `json:"CheckAddressHeight"`
	VoteStartHeight                 uint32            `json:"VoteStartHeight"`
	CRCOnlyDPOSHeight               uint32            `json:"CRCOnlyDPOSHeight"`
	PublicDPOSHeight                uint32            `json:"PublicDPOSHeight"`
	EnableActivateIllegalHeight     uint32            `json:"EnableActivateIllegalHeight"`
	CheckRewardHeight               uint32            `json:"CheckRewardHeight"`
	VoteStatisticsHeight            uint32            `json:"VoteStatisticsHeight"`
	ProfilePort                     uint32            `json:"ProfilePort"`
	MaxBlockSize                    uint32            `json:"MaxBlockSize"`
	MaxBlockHeaderSize              uint32            `json:"MaxBlockHeaderSize"`
	MaxTxPerBlock                   uint32            `json:"MaxTxPerBlock"`
	EnableUtxoDB                    bool              `json:"EnableUtxoDB"`
	EnableCORS                      bool              `json:"EnableCORS"`
	WalletPath                      string            `json:"WalletPath"`
	RPCServiceLevel                 string            `json:"RPCServiceLevel"`
	NodeProfileStrategy             string            `json:"NodeProfileStrategy"`
	TxCacheVolume                   uint32            `json:"TxCacheVolume"`
	MaxNodePerHost                  uint32            `json:"MaxNodePerHost"`
	CustomIDProposalStartHeight     uint32            `json:"CustomIDProposalStartHeight"`
	MaxReservedCustomIDLength       uint32            `json:"MaxReservedCustomIDLength"`
	HalvingRewardHeight             uint32            `json:"HalvingRewardHeight"`
	HalvingRewardInterval           uint32            `json:"HalvingRewardInterval"`
	NewELAIssuanceHeight            uint32            `json:"NewELAIssuanceHeight"`
	SmallCrossTransferThreshold     common.Fixed64    `json:"SmallCrossTransferThreshold"`
	ReturnDepositCoinFee            common.Fixed64    `json:"ReturnDepositCoinFee"`
	NewCrossChainStartHeight        uint32            `json:"NewCrossChainStartHeight"`
	ReturnCrossChainCoinStartHeight uint32            `json:"ReturnCrossChainCoinStartHeight"`
}

Configuration defines the configurable parameters to run a ELA node.

var (
	Parameters *Configuration
)

type DPoSConfiguration added in v0.3.2

type DPoSConfiguration struct {
	EnableArbiter                 bool           `json:"EnableArbiter"`
	Magic                         uint32         `json:"Magic"`
	IPAddress                     string         `json:"IPAddress"`
	DPoSPort                      uint16         `json:"DPoSPort"`
	SignTolerance                 time.Duration  `json:"SignTolerance"`
	OriginArbiters                []string       `json:"OriginArbiters"`
	CRCArbiters                   []string       `json:"CRCArbiters"`
	NormalArbitratorsCount        int            `json:"NormalArbitratorsCount"`
	CandidatesCount               int            `json:"CandidatesCount"`
	EmergencyInactivePenalty      common.Fixed64 `json:"EmergencyInactivePenalty"`
	MaxInactiveRounds             uint32         `json:"MaxInactiveRounds"`
	InactivePenalty               common.Fixed64 `json:"InactivePenalty"`
	IllegalPenalty                common.Fixed64 `json:"IllegalPenalty"`
	PreConnectOffset              uint32         `json:"PreConnectOffset"`
	NoCRCDPOSNodeHeight           uint32         `json:"NoCRCDPOSNodeHeight"`
	RandomCandidatePeriod         uint32         `json:"RandomCandidatePeriod"`
	MaxInactiveRoundsOfRandomNode uint32         `json:"MaxInactiveRoundsOfRandomNode"`
	DPOSNodeCrossChainHeight      uint32         `json:"DPOSNodeCrossChainHeight"`
	RevertToPOWNoBlockTime        int64          `json:"RevertToPOWNoBlockTime"`
	StopConfirmBlockTime          int64          `json:"StopConfirmBlockTime"`
	RevertToPOWStartHeight        uint32         `json:"RevertToPOWStartHeight"`
}

DPoSConfiguration defines the DPoS consensus parameters.

type NodeProfileStrategy added in v0.5.0

type NodeProfileStrategy byte
const (
	// Node will balance usage of CPU and memory.
	Balanced NodeProfileStrategy = iota

	// Node will optimise the block processing procedure, super node strongly
	//	recommended.
	SpeedFirst

	// Node will optimise the usage of memory usage, note this may slow down
	//	block processing, do no use this if your memory is extremely low (
	//	specifically small than 2G bytes).
	MemoryFirst
)

func (NodeProfileStrategy) String added in v0.5.0

func (s NodeProfileStrategy) String() string

type Params added in v0.3.0

type Params struct {
	// Magic defines the magic number of the peer-to-peer network.
	Magic uint32

	// DefaultPort defines the default peer-to-peer port for the network.
	DefaultPort uint16

	// PrintLevel defines the level to print log.
	PrintLevel uint32

	// DNSSeeds defines a list of DNS seeds for the network to discover peers.
	DNSSeeds []string

	// The interface/port to listen for connections.
	ListenAddrs []string

	// PermanentPeers defines peers seeds for node to initialize p2p connection.
	PermanentPeers []string

	// Foundation defines the foundation address which receiving mining
	// rewards.
	Foundation common.Uint168

	// CRCAddress defines the CRC address which receiving mining rewards.
	CRCAddress common.Uint168

	// CRAssetsAddress defines the CR assets address address.
	CRAssetsAddress common.Uint168

	// CRExpensesAddress defines the CR committee address which receiving
	// appropriation from CR assets address.
	CRExpensesAddress common.Uint168

	// DestroyELAAddress defines address which receiving destroyed ELA.
	DestroyELAAddress common.Uint168

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

	// PowLimit defines the highest allowed proof of work value for a block
	// as a uint256.
	PowLimit *big.Int

	// PowLimitBits defines the highest allowed proof of work value for a
	// block in compact form.
	PowLimitBits uint32

	// 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

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

	// RewardPerBlock is the reward amount per block.
	RewardPerBlock common.Fixed64

	// NewRewardPerBlock is the reward amount per block.
	NewRewardPerBlock common.Fixed64

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

	// Disable transaction filter supports, include bloom filter tx type filter
	// etc.
	DisableTxFilters bool

	// MinTransactionFee defines the minimum fee of a transaction.
	MinTransactionFee common.Fixed64

	// MinCrossChainTxFee defines the min fee of cross chain transaction
	MinCrossChainTxFee common.Fixed64

	// OriginArbiters defines the original arbiters producing the block.
	OriginArbiters []string

	// CheckAddressHeight defines the height begin to check output hash.
	CheckAddressHeight uint32

	// VoteStartHeight indicates the height of starting register producer and
	// vote related.
	VoteStartHeight uint32

	// CRCOnlyDPOSHeight (H1) indicates the height of DPOS consensus begins with
	// only CRC producers participate in producing blocks.
	CRCOnlyDPOSHeight uint32

	// PublicDPOSHeight (H2) indicates the height when public registered and
	// elected producers participate in DPOS consensus.
	PublicDPOSHeight uint32

	// NoCRCDPOSNodeHeight indicates the height when there is no DPOS node of CRC.
	NoCRCDPOSNodeHeight uint32

	// CRVotingStartHeight defines the height of CR voting started.
	CRVotingStartHeight uint32

	// NewCrossChainStartHeight defines the height of new cross chain transaction started.
	NewCrossChainStartHeight uint32

	// CRCommitteeStartHeight defines the height of CR Committee started.
	CRCommitteeStartHeight uint32

	// CRClaimDPOSNodeStartHeight defines the height of CR claim DPOS node started.
	CRClaimDPOSNodeStartHeight uint32

	// CRClaimDPOSNodePeriod defines the period of CR claim DPOS node.
	CRClaimDPOSNodePeriod uint32

	// PublicDPOSHeight defines the start height to enable activate illegal
	// producer though activate tx.
	EnableActivateIllegalHeight uint32

	// CheckRewardHeight defines the height to check reward in coin base
	// with new check function.
	CheckRewardHeight uint32

	// VoteStatisticsHeight defines the height to deal with block with vote
	// statistics error.
	VoteStatisticsHeight uint32

	// RegisterCRByDIDHeight defines the height to support register and update
	// CR by CID and CID.
	RegisterCRByDIDHeight uint32

	//Prohibit transfers to did height
	ProhibitTransferToDIDHeight uint32

	//did side chain address
	DIDSideChainAddress string

	// CRCArbiters defines the fixed CRC arbiters producing the block.
	CRCArbiters []string

	// DPoSMagic defines the magic number used in the DPoS network.
	DPoSMagic uint32

	// DPoSIPAddress defines the IP address for the DPoS network.
	DPoSIPAddress string

	// DPoSDefaultPort defines the default port for the DPoS network.
	DPoSDefaultPort uint16

	// PreConnectOffset defines the offset blocks to pre-connect to the block
	// producers.
	PreConnectOffset uint32

	// GeneralArbiters defines the number of general(no-CRC) arbiters.
	GeneralArbiters int

	// CandidateArbiters defines the number of needed candidate arbiters.
	CandidateArbiters int

	// ToleranceDuration defines the tolerance duration of the DPoS consensus.
	ToleranceDuration time.Duration

	// MaxInactiveRounds defines the maximum inactive rounds before producer
	// takes penalty.
	MaxInactiveRounds uint32

	// MaxInactiveRoundsOfRandomNode defines the maximum inactive rounds before
	// the producer at random takes penalty.
	MaxInactiveRoundsOfRandomNode uint32

	// DPOSNodeCrossChainHeight defines the height at which not only CR members
	// are responsible for working across the chain.
	DPOSNodeCrossChainHeight uint32

	// InactivePenalty defines the penalty amount the producer takes.
	InactivePenalty common.Fixed64

	// InactivePenalty defines the penalty amount the producer takes.
	IllegalPenalty common.Fixed64

	// EmergencyInactivePenalty defines the penalty amount the emergency
	// producer takes.
	EmergencyInactivePenalty common.Fixed64

	// CRMemberCount defines the number of CR committee members
	CRMemberCount uint32

	// CRVotingPeriod defines the duration of voting period which measured by
	// block height
	CRVotingPeriod uint32

	// CRDutyPeriod defines the duration of a normal duty period which
	// measured by block height
	CRDutyPeriod uint32

	// DepositLockupBlocks indicates how many blocks need to wait when cancel
	// producer or CRC was triggered, and can submit return deposit coin request
	CRDepositLockupBlocks uint32

	// ProposalCRVotingPeriod defines the duration of CR voting about a proposal
	ProposalCRVotingPeriod uint32

	// ProposalPublicVotingPeriod defines the duration of all voters send
	// reject vote about a proposal
	ProposalPublicVotingPeriod uint32

	// CRAgreementCount defines minimum count to let a registered proposal
	// transfer to CRAgreed state.
	CRAgreementCount uint32

	// VoterRejectPercentage defines percentage about voters reject a proposal.
	VoterRejectPercentage float64

	// CRCAppropriatePercentage defines percentage about CRC appropriation.
	CRCAppropriatePercentage float64

	//MaxCommitteeProposalCount defines per committee max proposal count
	MaxCommitteeProposalCount uint32

	// SecretaryGeneral defines the secretary general of CR by public key.
	SecretaryGeneral string

	// MaxProposalTrackingCount defines the max count of CRC proposal tracking
	// transaction.
	MaxProposalTrackingCount uint8

	// CkpManager holds checkpoints save automatically.
	CkpManager *checkpoint.Manager

	// EnableUtxoDB indicate whether to enable utxo database.
	EnableUtxoDB bool

	// Enable cors for http server.
	EnableCORS bool

	// WalletPath defines the wallet path used by DPoS arbiters and CR members.
	WalletPath string

	// RPCServiceLevel defines level of service provide to client.
	RPCServiceLevel string

	// NodeProfileStrategy defines strategy about node profiling.
	NodeProfileStrategy string

	// TxCacheVolume defines the default volume of the transaction cache.
	TxCacheVolume uint32

	//MaxNodePerHost defines max nodes that one host can establish.
	MaxNodePerHost uint32

	// CheckVoteCRCountHeight defines the height to check count of vote CR.
	CheckVoteCRCountHeight uint32

	// MaxCRAssetsAddressUTXOCount defines the max UTXOs count of CRFoundation
	// address.
	MaxCRAssetsAddressUTXOCount uint32

	// MinCRAssetsAddressUTXOCount defines the min UTXOs count of CRFoundation
	// address.
	MinCRAssetsAddressUTXOCount uint32

	// CRAssetsRectifyTransactionHeight defines the CR rectify transaction start height
	CRAssetsRectifyTransactionHeight uint32

	// CRCProposalWithdrawPayloadV1Height defines the CRC proposal withdraw payload height
	CRCProposalWithdrawPayloadV1Height uint32

	// CRCProposalV1Height defines the height to support ChangeProposalOwner,
	// CloseProposal and SecretaryGeneral proposal.
	CRCProposalV1Height uint32

	// RectifyTxFee defines the fee of cr rectify transaction.
	RectifyTxFee common.Fixed64

	// RealWithdrawSingleFee defines the single fee of cr real proposal withdraw transaction.
	RealWithdrawSingleFee common.Fixed64

	// NewP2PProtocolVersionHeight defines the new p2p protocol version message height.
	NewP2PProtocolVersionHeight uint64

	// ChangeCommitteeNewCRHeight defines the new arbiter logic after change committee.
	ChangeCommitteeNewCRHeight uint32

	// CRCProposalDraftDataStartHeight defines the proposal draft data start height.
	CRCProposalDraftDataStartHeight uint32

	// CustomIDProposalStartHeight defines the height to allow custom ID related transaction.
	CustomIDProposalStartHeight uint32

	// RandomCandidatePeriod defines the period to get a candidate as DPOS node at random.
	RandomCandidatePeriod uint32

	// MaxReservedCustomIDLength defines the max length of reserved custom id.
	MaxReservedCustomIDLength uint32

	// RevertToPOWInterval defines how long time does it take to revert to POW mode.
	RevertToPOWNoBlockTime int64

	// StopConfirmBlockTime defines how long time dose it take before stop confirm block.
	StopConfirmBlockTime int64

	// RevertToPOWStartHeight defines the start height to allow to revert to POW mode.
	RevertToPOWStartHeight uint32

	// HalvingRewardHeight represents the height of halving reward
	HalvingRewardHeight uint32

	// HalvingRewardInterval represents the interval of halving reward
	HalvingRewardInterval uint32

	// NewELAIssuanceHeight represents the new issuance ELA amount after proposal #1631
	NewELAIssuanceHeight uint32

	// SMALLCrossTransferThreshold indicates the minimum amount consider as Small transfer
	SmallCrossTransferThreshold common.Fixed64

	// ReturnDepositCoinFee indicates the fee the
	ReturnDepositCoinFee common.Fixed64

	// ReturnCrossChainCoinStartHeight indeicates the start height of
	// ReturnCroossChainDepositCoin transaction
	ReturnCrossChainCoinStartHeight uint32
}

func (*Params) GetBlockReward added in v0.7.0

func (p *Params) GetBlockReward(height uint32) (rewardPerBlock common.Fixed64)

func (*Params) InstantBlock added in v0.3.0

func (p *Params) InstantBlock() *Params

InstantBlock returns the network parameters for generate instant block.

func (*Params) RegNet added in v0.3.0

func (p *Params) RegNet() *Params

RegNet returns the network parameters for the test network.

func (*Params) TestNet added in v0.3.0

func (p *Params) TestNet() *Params

TestNet returns the network parameters for the test network.

type PowConfiguration

type PowConfiguration struct {
	PayToAddr    string `json:"PayToAddr"`
	AutoMining   bool   `json:"AutoMining"`
	MinerInfo    string `json:"MinerInfo"`
	MinTxFee     int    `json:"MinTxFee"`
	InstantBlock bool   `json:"InstantBlock"`
}

PowConfiguration defines the Proof-of-Work parameters.

type RPCServiceLevel added in v0.5.0

type RPCServiceLevel byte
const (
	// Allowed  query transaction, and configuration related options.
	ConfigurationPermitted RPCServiceLevel = iota

	// Allowed mining from RPC.
	MiningPermitted

	// Allowed query and transaction (
	//	such as sendrawtransaction) related options.
	TransactionPermitted

	// Allowed using wallet related function.
	WalletPermitted

	// Allowed only query related options.
	QueryOnly
)

func RPCServiceLevelFromString added in v0.5.0

func RPCServiceLevelFromString(str string) RPCServiceLevel

func (RPCServiceLevel) String added in v0.5.0

func (l RPCServiceLevel) String() string

type RpcConfiguration added in v0.2.2

type RpcConfiguration struct {
	User        string   `json:"User"`
	Pass        string   `json:"Pass"`
	WhiteIPList []string `json:"WhiteIPList"`
}

RpcConfiguration defines the JSON-RPC authenticate parameters.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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