config

package
v1.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CONFIG_FILE_NAME = "./config.json"
	DEFAULT_WALLET_FILE_NAME = "./wallet.dat"
	MIN_GEN_BLOCK_TIME       = 2
	DEFAULT_GEN_BLOCK_TIME   = 6
	DBFT_MIN_NODE_NUM        = 4 //min node number of dbft consensus
	SOLO_MIN_NODE_NUM        = 1 //min node number of solo consensus
	VBFT_MIN_NODE_NUM        = 4 //min node number of vbft consensus

	CONSENSUS_TYPE_DBFT = "dbft"
	CONSENSUS_TYPE_SOLO = "solo"
	CONSENSUS_TYPE_VBFT = "vbft"

	DEFAULT_LOG_LEVEL                       = log.InfoLog
	DEFAULT_MAX_LOG_SIZE                    = 100 //MByte
	DEFAULT_NODE_PORT                       = uint(20338)
	DEFAULT_CONSENSUS_PORT                  = uint(20339)
	DEFAULT_RPC_PORT                        = uint(20336)
	DEFAULT_RPC_LOCAL_PORT                  = uint(20337)
	DEFAULT_REST_PORT                       = uint(20334)
	DEFAULT_WS_PORT                         = uint(20335)
	DEFAULT_REST_MAX_CONN                   = uint(1024)
	DEFAULT_MAX_CONN_IN_BOUND               = uint(1024)
	DEFAULT_MAX_CONN_OUT_BOUND              = uint(1024)
	DEFAULT_MAX_CONN_IN_BOUND_FOR_SINGLE_IP = uint(16)
	DEFAULT_HTTP_INFO_PORT                  = uint(0)
	DEFAULT_MAX_TX_IN_BLOCK                 = 60000
	DEFAULT_MAX_SYNC_HEADER                 = 500
	DEFAULT_ENABLE_CONSENSUS                = true
	DEFAULT_ENABLE_EVENT_LOG                = true
	DEFAULT_CLI_RPC_PORT                    = uint(20000)
	DEFUALT_CLI_RPC_ADDRESS                 = "127.0.0.1"
	DEFAULT_GAS_LIMIT                       = 20000
	DEFAULT_GAS_PRICE                       = 500

	DEFAULT_DATA_DIR      = "./Chain"
	DEFAULT_RESERVED_FILE = "./peers.rsv"
)
View Source
const (
	NETWORK_ID_MAIN_NET   = 1
	NETWORK_ID_TEST_NET   = 2
	NETWORK_ID_SOLO_NET   = 3
	NETWORK_NAME_MAIN_NET = "main"
	NETWORK_NAME_TEST_NET = "test"
	NETWORK_NAME_SOLO_NET = "testmode"
	MAINNET_CHAIN_ID      = 0
	TESTNET_CHAIN_ID      = common.MAX_INT64
)

Variables

View Source
var DefConfig = NewOntologyConfig()
View Source
var (
	EXTRA_INFO_HEIGHT_FORK_CHECK bool
)
View Source
var MainNetConfig = &GenesisConfig{
	SeedList: []string{
		"seed.poly.network:20338",
		"poly.ont.io:20338",
		"poly.ngd.network:20338",
		"poly-1.switcheo.network:20338"},
	ConsensusType: CONSENSUS_TYPE_VBFT,
	VBFT: &VBFTConfig{
		BlockMsgDelay:        10000,
		HashMsgDelay:         10000,
		PeerHandshakeTimeout: 10,
		MaxBlockChangeView:   60000,
		VrfValue:             "1c9810aa9822e511d5804a9c4db9dd08497c31087b0daafa34d768a3253441fa20515e2f30f81741102af0ca3cefc4818fef16adb825fbaa8cad78647f3afb590e",
		VrfProof:             "c57741f934042cb8d8b087b44b161db56fc3ffd4ffb675d36cd09f83935be853d8729f3f5298d12d6fd28d45dde515a4b9d7f67682d182ba5118abf451ff1988",
		Peers: []*VBFTPeerInfo{
			{
				Index:      1,
				PeerPubkey: "12050309c6475ce07577ab72a1f96c263e5030cb53a843b00ca1238a093d9dcb183e2f",
				Address:    "ARJrYgcF36uhE2RwDrxucXMrCWuTWWd77x",
			},
			{
				Index:      2,
				PeerPubkey: "1205032bed55e8c4d9cbc50657ff5909ee51dc394a92aad911c36bace83c4d63540794",
				Address:    "AeMwacPLLSSuUyDcwiqFMLRhbmmWmYQxn1",
			},
			{
				Index:      3,
				PeerPubkey: "120502e68a6e54bdfa0af47bd18465f4352f5151dc729c61a7399909f1cd1c6d816c02",
				Address:    "APDrR6TBQ6bN6AL9QVdXadNo9inqhoy3sp",
			},
			{
				Index:      4,
				PeerPubkey: "12050229e0d1c5b2ae838930ae1ad861ddd3d0745d1c7f142492cabd02b291d2c95c1d",
				Address:    "AZc4tbS4Q2p74jxMYqFGXB6Ky4Ap7gxE7Z",
			},
		},
	},
	DBFT: &DBFTConfig{},
	SOLO: &SOLOConfig{},
}
View Source
var PolarisConfig = &GenesisConfig{
	SeedList: []string{
		"beta1.poly.network:20338",
		"beta2.poly.network:20338",
		"beta3.poly.network:20338",
		"beta4.poly.network:20338",
		"beta5.poly.network:20338",
		"beta6.poly.network:20338",
		"beta7.poly.network:20338"},
	ConsensusType: CONSENSUS_TYPE_VBFT,
	VBFT: &VBFTConfig{
		BlockMsgDelay:        10000,
		HashMsgDelay:         10000,
		PeerHandshakeTimeout: 10,
		MaxBlockChangeView:   60000,
		VrfValue:             "1c9810aa9822e511d5804a9c4db9dd08497c31087b0daafa34d768a3253441fa20515e2f30f81741102af0ca3cefc4818fef16adb825fbaa8cad78647f3afb590e",
		VrfProof:             "c57741f934042cb8d8b087b44b161db56fc3ffd4ffb675d36cd09f83935be853d8729f3f5298d12d6fd28d45dde515a4b9d7f67682d182ba5118abf451ff1988",
		Peers: []*VBFTPeerInfo{
			{
				Index:      1,
				PeerPubkey: "120503ef44beba84422bd76a599531c9fe50969a929a0fee35df66690f370ce19fa8c0",
				Address:    "ATkhypXmvPNSeX64ECyL6kT8zSruDBLtBJ",
			},
			{
				Index:      2,
				PeerPubkey: "1205038247efcfeae0fdf760685d1ac1c083be3ff5e9a4a548bc3a2e98f0434f092483",
				Address:    "AVrKPxydgNjtLEQxT2krpBkksBWZMq5Sv3",
			},
			{
				Index:      3,
				PeerPubkey: "1205022092e34e0176dccf8abb496b833d591d25533469b3caf0e279b9742955dd8fc3",
				Address:    "ARMkJPzh7dR4p6Wi44T55dJ4sjr6C5hBUg",
			},
			{
				Index:      4,
				PeerPubkey: "1205027bd771e68adb88398282e21a8b03c12f64c2351ea49a2ba06a0327c83b239ca9",
				Address:    "AScEX1ibeBZtGxkpujLKEB3T1yW6ufUj5C",
			},
			{
				Index:      5,
				PeerPubkey: "120502d0d0e883c73d8256cf4314822ddd973c0179b73d8ed3df85aad38d36a8b2b0c7",
				Address:    "AKPQsGZG5zyRouHT6MAWbvYpoy8nzBFwjV",
			},
			{
				Index:      6,
				PeerPubkey: "120503a4f44dd65cbcc52b1d1ac51747378a7f84753b5f7bf2760ca21390ced6b172bb",
				Address:    "ASR4S4eBWpftG4tVv1Ku9YWJubzFuw66iL",
			},
			{
				Index:      7,
				PeerPubkey: "120502696c0cbe74f01ee85e3c0ebe4ebdc5bea404f199d0262f1941fd39ff0d100257",
				Address:    "AdUy5qgWTkSf6x4kiWf1fZ9pw8cuvCqoaf",
			},
		},
	},
	DBFT: &DBFTConfig{},
	SOLO: &SOLOConfig{},
}
View Source
var Version = "" //Set value when build project

Functions

func GetChainIdByNetId added in v1.2.0

func GetChainIdByNetId(id uint32) uint64

func GetEth1559Height added in v1.6.0

func GetEth1559Height(id uint32) uint64

func GetExtraInfoHeight added in v1.2.0

func GetExtraInfoHeight(id uint32) uint32

func GetHeco120Height added in v1.7.3

func GetHeco120Height(id uint32) uint64

func GetNetworkMagic added in v0.9.2

func GetNetworkMagic(id uint32) uint32

func GetNetworkName added in v0.9.2

func GetNetworkName(id uint32) string

func GetPolygonSnapChainID added in v1.7.0

func GetPolygonSnapChainID(id uint32) uint32

Types

type CommonConfig

type CommonConfig struct {
	LogLevel       uint
	NodeType       string
	EnableEventLog bool
	SystemFee      map[string]int64
	GasLimit       uint64
	GasPrice       uint64
	DataDir        string
}

type ConsensusConfig

type ConsensusConfig struct {
	EnableConsensus bool
	MaxTxInBlock    uint
}

type DBFTConfig

type DBFTConfig struct {
	GenBlockTime uint
	Bookkeepers  []string
}

type GenesisConfig

type GenesisConfig struct {
	SeedList      []string
	ConsensusType string
	VBFT          *VBFTConfig
	DBFT          *DBFTConfig
	SOLO          *SOLOConfig
}

func NewGenesisConfig

func NewGenesisConfig() *GenesisConfig

type OntologyConfig

type OntologyConfig struct {
	Genesis   *GenesisConfig
	Common    *CommonConfig
	Consensus *ConsensusConfig
	P2PNode   *P2PNodeConfig
	Rpc       *RpcConfig
	Restful   *RestfulConfig
	Ws        *WebSocketConfig
}

func NewOntologyConfig

func NewOntologyConfig() *OntologyConfig

func (*OntologyConfig) GetBookkeepers

func (this *OntologyConfig) GetBookkeepers() ([]keypair.PublicKey, error)

func (*OntologyConfig) GetDefaultNetworkId added in v1.0.1

func (this *OntologyConfig) GetDefaultNetworkId() (uint32, error)

type P2PNodeConfig

type P2PNodeConfig struct {
	ReservedPeersOnly         bool
	ReservedCfg               *P2PRsvConfig
	NetworkMagic              uint32
	NetworkId                 uint32
	NetworkName               string
	NodePort                  uint
	NodeConsensusPort         uint
	DualPortSupport           bool
	IsTLS                     bool
	CertPath                  string
	KeyPath                   string
	CAPath                    string
	HttpInfoPort              uint
	MaxHdrSyncReqs            uint
	MaxConnInBound            uint
	MaxConnOutBound           uint
	MaxConnInBoundForSingleIP uint
}

type P2PRsvConfig added in v0.9.2

type P2PRsvConfig struct {
	ReservedPeers []string `json:"reserved"`
	MaskPeers     []string `json:"mask"`
}

type RestfulConfig

type RestfulConfig struct {
	EnableHttpRestful  bool
	HttpRestPort       uint
	HttpMaxConnections uint
	HttpCertPath       string
	HttpKeyPath        string
}

type RpcConfig

type RpcConfig struct {
	EnableHttpJsonRpc bool
	HttpJsonPort      uint
	HttpLocalPort     uint
}

type SOLOConfig

type SOLOConfig struct {
	GenBlockTime uint
	Bookkeepers  []string
}

type VBFTConfig

type VBFTConfig struct {
	BlockMsgDelay        uint32          `json:"block_msg_delay"`
	HashMsgDelay         uint32          `json:"hash_msg_delay"`
	PeerHandshakeTimeout uint32          `json:"peer_handshake_timeout"`
	MaxBlockChangeView   uint32          `json:"max_block_change_view"`
	VrfValue             string          `json:"vrf_value"`
	VrfProof             string          `json:"vrf_proof"`
	Peers                []*VBFTPeerInfo `json:"peers"`
}

VBFT genesis config, from local config file

func (*VBFTConfig) Deserialization added in v1.2.0

func (this *VBFTConfig) Deserialization(source *common.ZeroCopySource) error

func (*VBFTConfig) Serialization added in v1.2.0

func (self *VBFTConfig) Serialization(sink *common.ZeroCopySink) error

type VBFTPeerInfo added in v1.2.0

type VBFTPeerInfo struct {
	Index      uint32 `json:"index"`
	PeerPubkey string `json:"peerPubkey"`
	Address    string `json:"address"`
}

func (*VBFTPeerInfo) Deserialization added in v1.2.0

func (this *VBFTPeerInfo) Deserialization(source *common.ZeroCopySource) error

func (*VBFTPeerInfo) Serialization added in v1.2.0

func (this *VBFTPeerInfo) Serialization(sink *common.ZeroCopySink) error

type WebSocketConfig

type WebSocketConfig struct {
	EnableHttpWs bool
	HttpWsPort   uint
	HttpCertPath string
	HttpKeyPath  string
}

Jump to

Keyboard shortcuts

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