Documentation ¶
Index ¶
Constants ¶
const ( // DelegateType represents the delegate node type DelegateType = "delegate" // FullNodeType represents the full node type FullNodeType = "full_node" // LightweightType represents the lightweight type LightweightType = "lightweight" )
const ( // RollDPoSScheme means randomized delegated proof of stake RollDPoSScheme = "ROLLDPOS" // StandaloneScheme means that the node creates a block periodically regardless of others (if there is any) StandaloneScheme = "STANDALONE" // NOOPScheme means that the node does not create only block NOOPScheme = "NOOP" )
const (
// DefaultConfigPath is the default config path
DefaultConfigPath = "./config.yaml"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chain ¶
type Chain struct { ChainDBPath string `yaml:"chainDBPath"` TrieDBPath string `yaml:"trieDBPath"` ProducerPubKey string `yaml:"producerPubKey"` ProducerPrivKey string `yaml:"producerPrivKey"` // ProducerAddr is an iotxaddress struct constructed from ProducerPubKey and ProducerPrivKey ProducerAddr iotxaddress.Address `yaml:"producerAddr"` // InMemTest creates in-memory DB file for local testing InMemTest bool `yaml:"inMemTest"` GenesisActionsPath string `yaml:"genesisActionsPath"` }
Chain is the config struct for blockchain package
type Config ¶
type Config struct { NodeType string `yaml:"nodeType"` Network Network `yaml:"network"` Chain Chain `yaml:"chain"` Consensus Consensus `yaml:"consensus"` Delegate Delegate `yaml:"delegate"` RPC RPC `yaml:"rpc"` BlockSync BlockSync `yaml:"blockSync"` Dispatcher Dispatcher `yaml:"dispatcher"` Explorer Explorer `yaml:"explorer"` System System `yaml:"system"` }
Config is the root config struct, each package's config should be put as its sub struct
func LoadConfig ¶
LoadConfig loads the config instance from the default config path
func LoadConfigWithPath ¶
LoadConfigWithPath loads the config instance and validates fields
func LoadConfigWithPathWithoutValidation ¶
LoadConfigWithPathWithoutValidation loads the config instance but doesn't validate fields
func (*Config) IsDelegate ¶
IsDelegate returns true if the node type is Delegate
func (*Config) IsFullnode ¶
IsFullnode returns true if the node type is Fullnode
func (*Config) IsLightweight ¶
IsLightweight returns true if the node type is Lightweight
type Consensus ¶
type Consensus struct { // There are three schemes that are supported Scheme string `yaml:"scheme"` RollDPoS RollDPoS `yaml:"rollDPoS"` BlockCreationInterval time.Duration `yaml:"blockCreationInterval"` }
Consensus is the config struct for consensus package
type Dispatcher ¶
type Dispatcher struct {
EventChanSize uint `yaml:"eventChanSize"`
}
Dispatcher is the dispatcher config
type Explorer ¶
type Explorer struct { Enabled bool `yaml:"enabled"` IsTest bool `yaml:"isTest"` Addr string `yaml:"addr"` TpsWindow int `yaml:"tpsWindow"` }
Explorer is the explorer service config
type Network ¶
type Network struct { Addr string `yaml:"addr"` MsgLogsCleaningInterval time.Duration `yaml:"msgLogsCleaningInterval"` MsgLogRetention time.Duration `yaml:"msgLogRetention"` HealthCheckInterval time.Duration `yaml:"healthCheckInterval"` SilentInterval time.Duration `yaml:"silentInterval"` PeerMaintainerInterval time.Duration `yaml:"peerMaintainerInterval"` AllowMultiConnsPerIP bool `yaml:"allowMultiConnsPerIP"` NumPeersLowerBound uint `yaml:"numPeersLowerBound"` NumPeersUpperBound uint `yaml:"numPeersUpperBound"` PingInterval time.Duration `yaml:"pingInterval"` RateLimitEnabled bool `yaml:"rateLimitEnabled"` RateLimitPerSec uint64 `yaml:"rateLimitPerSec"` RateLimitWindowSize time.Duration `yaml:"rateLimitWindowSize"` BootstrapNodes []string `yaml:"bootstrapNodes"` TLSEnabled bool `yaml:"tlsEnabled"` CACrtPath string `yaml:"caCrtPath"` PeerCrtPath string `yaml:"peerCrtPath"` PeerKeyPath string `yaml:"peerKeyPath"` KLClientParams keepalive.ClientParameters `yaml:"klClientParams"` KLServerParams keepalive.ServerParameters `yaml:"klServerParams"` KLPolicy keepalive.EnforcementPolicy `yaml:"klPolicy"` MaxMsgSize int `yaml:"maxMsgSize"` PeerDiscovery bool `yaml:"peerDiscovery"` TopologyPath string `yaml:"topologyPath"` TTL uint32 `yaml:"ttl"` }
Network is the config struct for network package
type RollDPoS ¶
type RollDPoS struct { DelegateInterval time.Duration `yaml:"delegateInterval"` ProposerInterval time.Duration `yaml:"proposerInterval"` ProposerCB string `yaml:"proposerCB"` EpochCB string `yaml:"epochCB"` UnmatchedEventTTL time.Duration `yaml:"unmatchedEventTTL"` RoundStartTTL time.Duration `yaml:"roundStartTTL"` AcceptProposeTTL time.Duration `yaml:"acceptProposeTTL"` AcceptPrevoteTTL time.Duration `yaml:"acceptPrevoteTTL"` AcceptVoteTTL time.Duration `yaml:"acceptVoteTTL"` Delay time.Duration `yaml:"delay"` NumSubEpochs uint `yaml:"numSubEpochs"` EventChanSize uint `yaml:"eventChanSize"` }
RollDPoS is the config struct for RollDPoS consensus package
type Topology ¶
Topology is the neighbor list for each node. This is used for generating the P2P network in a given topology. Note that the list contains the outgoing connections.
func LoadTopology ¶
LoadTopology loads the topology struct from the given yaml file