conf

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: GPL-3.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultMaxPrice    = big.NewInt(500 * params.GWei)
	DefaultIgnorePrice = big.NewInt(2 * params.Wei)
)
View Source
var FullNodeGPO = GpoConfig{
	Blocks:           20,
	Percentile:       60,
	MaxHeaderHistory: 1024,
	MaxBlockHistory:  1024,
	MaxPrice:         DefaultMaxPrice,
	IgnorePrice:      DefaultIgnorePrice,
}

FullNodeGPO contains default gasprice oracle settings for full node.

View Source
var LightClientGPO = GpoConfig{
	Blocks:           2,
	Percentile:       60,
	MaxHeaderHistory: 300,
	MaxBlockHistory:  5,
	MaxPrice:         DefaultMaxPrice,
	IgnorePrice:      DefaultIgnorePrice,
}

LightClientGPO contains default gasprice oracle settings for light client.

Functions

func LoadConfigFromFile

func LoadConfigFromFile(file string, config *Config) error

func SaveConfigToFile

func SaveConfigToFile(file string, config Config) error

Types

type APoaConfig

type APoaConfig struct {
	Epoch              uint64 `json:"epoch" yaml:"epoch"`
	CheckpointInterval uint64 `json:"checkpointInterval" yaml:"checkpointInterval"`
	InmemorySnapshots  int    `json:"inmemorySnapshots" yaml:"inmemorySnapshots"`
	InmemorySignatures int    `json:"inmemorySignatures" yaml:"inmemorySignatures"`
	InMemory           bool   `json:"inMemory" yaml:"inMemory"`
}

type APosConfig

type APosConfig struct {
	Epoch              uint64   `json:"epoch" yaml:"epoch"`
	CheckpointInterval uint64   `json:"checkpointInterval" yaml:"checkpointInterval"`
	InmemorySnapshots  int      `json:"inmemorySnapshots" yaml:"inmemorySnapshots"`
	InmemorySignatures int      `json:"inmemorySignatures" yaml:"inmemorySignatures"`
	InMemory           bool     `json:"inMemory" yaml:"inMemory"`
	RewardEpoch        uint64   `json:"rewardEpoch" yaml:"rewardEpoch"`
	RewardLimit        *big.Int `json:"rewardLimit" yaml:"rewardLimit"`

	DepositContract    string `json:"depositContract" yaml:"depositContract"`       // Deposit contract
	DepositNFTContract string `json:"depositNFTContract" yaml:"depositNFTContract"` // Deposit NFT contract
}

type AccountConfig

type AccountConfig struct {
	PasswordFile string `json:"password_file" yaml:"password_file"`
}

type Config

type Config struct {
	NodeCfg     NodeConfig          `json:"node" yaml:"node"`
	NetworkCfg  NetWorkConfig       `json:"network" yaml:"network"`
	LoggerCfg   LoggerConfig        `json:"logger" yaml:"logger"`
	DatabaseCfg DatabaseConfig      `json:"database" yaml:"database"`
	PprofCfg    PprofConfig         `json:"pprof" yaml:"pprof"`
	ChainCfg    *params.ChainConfig `json:"chain" yaml:"chain"`
	AccountCfg  AccountConfig       `json:"account" yaml:"account"`
	MetricsCfg  MetricsConfig       `json:"metrics" yaml:"metrics"`
	P2PCfg      *P2PConfig          `json:"p2p" yaml:"p2p"`
	// Gas Price Oracle options
	GPO   GpoConfig   `json:"gpo" yaml:"gpo"`
	Miner MinerConfig `json:"miner"`
}

type ConsensusConfig

type ConsensusConfig struct {
	EngineName string      `json:"name" yaml:"name"`
	Etherbase  string      `json:"etherbase" yaml:"etherbase"`
	Period     uint64      `json:"period" yaml:"period"`
	APoa       *APoaConfig `json:"apoa" yaml:"poa"`
	GasFloor   uint64      `json:"gasFloor" yaml:"gasFloor"` // Target gas floor for mined blocks.
	GasCeil    uint64      `json:"gasCeil" yaml:"gasCeil"`   // Target gas ceiling for mined blocks.
	APos       *APosConfig `json:"apos" yaml:"pos"`
}

type DatabaseConfig

type DatabaseConfig struct {
	DBType     string   `json:"db_type" yaml:"db_type"`
	DBPath     string   `json:"path" yaml:"path"`
	DBName     string   `json:"name" yaml:"name"`
	SubDB      []string `json:"sub_name" yaml:"sub_name"`
	Debug      bool     `json:"debug" yaml:"debug"`
	IsMem      bool     `json:"memory" yaml:"memory"`
	MaxDB      uint64   `json:"max_db" yaml:"max_db"`
	MaxReaders uint64   `json:"max_readers" yaml:"max_readers"`
}

type Genesis added in v0.1.1

type Genesis struct {
	Config     *params.ChainConfig `json:"config" yaml:"config"`
	Nonce      uint64              `json:"nonce"`
	Timestamp  uint64              `json:"timestamp"`
	ExtraData  []byte              `json:"extraData"`
	GasLimit   uint64              `json:"gasLimit"   gencodec:"required"`
	Difficulty *uint256.Int        `json:"difficulty" gencodec:"required"`
	Mixhash    types.Hash          `json:"mixHash"`
	Coinbase   types.Address       `json:"coinbase"`

	//Engine *ConsensusConfig `json:"engine" yaml:"engine"`
	Miners []string     `json:"miners" yaml:"miners"`
	Alloc  GenesisAlloc `json:"alloc" yaml:"alloc"  gencodec:"required"`

	// These fields are used for consensus tests. Please don't use them
	// in actual genesis blocks.
	Number     uint64       `json:"number"`
	GasUsed    uint64       `json:"gasUsed"`
	ParentHash types.Hash   `json:"parentHash"`
	BaseFee    *uint256.Int `json:"baseFeePerGas"`
}

type GenesisAccount added in v0.1.1

type GenesisAccount struct {
	//Address string                    `json:"address" toml:"address"`
	Balance string                    `json:"balance"`
	Code    []byte                    `json:"code,omitempty"`
	Storage map[types.Hash]types.Hash `json:"storage,omitempty"`
	Nonce   uint64                    `json:"nonce,omitempty"`
}

type GenesisAlloc added in v0.1.1

type GenesisAlloc map[types.Address]GenesisAccount

GenesisAlloc specifies the initial state that is part of the genesis block.

type GpoConfig

type GpoConfig struct {
	Blocks           int
	Percentile       int
	MaxHeaderHistory int
	MaxBlockHistory  int
	Default          *big.Int `toml:",omitempty"`
	MaxPrice         *big.Int `toml:",omitempty"`
	IgnorePrice      *big.Int `toml:",omitempty"`
}

type LoggerConfig

type LoggerConfig struct {
	LogFile    string `json:"name" yaml:"name"`
	Level      string `json:"level" yaml:"level"`
	MaxSize    int    `json:"max_size" yaml:"max_size"`
	MaxBackups int    `json:"max_count" yaml:"max_count"`
	MaxAge     int    `json:"max_day" yaml:"max_day"`
	Compress   bool   `json:"compress" yaml:"compress"`
}

type MetricsConfig

type MetricsConfig struct {
	Enable bool   `json:"enable" yaml:"enable"`
	Port   int    `json:"port" yaml:"port"`
	HTTP   string `json:"http" yaml:"http"`
}

type MinerConfig

type MinerConfig struct {
	Etherbase string        // Public address for block mining rewards
	GasCeil   uint64        // Target gas ceiling for mined blocks.
	GasPrice  *big.Int      // Minimum gas price for mining a transaction
	Recommit  time.Duration // The time interval for miner to re-create mining work
}

type NetWorkConfig

type NetWorkConfig struct {
	ListenersAddress []string `json:"listeners" yaml:"listeners"`
	BootstrapPeers   []string `json:"bootstraps" yaml:"bootstraps"`
	LocalPeerKey     string   `json:"private" yaml:"network_private"`
	Bootstrapped     bool     `json:"discover" yaml:"discover"`
}

type NodeConfig

type NodeConfig struct {
	NodePrivate string `json:"private" yaml:"private"`
	HTTP        bool   `json:"http" yaml:"http" `
	HTTPHost    string `json:"http_host" yaml:"http_host" `
	HTTPPort    string `json:"http_port" yaml:"http_port"`
	HTTPApi     string `json:"http_api" yaml:"http_api"`
	// HTTPCors is the Cross-Origin Resource Sharing header to send to requesting
	// clients. Please be aware that CORS is a browser enforced security, it's fully
	// useless for custom HTTP clients.
	HTTPCors string `json:"http_cors" yaml:"http_cors"`

	WS     bool   `json:"ws" yaml:"ws" `
	WSHost string `json:"ws_host" yaml:"ws_host" `
	WSPort string `json:"ws_port" yaml:"ws_port"`
	WSApi  string `json:"ws_api" yaml:"ws_api"`
	// WSOrigins is the list of domain to accept websocket requests from. Please be
	// aware that the server can only act upon the HTTP request the client sends and
	// cannot verify the validity of the request header.
	WSOrigins        string `toml:",omitempty"`
	IPCPath          string `json:"ipc_path" yaml:"ipc_path"`
	DataDir          string `json:"data_dir" yaml:"data_dir"`
	MinFreeDiskSpace int    `json:"min_free_disk_space" yaml:"min_free_disk_space"`
	Chain            string `json:"chain" yaml:"chain"`
	Miner            bool   `json:"miner" yaml:"miner"`

	AuthRPC bool `json:"auth_rpc" yaml:"auth_rpc"`
	// AuthAddr is the listening address on which authenticated APIs are provided.
	AuthAddr string `json:"auth_addr" yaml:"auth_addr"`

	// AuthPort is the port number on which authenticated APIs are provided.
	AuthPort int `json:"auth_port" yaml:"auth_port"`

	// AuthVirtualHosts is the list of virtual hostnames which are allowed on incoming requests
	// for the authenticated api. This is by default {'localhost'}.
	AuthVirtualHosts []string `json:"auth_virtual_hosts" yaml:"auth_virtual_hosts"`

	// JWTSecret is the path to the hex-encoded jwt secret.
	JWTSecret string `json:"jwt_secret" yaml:"jwt_secret"`

	// KeyStoreDir is the file system folder that contains private keys. The directory can
	// be specified as a relative path, in which case it is resolved relative to the
	// current directory.
	//
	// If KeyStoreDir is empty, the default location is the "keystore" subdirectory of
	// DataDir. If DataDir is unspecified and KeyStoreDir is empty, an ephemeral directory
	// is created by New and destroyed when the node is stopped.
	KeyStoreDir string `json:"key_store_dir" yaml:"key_store_dir"`

	// ExternalSigner specifies an external URI for a clef-type signer
	ExternalSigner string `json:"external_signer" yaml:"external_signer"`

	// UseLightweightKDF lowers the memory and CPU requirements of the key store
	// scrypt KDF at the expense of security.
	UseLightweightKDF bool `json:"use_lightweight_kdf" yaml:"use_lightweight_kdf"`

	// InsecureUnlockAllowed allows user to unlock accounts in unsafe http environment.
	InsecureUnlockAllowed bool `json:"insecure_unlock_allowed" yaml:"insecure_unlock_allowed"`

	PasswordFile string `json:"password_file" yaml:"password_file"`
}

func (*NodeConfig) ExtRPCEnabled

func (c *NodeConfig) ExtRPCEnabled() bool

ExtRPCEnabled returns the indicator whether node enables the external RPC(http, ws or graphql).

func (*NodeConfig) KeyDirConfig

func (c *NodeConfig) KeyDirConfig() (string, error)

KeyDirConfig determines the settings for keydirectory

type P2PConfig

type P2PConfig struct {
	NoDiscovery         bool     `json:"no_discovery" yaml:"no_discovery"`
	EnableUPnP          bool     `json:"enable_upnp" yaml:"enable_upnp"`
	StaticPeerID        bool     `json:"static_peer_id" yaml:"static_peer_id"`
	StaticPeers         []string `json:"static_peers" yaml:"static_peers"`
	BootstrapNodeAddr   []string `json:"bootstrap_node_addr" yaml:"bootstrap_node_addr"`
	Discv5BootStrapAddr []string `json:"discv5_bootstrap_addr" yaml:"discv5_bootstrap_addr"`
	RelayNodeAddr       string   `json:"relay_node_addr" yaml:"relay_node_addr"`
	LocalIP             string   `json:"local_ip" yaml:"local_ip"`
	HostAddress         string   `json:"host_address" yaml:"host_address"`
	HostDNS             string   `json:"host_dns" yaml:"host_dns"`
	PrivateKey          string   `json:"private_key" yaml:"private_key"`
	DataDir             string   `json:"data_dir" yaml:"data_dir"`
	MetaDataDir         string   `json:"metadata_dir" yaml:"metadata_dir"`
	TCPPort             int      `json:"tcp_port" yaml:"tcp_port"`
	UDPPort             int      `json:"udp_port" yaml:"udp_port"`
	MaxPeers            int      `json:"max_peers" yaml:"max_peers"`
	AllowListCIDR       string   `json:"allow_list_cidr" yaml:"allow_list_cidr"`
	DenyListCIDR        []string `json:"deny_list_cidr" yaml:"deny_list_cidr"`
	MinSyncPeers        int      `json:"min_sync_peers" yaml:"min_sync_peers"`

	P2PLimit *P2PLimit
}

type P2PLimit

type P2PLimit struct {
	BlockBatchLimit            int `json:"block_batch_limit" yaml:"block_batch_limit"`
	BlockBatchLimitBurstFactor int `json:"block_batch_limit_burst_factor" yaml:"block_batch_limit_burst_factor"`
	BlockBatchLimiterPeriod    int `json:"block_batch_limiter_period" yaml:"block_batch_limiter_period"`
}

type PprofConfig

type PprofConfig struct {
	MaxCpu     int  `json:"cpu" yaml:"cpu"`
	Port       int  `json:"port" yaml:"port"`
	TraceMutex bool `json:"trace_mutex" yaml:"trace_mutex"`
	TraceBlock bool `json:"trace_block" yaml:"trace_block"`
	Pprof      bool `json:"pprof" yaml:"pprof"`
}

Jump to

Keyboard shortcuts

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