config

package
v0.19.5 Latest Latest
Warning

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

Go to latest
Published: May 3, 2020 License: LGPL-3.0 Imports: 15 Imported by: 9

Documentation

Index

Constants

View Source
const (
	DefaultDataDir          = "datadir"
	DefaultPort             = 40404
	DefaultRpcHost          = "localhost"
	DefaultRpcPort          = 9009
	DefaultIpfsDataDir      = "ipfs"
	DefaultIpfsPort         = 40405
	DefaultGodAddress       = "0x4d60dc6a2cba8c3ef1ba5e1eba5c12c54cee6b61"
	DefaultCeremonyTime     = int64(1567171800)
	DefaultSwarmKey         = "9ad6f96bb2b02a7308ad87938d6139a974b550cc029ce416641a60c46db2f530"
	DefaultForceFullSync    = 100
	DefaultStoreCertRange   = 2000
	DefaultMaxInboundPeers  = 12
	DefaultMaxOutboundPeers = 6
	DefaultBurntTxRange     = 180

	LowPowerMaxInboundPeers  = 6
	LowPowerMaxOutboundPeers = 3
)
View Source
const (
	FlipLottery      = 5 * time.Minute
	ShortSession     = 2 * time.Minute
	AfterLongSession = 1 * time.Minute
)
View Source
const (
	LowPowerProfile = "lowpower"
)

Variables

View Source
var (
	DefaultIpfsBootstrapNodes = []string{
		"/ip4/206.81.23.186/tcp/40403/ipfs/QmTHDLnNMAp6K8txLmJW6EHUbwoHTGhkEUBCp4gAtpNqKY",
		"/ip4/165.227.91.202/tcp/40403/ipfs/QmZ9VnVZsokXEttRYiHbHmCUBSdzSQywjj5wM3Me96XoVD",
	}
	CfgFileFlag = cli.StringFlag{
		Name:  "config",
		Usage: "JSON configuration file",
	}
	DataDirFlag = cli.StringFlag{
		Name:  "datadir",
		Usage: "datadir for blockchain",
	}
	TcpPortFlag = cli.IntFlag{
		Name:  "port",
		Usage: "Network listening port",
	}
	RpcHostFlag = cli.StringFlag{
		Name:  "rpcaddr",
		Usage: "RPC listening address",
	}
	RpcPortFlag = cli.IntFlag{
		Name:  "rpcport",
		Usage: "RPC listening port",
	}
	BootNodeFlag = cli.StringFlag{
		Name:  "bootnode",
		Usage: "Bootstrap node url",
	}
	AutomineFlag = cli.BoolFlag{
		Name:  "automine",
		Usage: "Mine blocks alone without peers",
	}
	IpfsBootNodeFlag = cli.StringFlag{
		Name:  "ipfsbootnode",
		Usage: "Ipfs bootstrap node (overrides existing)",
	}
	IpfsPortFlag = cli.IntFlag{
		Name:  "ipfsport",
		Usage: "Ipfs port",
	}
	NoDiscoveryFlag = cli.BoolFlag{
		Name:  "nodiscovery",
		Usage: "NoDiscovery can be used to disable the peer discovery mechanism.",
	}
	VerbosityFlag = cli.IntFlag{
		Name:  "verbosity",
		Usage: "Log verbosity",
		Value: 3,
	}
	GodAddressFlag = cli.StringFlag{
		Name:  "godaddress",
		Usage: "Idena god address",
	}
	CeremonyTimeFlag = cli.Int64Flag{
		Name:  "ceremonytime",
		Usage: "First ceremony time (unix)",
	}
	MaxNetworkDelayFlag = cli.IntFlag{
		Name:  "maxnetdelay",
		Usage: "Max network delay for broadcasting",
	}
	FastSyncFlag = cli.BoolFlag{
		Name:  "fast",
		Usage: "Enable fast sync",
	}
	ForceFullSyncFlag = cli.Uint64Flag{
		Name:  "forcefullsync",
		Usage: "Force full sync on last blocks",
	}
	ProfileFlag = cli.StringFlag{
		Name:  "profile",
		Usage: "Configuration profile",
	}
	IpfsPortStaticFlag = cli.BoolFlag{
		Name:  "ipfsportstatic",
		Usage: "Enable static ipfs port",
	}
	ApiKeyFlag = cli.StringFlag{
		Name:  "apikey",
		Usage: "Set RPC api key",
	}
	LogFileSizeFlag = cli.IntFlag{
		Name:  "logfilesize",
		Usage: "Set log file size in KB",
		Value: 1024 * 10,
	}
	LogColoring = cli.BoolFlag{
		Name:  "logcoloring",
		Usage: "Use log coloring",
	}
)

Functions

This section is empty.

Types

type BlockchainConfig

type BlockchainConfig struct {
	// distance between blocks with permanent certificates
	StoreCertRange uint64
	BurnTxRange    uint64
}

type Config

type Config struct {
	DataDir          string
	Network          uint32
	Consensus        *ConsensusConf
	P2P              P2P
	RPC              *rpc.Config
	GenesisConf      *GenesisConf
	IpfsConf         *IpfsConfig
	Validation       *ValidationConfig
	Sync             *SyncConfig
	OfflineDetection *OfflineDetectionConfig
	Blockchain       *BlockchainConfig
	Mempool          *Mempool
}

func MakeConfig

func MakeConfig(ctx *cli.Context) (*Config, error)

func MakeConfigFromFile

func MakeConfigFromFile(file string) (*Config, error)

func MakeMobileConfig

func MakeMobileConfig(path string, cfg string) (*Config, error)

func (*Config) KeyStoreDataDir

func (c *Config) KeyStoreDataDir() (string, error)

func (*Config) NodeDB

func (c *Config) NodeDB() string

NodeDB returns the path to the discovery node database.

func (*Config) NodeKey

func (c *Config) NodeKey() *ecdsa.PrivateKey

func (*Config) ProvideNodeKey

func (c *Config) ProvideNodeKey(key string, password string, withBackup bool) error

func (*Config) SetApiKey

func (c *Config) SetApiKey() error

type ConsensusConf

type ConsensusConf struct {
	MaxSteps                          uint8
	AgreementThreshold                float64
	CommitteePercent                  float64
	FinalCommitteePercent             float64
	WaitBlockDelay                    time.Duration
	WaitSortitionProofDelay           time.Duration
	EstimatedBaVariance               time.Duration
	WaitForStepDelay                  time.Duration
	Automine                          bool
	BlockReward                       *big.Int
	StakeRewardRate                   float32
	StakeRewardRateForNewbie          float32
	FinalCommitteeReward              *big.Int
	FeeBurnRate                       float32
	SnapshotRange                     uint64
	OfflinePenaltyBlocksCount         int64
	SuccessfulValidationRewardPercent float32
	FlipRewardPercent                 float32
	ValidInvitationRewardPercent      float32
	FoundationPayoutsPercent          float32
	ZeroWalletPercent                 float32
	FirstInvitationRewardCoef         float32
	SecondInvitationRewardCoef        float32
	ThirdInvitationRewardCoef         float32
	SavedInviteRewardCoef             float32
	SavedInviteWinnerRewardCoef       float32
	FeeSensitivityCoef                float32
	MinFeePerByte                     *big.Int
	MinBlockDistance                  time.Duration
	MaxCommitteeSize                  int
	StatusSwitchRange                 uint64
	InvitesPercent                    float32
}

func GetDefaultConsensusConfig

func GetDefaultConsensusConfig() *ConsensusConf

type GenesisAllocation

type GenesisAllocation struct {
	Balance *big.Int
	Stake   *big.Int
	State   uint8
}

type GenesisConf

type GenesisConf struct {
	Alloc             map[common.Address]GenesisAllocation
	GodAddress        common.Address
	FirstCeremonyTime int64
	GodAddressInvites uint16
}

type IpfsConfig

type IpfsConfig struct {
	DataDir            string
	BootNodes          []string
	IpfsPort           int
	StaticPort         bool
	SwarmKey           string
	Routing            string
	LowWater           int
	HighWater          int
	GracePeriod        string
	ReproviderInterval string
	Profile            string
	BlockPinThreshold  float32
	FlipPinThreshold   float32
}

func GetDefaultIpfsConfig added in v0.19.2

func GetDefaultIpfsConfig() *IpfsConfig

type Mempool added in v0.19.2

type Mempool struct {
	TxPoolQueueSlots      int
	TxPoolExecutableSlots int

	TxPoolAddrQueueLimit      int
	TxPoolAddrExecutableLimit int
	TxLifetime                time.Duration
}

func GetDefaultMempoolConfig added in v0.19.2

func GetDefaultMempoolConfig() *Mempool

type OfflineDetectionConfig

type OfflineDetectionConfig struct {
	PersistInterval             int
	MaxSelfOffline              time.Duration
	OfflineProposeInterval      time.Duration
	OfflineVoteInterval         time.Duration
	IntervalBetweenOfflineRetry time.Duration
}

func GetDefaultOfflineDetectionConfig

func GetDefaultOfflineDetectionConfig() *OfflineDetectionConfig

type P2P

type P2P struct {
	MaxInboundPeers  int
	MaxOutboundPeers int
	MaxDelay         int
	CollectMetrics   bool
}

type SyncConfig

type SyncConfig struct {
	FastSync      bool
	ForceFullSync uint64
}

type ValidationConfig

type ValidationConfig struct {
	// Do not use directly
	ValidationInterval time.Duration
	// Do not use directly
	FlipLotteryDuration time.Duration
	// Do not use directly
	ShortSessionDuration time.Duration
	// Do not use directly
	LongSessionDuration time.Duration
	// Do not use directly
	AfterLongSessionDuration time.Duration
}

func (*ValidationConfig) GetAfterLongSessionDuration

func (cfg *ValidationConfig) GetAfterLongSessionDuration() time.Duration

func (*ValidationConfig) GetFlipLotteryDuration

func (cfg *ValidationConfig) GetFlipLotteryDuration() time.Duration

func (*ValidationConfig) GetLongSessionDuration

func (cfg *ValidationConfig) GetLongSessionDuration(networkSize int) time.Duration

func (*ValidationConfig) GetNextValidationTime

func (cfg *ValidationConfig) GetNextValidationTime(validationTime time.Time, networkSize int) time.Time

func (*ValidationConfig) GetShortSessionDuration

func (cfg *ValidationConfig) GetShortSessionDuration() time.Duration

Jump to

Keyboard shortcuts

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