config

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicChain added in v0.46.0

type BasicChain struct {
	DialTimeout         time.Duration `mapstructure:"dial_timeout"`
	ReconnectionsNumber int           `mapstructure:"reconnections_number"`
	ReconnectionsDelay  time.Duration `mapstructure:"reconnections_delay"`
	Endpoints           []string      `mapstructure:"endpoints"`
}

BasicChain configures basic settings for every chain.

type BasicService added in v0.46.0

type BasicService struct {
	Enabled         bool          `mapstructure:"enabled"`
	Address         string        `mapstructure:"address"`
	ShutdownTimeout time.Duration `mapstructure:"shutdown_timeout"`
}

BasicService configures settings of basic external service like pprof or prometheus.

type BasicTimer added in v0.46.0

type BasicTimer struct {
	Mul uint32 `mapstructure:"mul"`
	Div uint32 `mapstructure:"div"`
}

BasicTimer configures basic settings for all Timers.

type Chain added in v0.46.0

type Chain struct {
	BasicChain `mapstructure:",squash"`
	Validators keys.PublicKeys `mapstructure:"validators"`
	Consensus  Consensus       `mapstructure:"consensus"`
}

Chain configures settings of FS chain.

type Config added in v0.46.0

type Config struct {
	Logger Logger `mapstructure:"logger"`

	// NEO Wallet of the node. The wallet is used by Consensus and Notary services.
	//
	// Required.
	Wallet Wallet `mapstructure:"wallet"`

	WithoutMainnet bool `mapstructure:"without_mainnet"`

	FSChain Chain `mapstructure:"fschain"`

	FSChainAutodeploy bool `mapstructure:"fschain_autodeploy"`

	NNS NNS `mapstructure:"nns"`

	Mainnet BasicChain `mapstructure:"mainnet"`

	Control Control `mapstructure:"control"`

	Governance Governance `mapstructure:"governance"`

	Node Node `mapstructure:"node"`

	// Fee is an instance that returns extra fee values for contract
	// invocations without notary support.
	Fee Fee `mapstructure:"fee"`

	Timers Timers `mapstructure:"timers"`

	Emit Emit `mapstructure:"emit"`

	Workers Workers `mapstructure:"workers"`

	Indexer Indexer `mapstructure:"indexer"`

	Contracts Contracts `mapstructure:"contracts"`

	Pprof BasicService `mapstructure:"pprof"`

	Prometheus BasicService `mapstructure:"prometheus"`

	Validator Validator `mapstructure:"sn_validator"`

	Settlement Settlement `mapstructure:"settlement"`

	Experimental Experimental `mapstructure:"experimental"`
	// contains filtered or unexported fields
}

Config configures IR node.

func (*Config) IsSet added in v0.46.0

func (c *Config) IsSet(key string) bool

IsSet checks if the key is set in the config.

func (*Config) Set added in v0.46.0

func (c *Config) Set(key string)

Set specifies that the key has been set in the config.

func (*Config) Unset added in v0.46.0

func (c *Config) Unset(key string)

Unset ensures that the key is unset in the config.

func (*Config) UnsetAll added in v0.46.0

func (c *Config) UnsetAll()

UnsetAll unsets all keys from config.

type Consensus added in v0.46.0

type Consensus struct {
	// Identifier of the Neo network.
	//
	// Required.
	Magic uint32 `mapstructure:"magic"`

	// Initial committee staff.
	//
	// Required.
	Committee keys.PublicKeys `mapstructure:"committee"`

	// Storage configuration. Must be set using one of constructors like BoltDB.
	//
	// Required.
	Storage Storage `mapstructure:"storage"`

	// Time period (approximate) between two adjacent blocks. If used
	// with MaxTimePerBlock, specifies minimal time.
	//
	// Optional: defaults to 15s. Must not be negative.
	TimePerBlock time.Duration `mapstructure:"time_per_block"`

	// Maximum time period (approximate) between two adjacent blocks,
	// if used enables dynamic block time (contrary to TimePerBlock
	// targeting for every block).
	//
	// Optional: not set by default. Must not be negative, must be
	// bigger than TimePerBlock.
	MaxTimePerBlock time.Duration `mapstructure:"max_time_per_block"`

	// Length of the chain accessible to smart contracts.
	//
	// Optional: defaults to 17280.
	MaxTraceableBlocks uint32 `mapstructure:"max_traceable_blocks"`

	// Transaction validity limit relative to the current height.
	//
	// Optional: defaults to 8640.
	MaxValidUntilBlockIncrement uint32 `mapstructure:"max_valid_until_block_increment"`

	// List of nodes' addresses to communicate with over Neo P2P protocol in
	// 'host:port' format.
	//
	// Optional: by default, node runs as standalone.
	SeedNodes []string `mapstructure:"seed_nodes"`

	// Maps hard-fork's name to the appearance chain height.
	//
	// Optional: by default, each known hard-fork is applied from the zero
	// blockchain height.
	Hardforks Hardforks `mapstructure:"hardforks"`

	// Maps chain height to number of consensus nodes.
	//
	// Optional: by default Committee size is used. Each value must be positive and
	// must not exceed Committee length. Value for zero key (genesis height) is
	// required.
	ValidatorsHistory ValidatorsHistory `mapstructure:"validators_history"`

	// Neo RPC service configuration.
	//
	// Optional: see RPC defaults.
	RPC RPC `mapstructure:"rpc"`

	// P2P settings.
	//
	// Required.
	P2P P2P `mapstructure:"p2p"`

	// Whether to designate [noderoles.P2PNotary] and [noderoles.NeoFSAlphabet]
	// roles to the Committee (keep an eye on ValidatorsHistory) for genesis block
	// in the RoleManagement contract.
	//
	// Optional: by default, roles are unset.
	SetRolesInGenesis bool `mapstructure:"set_roles_in_genesis"`

	// KeepOnlyLatestState specifies if MPT should only store the latest state.
	// If true, DB size will be smaller, but older roots won't be accessible.
	// This value should remain the same for the same database.
	//
	// Optional: by default, false.
	KeepOnlyLatestState bool `mapstructure:"keep_only_latest_state"`

	// RemoveUntraceableBlocks specifies if old data should be removed.
	//
	// Optional: by default, false.
	RemoveUntraceableBlocks bool `mapstructure:"remove_untraceable_blocks"`

	// Memory pool size for P2PNotaryRequestPayloads.
	//
	// Optional: defaults to 1000.
	P2PNotaryRequestPayloadPoolSize uint32 `mapstructure:"p2p_notary_request_payload_pool_size"`
}

Consensus configures Blockchain. All required fields must be set. Specified optional fields tune Blockchain's default behavior (zero or omitted values).

See docs of NeoGo configuration for some details.

type Contracts added in v0.46.0

type Contracts struct {
	NeoFS      string `mapstructure:"neofs"`
	Processing string `mapstructure:"processing"`
}

Contracts configures addresses of contracts in mainchain.

type Control added in v0.46.0

type Control struct {
	AuthorizedKeys keys.PublicKeys `mapstructure:"authorized_keys"`
	GRPC           GRPC            `mapstructure:"grpc"`
}

Control configures control service of IR node.

type Emit added in v0.46.0

type Emit struct {
	Storage EmitStorage `mapstructure:"storage"`
	Mint    Mint        `mapstructure:"mint"`
	Gas     Gas         `mapstructure:"gas"`
}

Emit configures settings of GAS emission.

type EmitStorage added in v0.46.0

type EmitStorage struct {
	Amount uint64 `mapstructure:"amount"`
}

EmitStorage configures amount of sidechain GAS emitted to all storage nodes once per GAS emission cycle.

type Experimental added in v0.46.0

type Experimental struct {
	ChainMetaData bool `mapstructure:"chain_meta_data"`
}

Experimental configures experimental features.

type Fee added in v0.46.0

type Fee struct {
	MainChain int64 `mapstructure:"main_chain"`
}

Fee configures extra GAS fee for mainchain contract invocation.

type GRPC added in v0.46.0

type GRPC struct {
	Endpoint string `mapstructure:"endpoint"`
}

GRPC configures settings of the grpc protocol.

type Gas added in v0.46.0

type Gas struct {
	BalanceThreshold int64 `mapstructure:"balance_threshold"`
}

Gas configures value of IR wallet balance threshold when GAS emission for deposit receivers is disabled.

type Governance added in v0.46.0

type Governance struct {
	Disable bool `mapstructure:"disable"`
}

Governance configures synchronization of sidechain committee and mainchain role management contract.

type Hardforks added in v0.46.0

type Hardforks struct {
	Name map[string]uint32 `mapstructure:",remain"`
}

Hardforks configures the matching of hard-fork's name to the appearance chain height.

type Indexer added in v0.46.0

type Indexer struct {
	CacheTimeout time.Duration `mapstructure:"cache_timeout"`
}

Indexer configures duration between internal state update about current list of inner ring nodes.

type Logger added in v0.46.0

type Logger struct {
	Level     string   `mapstructure:"level"`
	Encoding  string   `mapstructure:"encoding"`
	Timestamp bool     `mapstructure:"timestamp"`
	Sampling  Sampling `mapstructure:"sampling"`
}

Logger configures logger settings.

type Mint added in v0.46.0

type Mint struct {
	Value     int64  `mapstructure:"value"`
	CacheSize int    `mapstructure:"cache_size"`
	Threshold uint64 `mapstructure:"threshold"`
}

Mint configures settings about received deposit from mainchain.

type NNS added in v0.46.0

type NNS struct {
	SystemEmail string `mapstructure:"system_email"`
}

NNS configures NNS domains processed during the FS chain deployment.

type Node added in v0.46.0

type Node struct {
	PersistentState PersistentState `mapstructure:"persistent_state"`
}

Node configures application state.

type P2P added in v0.46.0

type P2P struct {
	// Maximum duration a single dial may take.
	//
	// Optional: defaults to 1m. Must not be negative.
	DialTimeout time.Duration `mapstructure:"dial_timeout"`

	// Interval between protocol ticks with each connected peer.
	//
	// Optional: defaults to 2s. Must not be negative.
	ProtoTickInterval time.Duration `mapstructure:"proto_tick_interval"`

	// Network addresses to listen Neo P2P on. Each element must be a valid TCP
	// address in 'host:port' format.
	//
	// Optional: by default, Neo P2P is not served.
	Listen []string `mapstructure:"listen"`

	Peers Peers `mapstructure:"peers"`

	// Pinging mechanism.
	//
	// Optional: see P2P defaults.
	Ping Ping `mapstructure:"ping"`
}

P2P configures communication over Neo P2P protocol.

type Peers added in v0.46.0

type Peers struct {
	// Specifies the minimum number of peers a node needs for normal operation.
	//
	// Required. Must not be larger than math.MaxInt32.
	Min uint32 `mapstructure:"min"`

	// Limits maximum number of peers dealing with the node.
	//
	// Optional: defaults to 100. Must not be larger than math.MaxInt32.
	Max uint32 `mapstructure:"max"`

	// Specifies how many peers node should try to dial when connection counter
	// drops below the Min value.
	//
	// Optional: defaults to Min+10. Must not be greater than math.MaxInt32.
	Attempts uint32 `mapstructure:"attempts"`
}

Peers configures peers.

type PersistentState added in v0.46.0

type PersistentState struct {
	Path string `mapstructure:"path"`
}

PersistentState configures persistent state.

type Ping added in v0.46.0

type Ping struct {
	// Interval between pings.
	//
	// Optional: defaults to 30s. Must not be negative.
	Interval time.Duration `mapstructure:"interval"`

	// Time period to wait for pong.
	//
	// Optional: defaults to 1m. Must not be negative.
	Timeout time.Duration `mapstructure:"timeout"`
}

Ping configures P2P pinging mechanism.

type RPC added in v0.46.0

type RPC struct {
	// Network addresses to listen Neo RPC on. Each element must be a valid TCP
	// address in 'host:port' format.
	//
	// Optional: by default, insecure Neo RPC is not served.
	Listen []string `mapstructure:"listen"`

	// The maximum simultaneous websocket client connection number.
	//
	// Optional: defaults to 64. Must not be larger than math.MaxInt32.
	MaxWebSocketClients uint32 `mapstructure:"max_websocket_clients"`

	// The maximum number of concurrent iterator sessions.
	//
	// Optional: defaults to 20. Must not be larger than math.MaxInt32.
	SessionPoolSize uint32 `mapstructure:"session_pool_size"`

	// The maximum amount of GAS which can be spent during an RPC call.
	//
	// Optional: defaults to 100. Must not be larger than math.MaxInt32.
	MaxGasInvoke uint32 `mapstructure:"max_gas_invoke"`

	// Additional addresses that use TLS.
	//
	// Optional.
	TLS TLS `mapstructure:"tls"`
}

RPC configures RPC serving.

type Sampling added in v0.47.0

type Sampling struct {
	Enabled bool `mapstructure:"enabled"`
}

Sampling configures log sampling.

type Settlement added in v0.46.0

type Settlement struct {
	BasicIncomeRate int64 `mapstructure:"basic_income_rate"`
}

Settlement overrides some settlements from network config. Applied only in debug mode.

type Storage added in v0.46.0

type Storage struct {
	Type string `mapstructure:"type"`
	Path string `mapstructure:"path"`
}

Storage configures Blockchain storage.

type TLS added in v0.46.0

type TLS struct {
	// Additional TLS serving switcher.
	//
	// Optional: by default TLS is switched off.
	Enabled bool `mapstructure:"enabled"`

	// Network addresses to listen Neo RPC on if Enabled. Each element must be a valid TCP
	// address in 'host:port' format.
	Listen []string `mapstructure:"listen"`

	// TLS certificate file path.
	//
	// Required if Enabled and one or more addresses are provided.
	CertFile string `mapstructure:"cert_file"`

	// TLS private key file path.
	//
	// Required if Enabled and one or more addresses are provided.
	KeyFile string `mapstructure:"key_file"`
}

TLS configures additional RPC serving over TLS.

type Timers added in v0.46.0

type Timers struct {
	StopEstimation        BasicTimer `mapstructure:"stop_estimation"`
	CollectBasicIncome    BasicTimer `mapstructure:"collect_basic_income"`
	DistributeBasicIncome BasicTimer `mapstructure:"distribute_basic_income"`
}

Timers configures timers for operations within the epoch.

type Validator added in v0.47.0

type Validator struct {
	Enabled bool   `mapstructure:"enabled"`
	URL     string `mapstructure:"url"`
}

Validator represents the configuration for an external validation service.

type ValidatorsHistory added in v0.46.0

type ValidatorsHistory struct {
	Height map[uint32]uint32 `mapstructure:",remain"`
}

ValidatorsHistory configures the matching of chain height to number of consensus nodes.

type Wallet added in v0.46.0

type Wallet struct {
	Path     string `mapstructure:"path"`
	Address  string `mapstructure:"address"`
	Password string `mapstructure:"password"`
}

Wallet configures NEO wallet settings.

type Workers added in v0.46.0

type Workers struct {
	Alphabet   int `mapstructure:"alphabet"`
	Balance    int `mapstructure:"balance"`
	Container  int `mapstructure:"container"`
	NeoFS      int `mapstructure:"neofs"`
	Netmap     int `mapstructure:"netmap"`
	Reputation int `mapstructure:"reputation"`
}

Workers configures number of workers to process events from contracts in parallel.

Jump to

Keyboard shortcuts

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