Documentation
¶
Overview ¶
Server package for the blockchain client.
Index ¶
Constants ¶
const ( // DefaultGRPCPort is the default port for the GRPC server DefaultGRPCPort int = 9632 // DefaultJSONRPCPort is the default port for the JSON-RPC server DefaultJSONRPCPort int = 8545 )
Variables ¶
This section is empty.
Functions ¶
func ExtractBlockTime ¶
ExtractBlockTime attempts to extract a blockTime parameter from a given consensus engine configuration map. It returns a Duration type. If blockTime is missing or invalid, it returns an appropriate error.
Types ¶
type Config ¶
type Config struct {
// Chain configuration
Chain *chain.Chain
// JSON-RPC server configuration
JSONRPC *JSONRPC
// TCP address for the GRPC server
GRPCAddr *net.TCPAddr
// TCP address for the LibP2P server
LibP2PAddr *net.TCPAddr
// Various blockchain-related parameters
PriceLimit uint64
MaxAccountEnqueued uint64
MaxSlots uint64
BlockTime uint64
// Telemetry configuration for metric services
Telemetry *Telemetry
// Network configuration
Network *network.Config
// Data directory for the server
DataDir string
// Restore file path, if any
RestoreFile *string
// Flag to enable or disable sealing
Seal bool
// Secrets manager configuration
SecretsManager *secrets.SecretsManagerConfig
// Log level for the server
LogLevel hclog.Level
// Flag to enable or disable JSON log format
JSONLogFormat bool
// Path for the log file
LogFilePath string
// Flag to enable or disable relayer mode
Relayer bool
// Number of block confirmations required
NumBlockConfirmations uint64
}
Config is the main configuration struct for the server. It holds various sub-configurations related to different components of the server.
type Entry ¶
Entry represents a configuration entry for a consensus protocol. It includes an Enabled field that indicates whether the entry is in use, and a Config field that holds the entry's configuration data. The Config field is a map of string keys to values of any type.
type GenesisFactoryHook ¶
GenesisFactoryHook is a type definition for a function that takes a chain configuration and an engine name, and returns a function that accepts a state transition object and returns an error. It is typically used to modify the behavior of the blockchain's genesis block production based on specific engine.
type JSONRPC ¶
type JSONRPC struct {
// TCP address for the JSON-RPC server
JSONRPCAddr *net.TCPAddr
// Allowed origins for CORS
AccessControlAllowOrigin []string
// Limit for the number of items in a batch request
BatchLengthLimit uint64
// Limit for the number of blocks in a range request
BlockRangeLimit uint64
}
JSONRPC holds the configuration details for the JSON-RPC server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server struct defines the central manager of the blockchain client.
func (*Server) Chain ¶
Chain retrieves the server's Chain instance. Chain represents the blockchain associated with this server.
func (*Server) Close ¶
func (s *Server) Close()
Close shuts down all components of the server, including the blockchain, networking layer, consensus layer, and state storage. If a Prometheus server is running, it is also shut down. Errors during shutdown are logged but not returned, as the method always succeeds.