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 (
// DefaultConfigPath is the default config path
DefaultConfigPath = "./config.yaml"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AcceptPrevote ¶
type AcceptPrevote struct {
// TTL is the time the state machine will wait for the AcceptPrevote state.
// Once timeout, it will move to the next state.
TTL time.Duration
}
AcceptPrevote is the RDPoS AcceptPrevote config
type AcceptPropose ¶
type AcceptPropose struct {
// TTL is the time the state machine will wait for the AcceptPropose state.
// Once timeout, it will move to the next state.
TTL time.Duration
}
AcceptPropose is the RDPoS AcceptPropose config
type AcceptVote ¶
type AcceptVote struct {
// TTL is the time the state machine will wait for the AcceptVote state.
// Once timeout, it will move to the next state.
TTL time.Duration
}
AcceptVote is the RDPoS AcceptVote config
type Chain ¶
type Chain struct {
ChainDBPath string
TotalSupply uint64
BlockReward uint64
// MinerAddr is an address where the block rewards will be sent to.
MinerAddr string
}
Chain is the config struct for blockchain package
type Config ¶
type Config struct {
NodeType string
Network Network
Chain Chain
Consensus Consensus
Delegate Delegate
RPC RPC
}
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:
// RDPOS -- Randomized Delegated Proof of Stake
// STANDALONE -- The node creates a block periodically regardless of others (if there is any)
// NOOP -- The node does not create only block
Scheme string
RDPoS RDPoS
BlockCreationInterval time.Duration
}
Consensus is the config struct for consensus package
type Network ¶
type Network struct {
Addr string
MsgLogsCleaningInterval time.Duration
MsgLogRetention time.Duration
HealthCheckInterval time.Duration
SilentInterval time.Duration
PeerMaintainerInterval time.Duration
AllowMultiConnsPerIP bool
NumPeersLowerBound uint
NumPeersUpperBound uint
PingInterval time.Duration
RateLimitEnabled bool
RateLimitPerSec uint64
RateLimitWindowSize time.Duration
BootstrapNodes []string
TLSEnabled bool
CACrtPath string
PeerCrtPath string
PeerKeyPath string
KLClientParams keepalive.ClientParameters
KLServerParams keepalive.ServerParameters
KLPolicy keepalive.EnforcementPolicy
MaxMsgSize int
PeerDiscovery bool
TopologyPath string
}
Network is the config struct for network package
type ProposerRotation ¶
type ProposerRotation struct {
// Interval determines how long to propose another round of RDPoS.
Interval time.Duration
// Enabled flags whether we periodically rotate the proposer and trigger a new round of RDPoS
Enabled bool
}
ProposerRotation is the RDPoS ProposerRotation config
type RDPoS ¶
type RDPoS struct {
ProposerRotation ProposerRotation
UnmatchedEventTTL time.Duration
AcceptPropose AcceptPropose
AcceptPrevote AcceptPrevote
AcceptVote AcceptVote
}
RDPoS is the config struct for RDPoS 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