config

package
v2.12.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSingle = false

	DefaultNodeName = "vite-node"

	DefaultNetID = 3

	DefaultListenInterface = "0.0.0.0"
	DefaultPort            = 8483
	DefaultFilePort        = 8484

	DefaultDiscover = true

	DefaultMaxPeers        = 60
	DefaultMaxInboundRatio = 2
	DefaultMinPeers        = 5
	DefaultMaxPendingPeers = 10

	DefaultNetDirName = "net"
	PeerKeyFileName   = "peerKey"

	DefaultForwardStrategy = "cross"
	DefaultAccessControl   = "any"
)

Variables

This section is empty.

Functions

func DefaultDataDir

func DefaultDataDir() string

DefaultDataDir is the default data directory to use for the databases and other persistence requirements.

func GenesisJson

func GenesisJson() string

func IsCompleteGenesisConfig

func IsCompleteGenesisConfig(genesisConfig *Genesis) bool

func MockGenesisJson

func MockGenesisJson() string

Types

type AssetContractInfo

type AssetContractInfo struct {
	TokenInfoMap map[string]*TokenInfo // tokenId - info
	LogList      []*GenesisVmLog       // issue events
}

type Chain

type Chain struct {
	LedgerGcRetain uint64 // no use
	GenesisFile    string // genesis file path
	LedgerGc       bool   // open or close ledger garbage collector
	OpenPlugins    bool   // open or close chain plugins. eg, filter account blocks by token.

	VmLogWhiteList []types.Address // contract address white list which save VM logs
	VmLogAll       bool            // save all VM logs, it will cost more disk space
}

chain config

type Config

type Config struct {
	*Producer   `json:"Producer"`
	*Chain      `json:"Chain"`
	*Vm         `json:"Vm"`
	*Subscribe  `json:"Subscribe"`
	*Net        `json:"Net"`
	*NodeReward `json:"Reward"`
	*Genesis    `json:"Genesis"`

	// global keys
	DataDir string `json:"DataDir"`
	//Log level
	LogLevel string `json:"LogLevel"`
}

func (Config) RunLogDir

func (c Config) RunLogDir() string

type ConsensusGroupInfo

type ConsensusGroupInfo struct {
	NodeCount              uint8
	Interval               int64
	PerCount               int64
	RandCount              uint8
	RandRank               uint8
	Repeat                 uint16
	CheckLevel             uint8
	CountingTokenId        types.TokenTypeId
	RegisterConditionId    uint8
	RegisterConditionParam RegisterConditionParam
	VoteConditionId        uint8
	VoteConditionParam     VoteConditionParam
	Owner                  types.Address
	StakeAmount            *big.Int
	ExpirationHeight       uint64
}

type DexFundContractInfo

type DexFundContractInfo struct {
	Owner *types.Address
}

type ForkPoint

type ForkPoint struct {
	Height  uint64
	Version uint32
}

type Genesis

type Genesis struct {
	GenesisAccountAddress *types.Address
	UpgradeCfg            *Upgrade
	GovernanceInfo        *GovernanceContractInfo
	AssetInfo             *AssetContractInfo
	QuotaInfo             *QuotaContractInfo
	AccountBalanceMap     map[string]map[string]*big.Int // address - tokenId - balanceAmount
	DexFundInfo           *DexFundContractInfo
}

func MainnetGenesis

func MainnetGenesis() *Genesis

func MakeGenesisConfig

func MakeGenesisConfig(genesisFile string) *Genesis

func MockGenesis

func MockGenesis() *Genesis

func (*Genesis) UnmarshalJSON

func (g *Genesis) UnmarshalJSON(data []byte) error

type GenesisVmLog

type GenesisVmLog struct {
	Data   string
	Topics []types.Hash
}

type GovernanceContractInfo

type GovernanceContractInfo struct {
	ConsensusGroupInfoMap map[string]*ConsensusGroupInfo          // consensus group info, gid - info
	RegistrationInfoMap   map[string]map[string]*RegistrationInfo // registration info, gid - sbpName - info
	HisNameMap            map[string]map[string]string            // used node name for node addr, gid - blockProducingAddress - sbpName
	VoteStatusMap         map[string]map[string]string            // vote info, gid - voteAddr - sbpName
}

type Net

type Net struct {
	Single bool

	// Name is our node name, NO need to be unique in the whole network, just for readability, default is `vite-node`
	Name string

	// NetID is to mark which network our node in, nodes from different network can`t connect each other
	NetID int

	ListenInterface string

	Port int

	FilePort int

	// PublicAddress is the network address can be access by other nodes, usually is the public Internet address
	PublicAddress string

	FilePublicAddress string

	// DataDir is the directory to storing p2p data, if is null-string, will use memory as database
	DataDir string

	// PeerKey is to encrypt message, the corresponding public key use for NodeID, MUST NOT be revealed
	PeerKey string

	// Discover means whether discover other nodes in the networks, default true
	Discover bool

	// BootNodes are roles as network entrance. Node can discovery more other nodes by send UDP query BootNodes,
	// but not create a TCP connection to BootNodes directly
	BootNodes []string

	// BootSeeds are the address where can query BootNodes, is a more flexible option than BootNodes
	BootSeeds []string

	// StaticNodes will be connect directly
	StaticNodes []string

	MaxPeers int

	MaxInboundRatio int

	// MinPeers server will keep finding nodes and try to connect until number of peers is larger than `MinPeers`,
	// default 5
	MinPeers int

	// MaxPendingPeers how many inbound peers can be connect concurrently, more inbound connection will be blocked
	// this value is for defend DDOS attack, default 10
	MaxPendingPeers int

	ForwardStrategy string

	AccessControl   string
	AccessAllowKeys []string
	AccessDenyKeys  []string

	BlackBlockHashList []string
	WhiteBlockList     []string

	MineKey ed25519.PrivateKey
}

func (*Net) Init

func (net *Net) Init() (privateKey ed25519.PrivateKey, err error)

type NodeReward

type NodeReward struct {
	RewardAddr string  `json:"RewardAddr"`
	Name       string  `json:"Name"`
	SecretPub  *string `json:"SecretPub"`
}

type Producer

type Producer struct {
	Producer         bool   `json:"Producer"`
	Coinbase         string `json:"Coinbase"`
	EntropyStorePath string `json:"EntropyStorePath"`

	VirtualSnapshotVerifier bool `json:"VirtualSnapshotVerifier"`
	// contains filtered or unexported fields
}

func (Producer) GetCoinbase

func (cfg Producer) GetCoinbase() types.Address

func (Producer) GetIndex

func (cfg Producer) GetIndex() uint32

func (*Producer) IsMine

func (cfg *Producer) IsMine() bool

func (*Producer) Parse

func (cfg *Producer) Parse() error

type QuotaContractInfo

type QuotaContractInfo struct {
	StakeInfoMap       map[string][]*StakeInfo
	StakeBeneficialMap map[string]*big.Int
}

type RegisterConditionParam

type RegisterConditionParam struct {
	StakeAmount *big.Int
	StakeToken  types.TokenTypeId
	StakeHeight uint64
}

type RegistrationInfo

type RegistrationInfo struct {
	BlockProducingAddress *types.Address
	StakeAddress          *types.Address
	Amount                *big.Int
	ExpirationHeight      uint64
	RewardTime            int64
	RevokeTime            int64
	HistoryAddressList    []types.Address
}

type StakeInfo

type StakeInfo struct {
	Amount           *big.Int
	ExpirationHeight uint64
	Beneficiary      *types.Address
}

type Subscribe

type Subscribe struct {
	IsSubscribe bool `json:"IsSubscribe"`
}

type TokenInfo

type TokenInfo struct {
	TokenName       string
	TokenSymbol     string
	TotalSupply     *big.Int
	Decimals        uint8
	Owner           types.Address
	MaxSupply       *big.Int
	IsOwnerBurnOnly bool
	IsReIssuable    bool
}

type Upgrade

type Upgrade struct {
	Level  string
	Points map[string]*upgrade.UpgradePoint
}

func (*Upgrade) MakeUpgradeBox

func (cfg *Upgrade) MakeUpgradeBox() upgrade.UpgradeBox

type Vm

type Vm struct {
	IsVmTest            bool `json:"IsVmTest"`
	IsUseVmTestParam    bool `json:"IsUseVmTestParam"`
	IsUseQuotaTestParam bool `json:"IsUseQuotaTestParam"`
	IsVmDebug           bool `json:"IsVmDebug"`
}

type VoteConditionParam

type VoteConditionParam struct {
}

type Wallet

type Wallet struct {
	DataDir        string
	MaxSearchIndex uint32
}

Jump to

Keyboard shortcuts

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