config

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2018 License: LGPL-3.0 Imports: 8 Imported by: 171

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        = 1
	DEFAULT_MAX_LOG_SIZE     = 100 //MByte
	DEFAULT_NET_MAGIC        = 0x74746e41
	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_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)
	DEFAULT_GAS_LIMIT        = 30000
	DEFAULT_GAS_PRICE        = 0

	DEFAULT_DATA_DIR = "./Chain"
)

Variables

View Source
var DefConfig = NewOntologyConfig()
View Source
var PolarisConfig = &GenesisConfig{
	SeedList: []string{
		"polaris1.ont.io:20338",
		"polaris2.ont.io:20338",
		"polaris3.ont.io:20338",
		"polaris4.ont.io:20338"},
	ConsensusType: CONSENSUS_TYPE_VBFT,
	VBFT: &VBFTConfig{
		N:                    7,
		C:                    2,
		K:                    7,
		L:                    112,
		BlockMsgDelay:        10000,
		HashMsgDelay:         10000,
		PeerHandshakeTimeout: 10,
		MaxBlockChangeView:   3000,
		AdminOntID:           "did:ont:AVaSGN1ugQJBS7R7ZcVwAoWLVK6onBgfyg",
		MinInitStake:         10000,
		VrfValue:             "1c9810aa9822e511d5804a9c4db9dd08497c31087b0daafa34d768a3253441fa20515e2f30f81741102af0ca3cefc4818fef16adb825fbaa8cad78647f3afb590e",
		VrfProof:             "c57741f934042cb8d8b087b44b161db56fc3ffd4ffb675d36cd09f83935be853d8729f3f5298d12d6fd28d45dde515a4b9d7f67682d182ba5118abf451ff1988",
		Peers: []*VBFTPeerStakeInfo{
			{
				Index:      1,
				PeerPubkey: "037c9e6c6a446b6b296f89b722cbf686b81e0a122444ef05f0f87096777663284b",
				Address:    "AXmQDzzvpEtPkNwBEFsREzApTTDZFW6frD",
				InitPos:    10000,
			},
			{
				Index:      2,
				PeerPubkey: "03dff4c63267ae5e23da44ace1bc47d0da1eb8d36fd71181dcccf0e872cb7b31fa",
				Address:    "AY5W6p4jHeZG2jjW6nS1p4KDUhcqLkU6jz",
				InitPos:    20000,
			},
			{
				Index:      3,
				PeerPubkey: "0205bc592aa9121428c4144fcd669ece1fa73fee440616c75624967f83fb881050",
				Address:    "ALZVrZrFqoSvqyi38n7mpPoeDp7DMtZ9b6",
				InitPos:    30000,
			},
			{
				Index:      4,
				PeerPubkey: "030a34dcb075d144df1f65757b85acaf053395bb47b019970607d2d1cdd222525c",
				Address:    "AMogjmLf2QohTcGST7niV75ekZfj44SKme",
				InitPos:    40000,
			},
			{
				Index:      5,
				PeerPubkey: "021844159f97d81da71da52f84e8451ee573c83b296ff2446387b292e44fba5c98",
				Address:    "AZzQTkZvjy7ih9gjvwU8KYiZZyNoy6jE9p",
				InitPos:    30000,
			},
			{
				Index:      6,
				PeerPubkey: "020cc76feb375d6ea8ec9ff653bab18b6bbc815610cecc76e702b43d356f885835",
				Address:    "AKEqQKmxCsjWJz8LPGryXzb6nN5fkK1WDY",
				InitPos:    20000,
			},
			{
				Index:      7,
				PeerPubkey: "03aa4d52b200fd91ca12deff46505c4608a0f66d28d9ae68a342c8a8c1266de0f9",
				Address:    "AQNpGWz4oHHFBejtBbakeR43DHfen7cm8L",
				InitPos:    10000,
			},
		},
	},
	DBFT: &DBFTConfig{},
	SOLO: &SOLOConfig{},
}
View Source
var Version = ""

Functions

This section is empty.

Types

type CliConfig

type CliConfig struct {
	EnableCliRpcServer bool
	CliRpcPort         uint
}

type CommonConfig

type CommonConfig struct {
	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
	Cli       *CliConfig
}

func NewOntologyConfig

func NewOntologyConfig() *OntologyConfig

func (*OntologyConfig) GetBookkeepers

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

type P2PNodeConfig

type P2PNodeConfig struct {
	NetworkId         uint32
	NodePort          uint
	NodeConsensusPort uint
	DualPortSupport   bool
	IsTLS             bool
	CertPath          string
	KeyPath           string
	CAPath            string
	HttpInfoPort      uint
	MaxHdrSyncReqs    uint
}

type RestfulConfig

type RestfulConfig struct {
	EnableHttpRestful bool
	HttpRestPort      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 {
	N                    uint32               `json:"n"` // network size
	C                    uint32               `json:"c"` // consensus quorum
	K                    uint32               `json:"k"`
	L                    uint32               `json:"l"`
	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"`
	MinInitStake         uint32               `json:"min_init_stake"`
	AdminOntID           string               `json:"admin_ont_id"`
	VrfValue             string               `json:"vrf_value"`
	VrfProof             string               `json:"vrf_proof"`
	Peers                []*VBFTPeerStakeInfo `json:"peers"`
}

VBFT genesis config, from local config file

func (*VBFTConfig) Deserialize

func (this *VBFTConfig) Deserialize(r io.Reader) error

func (*VBFTConfig) Serialize

func (this *VBFTConfig) Serialize(w io.Writer) error

type VBFTPeerStakeInfo

type VBFTPeerStakeInfo struct {
	Index      uint32 `json:"index"`
	PeerPubkey string `json:"peerPubkey"`
	Address    string `json:"address"`
	InitPos    uint64 `json:"initPos"`
}

func (*VBFTPeerStakeInfo) Deserialize

func (this *VBFTPeerStakeInfo) Deserialize(r io.Reader) error

func (*VBFTPeerStakeInfo) Serialize

func (this *VBFTPeerStakeInfo) Serialize(w io.Writer) 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