Documentation
¶
Index ¶
Constants ¶
const ( // ModeProd refers to production mode ModeProd = iota // ModeDev refers to development mode ModeDev // ModeTest refers to test mode ModeTest )
Variables ¶
var ( // ProtocolVersion is the protocol version // spoken by this client ProtocolVersion = "/inception/1" // HandshakeVersion is the message version for // handling wire.Handshake HandshakeVersion = ProtocolVersion + "/handshake/1" // PingVersion is the version for handling // wire.Ping messages PingVersion = ProtocolVersion + "/ping/1" // GetAddrVersion is the message version // for handling wire.GetAddr messages GetAddrVersion = ProtocolVersion + "/getaddr/1" // AddrVersion is the message version for handling // wire.Addr messages AddrVersion = ProtocolVersion + "/addr/1" // IntroVersion is the message version for handling // wire.Intro messages IntroVersion = ProtocolVersion + "/intro/1" // TxVersion is the message version for handing // wire.Transaction messages TxVersion = ProtocolVersion + "/tx/1" // BlockBodyVersion is the message version for // handling wire.BlockBody messages BlockBodyVersion = ProtocolVersion + "/blockbody/1" // GetBlockHashesVersion is the message version for // handling wire.BlockHashes messages GetBlockHashesVersion = ProtocolVersion + "/getblockhashes/1" // RequestBlockVersion is the message version for // handling wire.RequestBlock messages RequestBlockVersion = ProtocolVersion + "/requestblock/1" // GetBlockBodiesVersion is the message version for // handling wire.GetBlockBodies messages GetBlockBodiesVersion = ProtocolVersion + "/getblockbodies/1" )
var AccountDirName = "accounts"
AccountDirName is the name of the directory for storing accounts
Functions ¶
This section is empty.
Types ¶
type ChainConfig ¶
type ChainConfig struct {
// Checkpoints includes a collection of points on the chain of
// which blocks are supposed to exists after or before.
Checkpoints []*CheckPoint `json:"checkpoints"`
}
ChainConfig includes parameters for the chain
type CheckPoint ¶
CheckPoint describes a point on the chain. We use it to prevent blocks dated far back in the history of the chain from causing a chain reorganization.
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config holds configuration information
func (*Config) Load ¶
func (cd *Config) Load() (*EngineConfig, error)
Load reads the content of the ellcrys.json file into Config struct
type ConsensusConfig ¶
type ConsensusConfig struct {
// MaxEndorsementPeriodInBlocks is the amount of blocks after ticket maturity an endorser can
// continue to perform endorsement functions.
MaxEndorsementPeriodInBlocks uint `json:"maxEndorsementPeriodInBlocks"`
// NumBlocksForTicketMaturity is the number of blocks before an endorser ticket
// is considered mature.
NumBlocksForTicketMaturity uint `json:"numBlocksForTicketMaturity"`
}
ConsensusConfig defines configuration for consensus processes
type EngineConfig ¶
type EngineConfig struct {
// Node holds the node configurations
Node *PeerConfig `json:"peer"`
// TxPool holds transaction pool configurations
TxPool *TxPoolConfig `json:"txPool"`
// Consensus holds consensus related configurations
Consensus *ConsensusConfig `json:"consensus"`
// Chain holds blockchain related configurations
Chain *ChainConfig `json:"chain"`
// Miner holds mining configurations
Miner *MinerConfig `json:"mining"`
// RPC holds rpc configurations
RPC *RPCConfig `json:"rpc"`
// VersionInfo holds version information
VersionInfo *VersionInfo `json:"-"`
// contains filtered or unexported fields
}
EngineConfig represents the client's configuration
func LoadCfg ¶
func LoadCfg(dataDirPath string) (*EngineConfig, error)
LoadCfg loads the config file
func (*EngineConfig) DataDir ¶
func (c *EngineConfig) DataDir() string
DataDir returns the config directory
func (*EngineConfig) SetConfigDir ¶
func (c *EngineConfig) SetConfigDir(d string)
SetConfigDir sets the config directory
type MinerConfig ¶
type MinerConfig struct {
// Mode describes the mining mode
Mode uint `json:"-"`
}
MinerConfig defines configuration for mining
type PeerConfig ¶
type PeerConfig struct {
// BootstrapAddresses sets addresses to connect to
BootstrapAddresses []string `json:"addresses"`
// Mode determines the current environment type
Mode int `json:"dev"`
// GetAddrInterval is the interval between GetAddr messages
GetAddrInterval int64 `json:"getAddrInt"`
// PingInterval is the interval between Ping messages
PingInterval int64 `json:"pingInt"`
// SelfAdvInterval is the interval self advertisement messages
SelfAdvInterval int64 `json:"selfAdvInt"`
// CleanUpInterval is the interval between address clean ups
CleanUpInterval int64 `json:"cleanUpInt"`
// MaxAddrsExpected is the maximum number addresses
// expected from a remote peer
MaxAddrsExpected int64 `json:"maxAddrsExpected"`
// MaxOutboundConnections is the maximum number of outbound
// connections the node is allowed
MaxOutboundConnections int64 `json:"maxOutConnections"`
// MaxOutboundConnections is the maximum number of inbound
// connections the node is allowed
MaxInboundConnections int64 `json:"maxInConnections"`
// ConnEstInterval is the time interval when the node
ConnEstInterval int64 `json:"conEstInt"`
// MessageTimeout is the number of seconds to attempt to
// connect to or read from a peer.
MessageTimeout int64
}
PeerConfig represents peer configuration
type RPCConfig ¶
type RPCConfig struct {
// DisableAuth determines whether to
// perform authentication for requests
// attempting to invoke private methods.
DisableAuth bool `json:"disableAuth"`
// Username is the RPC username
Username string `json:"username"`
// Password is the RPC password
Password string `json:"password"`
// SessionSecretKey is the key used to sign the
// session tokens. Must be kept secret.
SessionSecretKey string `json:"sessionSecretKey"`
}
RPCConfig defines configuration for the RPC component
type TxPoolConfig ¶
type TxPoolConfig struct {
// Capacity is the maximum amount of item the transaction pool can hold
Capacity int64 `json:"cap"`
}
TxPoolConfig defines configuration for the transaction pool