node

package
v0.27.1 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package node wires storage, state, consensus, chain, mempool and networking into a runnable ShadowLedger daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DataDir     string            `yaml:"data_dir"`
	ControlAddr string            `yaml:"control_addr"` // e.g. ":4004"
	ShardAddr   string            `yaml:"shard_addr"`   // e.g. ":4005"
	Advertise   string            `yaml:"advertise"`    // host others reach us at (default localhost)
	NodeKey     string            `yaml:"node_key"`     // path to identity wallet json
	Validators  []crypto.Address  `yaml:"validators"`   // authorized producer addresses
	Seeds       []string          `yaml:"seeds"`        // bootstrap control URLs (entry points)
	DNSSeeds    []string          `yaml:"dns_seeds"`    // DNS seed hostnames (A/AAAA list live node IPs)
	Consensus   string            `yaml:"consensus"`    // "authority" (default) | "postorage"
	BlockTimeMS int               `yaml:"block_time_ms"`
	Genesis     map[string]uint64 `yaml:"genesis"` // address -> funding (producer bootstrap)
}

Config is the node daemon configuration (YAML).

NOTE: erasure parameters (K/M) and shard replication are NOT configured here. The network decides them adaptively from the live node count (package netparams). Operators only choose identity, endpoints, who they trust as validators, and how to find the network.

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig reads and defaults a config file.

func LoadConfigOrMainnet added in v0.7.0

func LoadConfigOrMainnet(path string) (*Config, error)

LoadConfigOrMainnet loads the config at path, or — if it does not exist — returns the embedded mainnet config so `slnode` runs with ZERO setup (like `bitcoind` connecting to Bitcoin mainnet out of the box). A partial config is merged over the embedded network params, so an operator only overrides what they care about (e.g. node_key + advertise for the validator node).

func MainnetConfig added in v0.7.0

func MainnetConfig() *Config

MainnetConfig is the fully-defaulted embedded mainnet configuration.

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node is a running daemon.

func New

func New(cfg *Config) (*Node, error)

New constructs a node from config.

func (*Node) Address

func (n *Node) Address() crypto.Address

Address returns the node identity address.

func (*Node) Run

func (n *Node) Run(ctx context.Context) error

Run starts servers, discovery, sync and the production loop until ctx is done.

Jump to

Keyboard shortcuts

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