skycoin

package
v0.0.0-...-4a7a8e8 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTransaction

func InitTransaction() coin.Transaction

InitTransaction creates the initialize transaction

Types

type BuildParameters

type BuildParameters struct {
	Version string `mapstructure:"version"` // node version
	Commit  string `mapstructure:"commit"`  // git commit id
	Branch  string `mapstructure:"branch"`  // git branch name
}

BuildParameters records build info

type Coin

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

Coin represents a fiber coin instance

func NewCoin

func NewCoin(config Config, logger *logging.Logger) *Coin

NewCoin returns a new fiber coin instance

func (*Coin) ParseConfig

func (c *Coin) ParseConfig()

ParseConfig prepare the config

func (*Coin) Run

func (c *Coin) Run()

Run starts the node

type Config

type Config struct {
	Node  NodeConfig
	Build visor.BuildInfo
}

Config records skycoin node and build config

type NodeConfig

type NodeConfig struct {
	// Disable peer exchange
	DisablePEX bool
	// Download peer list
	DownloadPeerList bool
	// Download the peers list from this URL
	PeerListURL string
	// Don't make any outgoing connections
	DisableOutgoingConnections bool
	// Don't allowing incoming connections
	DisableIncomingConnections bool
	// Disables networking altogether
	DisableNetworking bool
	// Enable wallet API
	EnableWalletAPI bool
	// Enable GUI
	EnableGUI bool
	// Disable CSRF check in the wallet API
	DisableCSRF bool
	// Enable /api/v1/wallet/seed API endpoint
	EnableSeedAPI bool
	// Enable unversioned API endpoints (without the /api/v1 prefix)
	EnableUnversionedAPI bool
	// Disable CSP disable content-security-policy in http response
	DisableCSP bool

	// Only run on localhost and only connect to others on localhost
	LocalhostOnly bool
	// Which address to serve on. Leave blank to automatically assign to a
	// public interface
	Address string
	// gnet uses this for TCP incoming and outgoing
	Port int
	// Maximum outgoing connections to maintain
	MaxOutgoingConnections int
	// Maximum default outgoing connections
	MaxDefaultPeerOutgoingConnections int
	// How often to make outgoing connections
	OutgoingConnectionsRate time.Duration
	// PeerlistSize represents the maximum number of peers that the pex would maintain
	PeerlistSize int
	// Wallet Address Version
	//AddressVersion string
	// Remote web interface
	WebInterface      bool
	WebInterfacePort  int
	WebInterfaceAddr  string
	WebInterfaceCert  string
	WebInterfaceKey   string
	WebInterfaceHTTPS bool

	RPCInterface bool

	// Launch System Default Browser after client startup
	LaunchBrowser bool

	// If true, print the configured client web interface address and exit
	PrintWebInterfaceAddress bool

	// Data directory holds app data -- defaults to ~/.skycoin
	DataDirectory string
	// GUI directory contains assets for the HTML interface
	GUIDirectory string

	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration

	// Logging
	ColorLog bool
	// This is the value registered with flag, it is converted to LogLevel after parsing
	LogLevel string
	// Disable "Reply to ping", "Received pong" log messages
	DisablePingPong bool

	// Verify the database integrity after loading
	VerifyDB bool
	// Reset the database if integrity checks fail, and continue running
	ResetCorruptDB bool

	// Wallets
	// Defaults to ${DataDirectory}/wallets/
	WalletDirectory string
	// Wallet crypto type
	WalletCryptoType string

	RunMaster bool

	// Enable cpu profiling
	ProfileCPU bool
	// Where the file is written to
	ProfileCPUFile string
	// HTTP profiling interface (see http://golang.org/pkg/net/http/pprof/)
	HTTPProf bool

	DBPath      string
	DBReadOnly  bool
	Arbitrating bool
	LogToFile   bool
	Version     bool // show node version

	GenesisSignatureStr string
	GenesisAddressStr   string
	BlockchainPubkeyStr string
	BlockchainSeckeyStr string
	GenesisTimestamp    uint64
	GenesisCoinVolume   uint64
	DefaultConnections  []string

	LoadingLockAddrs bool
	// contains filtered or unexported fields
}

NodeConfig records the node's configuration

func NewNodeConfig

func NewNodeConfig(mode string, node NodeParameters) *NodeConfig

NewNodeConfig returns a new node config instance

type NodeParameters

type NodeParameters struct {
	PeerListURL         string   `mapstructure:"peer_list_url"`
	Port                int      `mapstructure:"port"`
	WebInterfacePort    int      `mapstructure:"web_interface_port"`
	GenesisSignatureStr string   `mapstructure:"genesis_signature_str"`
	GenesisAddressStr   string   `mapstructure:"genesis_address_str"`
	BlockchainPubkeyStr string   `mapstructure:"blockchain_pubkey_str"`
	BlockchainSeckeyStr string   `mapstructure:"blockchain_seckey_str"`
	GenesisTimestamp    uint64   `mapstructure:"genesis_timestamp"`
	GenesisCoinVolume   uint64   `mapstructure:"genesis_coin_volume"`
	DefaultConnections  []string `mapstructure:"default_connections"`

	DataDirectory  string
	ProfileCPUFile string
}

NodeParameters records the node's configurable parameters

type Parameters

type Parameters struct {
	Node  NodeParameters  `mapstructure:"node"`
	Build BuildParameters `mapstructure:"build"`
	Visor VisorParameters `mapstructure:"visor"`
}

Parameters records fiber coin parameters

func NewParameters

func NewParameters(configName, appDir string) (Parameters, error)

NewParameters loads blockchain config parameters from a config file default file is: fiber.toml in the project root JSON, toml or yaml file can be used (toml preferred).

type VisorParameters

type VisorParameters struct {
	// MaxCoinSupply is the maximum supply of coins
	MaxCoinSupply uint64 `mapstructure:"max_coin_supply"`

	// DistributionAddressesTotal is the number of distribution addresses
	DistributionAddressesTotal uint64 `mapstructure:"distribution_addresses_total"`

	// DistributionAddressInitialBalance is the initial balance of each distribution address
	DistributionAddressInitialBalance uint64

	// InitialUnlockedCount is the initial number of unlocked addresses
	InitialUnlockedCount uint64 `mapstructure:"initial_unlocked_count"`

	// UnlockAddressRate is the number of addresses to unlock per unlock time interval
	UnlockAddressRate uint64 `mapstructure:"unlock_address_rate"`

	// UnlockTimeInterval is the distribution address unlock time interval, measured in seconds
	// Once the InitialUnlockedCount is exhausted,
	// UnlockAddressRate addresses will be unlocked per UnlockTimeInterval
	UnlockTimeInterval uint64 `mapstructure:"unlock_time_interval"`

	// MaxDropletPrecision represents the decimal precision of droplets
	MaxDropletPrecision uint64 `mapstructure:"max_droplet_precision"`

	//DefaultMaxBlockSize is max block size
	DefaultMaxBlockSize int `mapstructure:"default_max_block_size"`

	DistributionAddresses []string `mapstructure:"distribution_addresses"`
}

VisorParameters are the parameters used to generate parameters.go in visor

Jump to

Keyboard shortcuts

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