config

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Parameters ConfigParams

	MainNet = ChainParams{
		Name:               "MainNet",
		PowLimit:           powLimit,
		PowLimitBits:       0x1f0008ff,
		TargetTimePerBlock: time.Minute * 2,
		TargetTimespan:     time.Minute * 2 * 720,
		AdjustmentFactor:   int64(4),
		MaxOrphanBlocks:    10000,
		MinMemoryNodes:     20160,
		CoinbaseLockTime:   100,
		RewardPerBlock:     rewardPerBlock(time.Minute * 2),
	}

	TestNet = ChainParams{
		Name:               "TestNet",
		PowLimit:           powLimit,
		PowLimitBits:       0x1f0008ff,
		TargetTimePerBlock: time.Minute * 2,
		TargetTimespan:     time.Minute * 2 * 720,
		AdjustmentFactor:   int64(4),
		MaxOrphanBlocks:    10000,
		MinMemoryNodes:     20160,
		CoinbaseLockTime:   100,
		RewardPerBlock:     rewardPerBlock(time.Minute * 2),
	}

	RegNet = ChainParams{
		Name:               "RegNet",
		PowLimit:           powLimit,
		PowLimitBits:       0x1f0008ff,
		TargetTimePerBlock: time.Minute * 2,
		TargetTimespan:     time.Second * 2 * 720,
		AdjustmentFactor:   int64(4),
		MaxOrphanBlocks:    10000,
		MinMemoryNodes:     20160,
		CoinbaseLockTime:   100,
		RewardPerBlock:     rewardPerBlock(time.Minute * 2),
	}
)
View Source
var DefaultParams = Params{
	Magic:       2017001,
	DefaultPort: 20338,

	SeedList: []string{
		"node-mainnet-002.elastos.org:20338",
		"node-mainnet-003.elastos.org:20338",
		"node-mainnet-004.elastos.org:20338",
		"node-mainnet-006.elastos.org:20338",
		"node-mainnet-007.elastos.org:20338",
		"node-mainnet-014.elastos.org:20338",
		"node-mainnet-015.elastos.org:20338",
		"node-mainnet-016.elastos.org:20338",
		"node-mainnet-017.elastos.org:20338",
		"node-mainnet-022.elastos.org:20338",
		"node-mainnet-021.elastos.org:20338",
		"node-mainnet-023.elastos.org:20338",
	},

	Foundation:   mainNetFoundation,
	GenesisBlock: GenesisBlock(&mainNetFoundation),
	OriginArbiters: []string{
		"0248df6705a909432be041e0baa25b8f648741018f70d1911f2ed28778db4b8fe4",
		"02771faf0f4d4235744b30972d5f2c470993920846c761e4d08889ecfdc061cddf",
		"0342196610e57d75ba3afa26e030092020aec56822104e465cba1d8f69f8d83c8e",
		"02fa3e0d14e0e93ca41c3c0f008679e417cf2adb6375dd4bbbee9ed8e8db606a56",
		"03ab3ecd1148b018d480224520917c6c3663a3631f198e3b25cf4c9c76786b7850",
	},
	CRCArbiters: []CRCArbiter{
		{"02089d7e878171240ce0e3633d3ddc8b1128bc221f6b5f0d1551caa717c7493062", "127.0.0.1"},
		{"0268214956b8421c0621d62cf2f0b20a02c2dc8c2cc89528aff9bd43b45ed34b9f", "127.0.0.1"},
		{"03cce325c55057d2c8e3fb03fb5871794e73b85821e8d0f96a7e4510b4a922fad5", "127.0.0.1"},
		{"02661637ae97c3af0580e1954ee80a7323973b256ca862cfcf01b4a18432670db4", "127.0.0.1"},
		{"027d816821705e425415eb64a9704f25b4cd7eaca79616b0881fc92ac44ff8a46b", "127.0.0.1"},
		{"02d4a8f5016ae22b1acdf8a2d72f6eb712932213804efd2ce30ca8d0b9b4295ac5", "127.0.0.1"},
		{"029a4d8e4c99a1199f67a25d79724e14f8e6992a0c8b8acf102682bd8f500ce0c1", "127.0.0.1"},
		{"02871b650700137defc5d34a11e56a4187f43e74bb078e147dd4048b8f3c81209f", "127.0.0.1"},
		{"02fc66cba365f9957bcb2030e89a57fb3019c57ea057978756c1d46d40dfdd4df0", "127.0.0.1"},
		{"03e3fe6124a4ea269224f5f43552250d627b4133cfd49d1f9e0283d0cd2fd209bc", "127.0.0.1"},
		{"02b95b000f087a97e988c24331bf6769b4a75e4b7d5d2a38105092a3aa841be33b", "127.0.0.1"},
		{"02a0aa9eac0e168f3474c2a0d04e50130833905740a5270e8a44d6c6e85cf6d98c", "127.0.0.1"},
	},
	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:         1108812,
	MaxInactiveRounds:        720 * 2,
	InactivePenalty:          100 * 100000000,
	EmergencyInactivePenalty: 500 * 100000000,
	InactiveEliminateCount:   12,
	GeneralArbiters:          24,
	CandidateArbiters:        72,
	PreConnectOffset:         360,
}

DefaultParams defines the default network parameters.

View Source
var (
	ELAAssetID = elaAsset.Hash()
)
View Source
var Template = Configuration{
	Magic:              7630401,
	Version:            23,
	SeedList:           []string{"127.0.0.1:30338"},
	HttpInfoPort:       20333,
	HttpRestPort:       20334,
	HttpWsPort:         20335,
	HttpJsonPort:       20336,
	NodePort:           20338,
	PrintLevel:         0,
	MaxLogsSize:        0,
	MaxPerLogSize:      0,
	MinCrossChainTxFee: 10000,
	PowConfiguration: PowConfiguration{
		PayToAddr:  "8VYXVxKKSAxkmRrfmGpQR2Kc66XhG6m3ta",
		AutoMining: false,
		MinerInfo:  "ELA",
		MinTxFee:   100,
	},
	EnableArbiter: false,
	ArbiterConfiguration: ArbiterConfiguration{
		PublicKey:                "023a133480176214f88848c6eaa684a54b316849df2b8570b57f3a917f19bbc77a",
		Magic:                    7630403,
		NodePort:                 30338,
		ProtocolVersion:          0,
		Services:                 0,
		PrintLevel:               1,
		SignTolerance:            5,
		MaxLogsSize:              0,
		MaxPerLogSize:            0,
		NormalArbitratorsCount:   5,
		CandidatesCount:          0,
		EmergencyInactivePenalty: 500 * 100000000,
		MaxInactiveRounds:        720 * 2,
		InactivePenalty:          100 * 100000000,
		InactiveEliminateCount:   12,
		EnableEventRecord:        false,
		PreConnectOffset:         360,
	},
	RpcConfiguration: RpcConfiguration{
		User:        "",
		Pass:        "",
		WhiteIPList: []string{"127.0.0.1"},
	},
	CheckAddressHeight: 88812,
	VoteStartHeight:    88812,
	CRCOnlyDPOSHeight:  1008812,
	PublicDPOSHeight:   1108812,
}

Functions

func GenesisBlock added in v0.3.0

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

Types

type ArbiterConfiguration added in v0.2.2

type ArbiterConfiguration struct {
	PublicKey                string         `json:"PublicKey"`
	Magic                    uint32         `json:"Magic"`
	NodePort                 uint16         `json:"NodePort"`
	ProtocolVersion          uint32         `json:"ProtocolVersion"`
	Services                 uint64         `json:"Services"`
	PrintLevel               uint8          `json:"PrintLevel"`
	SignTolerance            uint64         `json:"SignTolerance"`
	MaxLogsSize              int64          `json:"MaxLogsSize"`
	MaxPerLogSize            int64          `json:"MaxPerLogSize"`
	OriginArbiters           []string       `json:"OriginArbiters"`
	CRCArbiters              []CRCArbiter   `json:"CRCArbiters"`
	NormalArbitratorsCount   int            `json:"NormalArbitratorsCount"`
	CandidatesCount          int            `json:"CandidatesCount"`
	EmergencyInactivePenalty common.Fixed64 `json:"EmergencyInactivePenalty"`
	MaxInactiveRounds        uint32         `json:"MaxInactiveRounds"`
	InactivePenalty          common.Fixed64 `json:"InactivePenalty"`
	InactiveEliminateCount   uint32         `json:"InactiveEliminateCount"`
	EnableEventRecord        bool           `json:"EnableEventRecord"`
	PreConnectOffset         uint32         `json:"PreConnectOffset"`
}

type CRCArbiter added in v0.3.0

type CRCArbiter struct {
	PublicKey  string `json:"PublicKey"`
	NetAddress string `json:"NetAddress"`
}

CRCArbitratorParam defines parameters about arbitrators consensus and direct connection

type ChainParams

type ChainParams struct {
	Name               string
	PowLimit           *big.Int
	PowLimitBits       uint32
	TargetTimePerBlock time.Duration
	TargetTimespan     time.Duration
	AdjustmentFactor   int64
	MaxOrphanBlocks    int
	MinMemoryNodes     uint32
	CoinbaseLockTime   uint32
	RewardPerBlock     common.Fixed64
}

type ConfigFile

type ConfigFile struct {
	Configuration `json:"Configuration"`
}

type ConfigParams added in v0.3.0

type ConfigParams struct {
	*Configuration
	ChainParam *ChainParams
}

type Configuration

type Configuration struct {
	ActiveNet            string               `json:"ActiveNet"`
	Magic                uint32               `json:"Magic"`
	Version              int                  `json:"Version"`
	SeedList             []string             `json:"SeedList"`
	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"`
	NodePort             uint16               `json:"NodePort"`
	PrintLevel           uint8                `json:"PrintLevel"`
	MaxLogsSize          int64                `json:"MaxLogsSize"`
	MaxPerLogSize        int64                `json:"MaxPerLogSize"`
	RestCertPath         string               `json:"RestCertPath"`
	RestKeyPath          string               `json:"RestKeyPath"`
	MinCrossChainTxFee   int                  `json:"MinCrossChainTxFee"`
	FoundationAddress    string               `json:"FoundationAddress"`
	PowConfiguration     PowConfiguration     `json:"PowConfiguration"`
	RpcConfiguration     RpcConfiguration     `json:"RpcConfiguration"`
	EnableArbiter        bool                 `json:"EnableArbiter"`
	ArbiterConfiguration ArbiterConfiguration `json:"ArbiterConfiguration"`
	CheckAddressHeight   uint32               `json:"CheckAddressHeight"`
	VoteStartHeight      uint32               `json:"VoteStartHeight"`
	CRCOnlyDPOSHeight    uint32               `json:"CRCOnlyDPOSHeight"`
	PublicDPOSHeight     uint32               `json:"PublicDPOSHeight"`
}

func (*Configuration) GetArbiterID added in v0.2.2

func (config *Configuration) GetArbiterID() []byte

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

	// SeedList defines a list of seed peers.
	SeedList []string

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

	// Foundation defines the foundation address which receiving mining
	// rewards.
	Foundation 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

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

	// MinCrossChainTxFee defines the min fee of cross chain transaction
	MinCrossChainTxFee int

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

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

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

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

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

	// InactiveEliminateCount defines arbitrators count should be eliminated
	InactiveEliminateCount uint32

	// EmergencyInactivePenalty defines the penalty amount the emergency
	// producer takes.
	EmergencyInactivePenalty 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"`
}

type RpcConfiguration added in v0.2.2

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

type Seed added in v0.2.2

type Seed struct {
	PublicKey string `json:"PublicKey"`
	Address   string `json:"Address"`
}

Jump to

Keyboard shortcuts

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