config

package
v1.0.5-beta Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2019 License: Apache-2.0 Imports: 18 Imported by: 41

Documentation

Index

Constants

View Source
const (
	MaxUint                      = ^uint(0)
	MaxInt                       = int(MaxUint >> 1)
	MaxNumTxnPerBlock            = 4096
	MaxBlockSize                 = 1 * 1024 * 1024 // in bytes
	ConsensusDuration            = 20 * time.Second
	ConsensusTimeout             = 60 * time.Second
	MinNumSuccessors             = 8
	NodeIDBytes                  = 32
	MaxRollbackBlocks            = 180
	SigChainBlockDelay           = 1
	SigChainPropogationTime      = 2
	HeaderVersion                = 1
	DBVersion                    = 0x01
	InitialIssueAddress          = "NKNFCrUMFPkSeDRMG2ME21hD6wBCA2poc347"
	InitialIssueAmount           = 700000000 * common.StorageFactor
	TotalMiningRewards           = 300000000 * common.StorageFactor
	TotalRewardDuration          = uint32(25)
	InitialReward                = common.Fixed64(18000000 * common.StorageFactor)
	RewardAdjustInterval         = 365 * 24 * 60 * 60 / int(ConsensusDuration/time.Second)
	ReductionAmount              = common.Fixed64(500000 * common.StorageFactor)
	DonationAddress              = "NKNaaaaaaaaaaaaaaaaaaaaaaaaaaaeJ6gxa"
	DonationAdjustDividendFactor = 1
	DonationAdjustDivisorFactor  = 2
	MinGenIDRegistrationFee      = 0
	GenerateIDBlockDelay         = 8
	RandomBeaconUniqueLength     = vrf.Size
	RandomBeaconLength           = vrf.Size + vrf.ProofSize
	ProtocolVersion              = 30
	MinCompatibleProtocolVersion = 30
	MaxCompatibleProtocolVersion = 39
	DefaultTxPoolCap             = 32
	ShortHashSize                = uint32(8)
	MaxAssetPrecision            = uint32(8)
	NKNAssetName                 = "NKN"
	NKNAssetSymbol               = "nkn"
	NKNAssetPrecision            = uint32(8)
	GASAssetName                 = "New Network Coin"
	GASAssetSymbol               = "nnc"
	GASAssetPrecision            = uint32(8)
)
View Source
const DefaultConfigFile = "config.json"

Variables

View Source
var (
	ShortHashSalt    = util.RandomBytes(32)
	GenesisTimestamp = time.Date(2019, time.June, 29, 13, 10, 13, 0, time.UTC).Unix()
	GenesisBeacon    = make([]byte, RandomBeaconLength)
	NKNAssetID       = common.Uint256{
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
	}
	GASAssetID = common.Uint256{
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
	}
	MaxTxnSubIdentifierList = HeightDependentInt{
							// contains filtered or unexported fields
	}
	MaxTxnSubMetaList = HeightDependentInt{
						// contains filtered or unexported fields
	}
)
View Source
var (
	Version string
	SkipNAT bool

	ConfigFile           string
	LogPath              string
	ChainDBPath          string
	WalletFile           string
	BeneficiaryAddr      string
	SeedList             string
	GenesisBlockProposer string
	Parameters           = &Configuration{
		Version:                   1,
		Transport:                 "tcp",
		NodePort:                  30001,
		HttpWsPort:                30002,
		HttpJsonPort:              30003,
		NAT:                       true,
		Mining:                    true,
		MiningDebug:               true,
		LogLevel:                  1,
		MaxLogFileSize:            20,
		SyncBatchWindowSize:       128,
		SyncBlockHeadersBatchSize: 128,
		SyncBlocksBatchSize:       8,
		RPCReadTimeout:            5,
		RPCWriteTimeout:           10,
		KeepAliveTimeout:          15,
		NATPortMappingTimeout:     365 * 86400,
		NumTxnPerBlock:            256,
		TxPoolCap:                 DefaultTxPoolCap,
		RegisterIDFee:             0,
		LogPath:                   "Log",
		ChainDBPath:               "ChainDB",
		WalletFile:                "wallet.json",
		MaxGetIDSeeds:             3,
		DBFilesCacheCapacity:      100,
	}
)

Functions

func Init

func Init() error

Types

type Configuration

type Configuration struct {
	Version                   int           `json:"Version"`
	SeedList                  []string      `json:"SeedList"`
	RestCertPath              string        `json:"RestCertPath"`
	RestKeyPath               string        `json:"RestKeyPath"`
	RPCCert                   string        `json:"RPCCert"`
	RPCKey                    string        `json:"RPCKey"`
	HttpWsPort                uint16        `json:"HttpWsPort"`
	HttpJsonPort              uint16        `json:"HttpJsonPort"`
	NodePort                  uint16        `json:"-"`
	LogLevel                  int           `json:"LogLevel"`
	MaxLogFileSize            uint32        `json:"MaxLogSize"`
	IsTLS                     bool          `json:"IsTLS"`
	CertPath                  string        `json:"CertPath"`
	KeyPath                   string        `json:"KeyPath"`
	CAPath                    string        `json:"CAPath"`
	MaxHdrSyncReqs            int           `json:"MaxConcurrentSyncHeaderReqs"`
	GenesisBlockProposer      string        `json:"GenesisBlockProposer"`
	MinTxnFee                 int64         `json:"MinTxnFee"`
	RegisterIDFee             int64         `json:"RegisterIDFee"`
	Hostname                  string        `json:"Hostname"`
	Transport                 string        `json:"Transport"`
	NAT                       bool          `json:"NAT"`
	Mining                    bool          `json:"Mining"`
	MiningDebug               bool          `json:"MiningDebug"`
	BeneficiaryAddr           string        `json:"BeneficiaryAddr"`
	SyncBatchWindowSize       uint32        `json:"SyncBatchWindowSize"`
	SyncBlockHeadersBatchSize uint32        `json:"SyncBlockHeadersBatchSize"`
	SyncBlocksBatchSize       uint32        `json:"SyncBlocksBatchSize"`
	NumTxnPerBlock            uint32        `json:"NumTxnPerBlock"`
	TxPoolCap                 int           `json:"TxPoolCap"`
	RPCReadTimeout            time.Duration `json:"RPCReadTimeout"`        // in seconds
	RPCWriteTimeout           time.Duration `json:"RPCWriteTimeout"`       // in seconds
	KeepAliveTimeout          time.Duration `json:"KeepAliveTimeout"`      // in seconds
	NATPortMappingTimeout     time.Duration `json:"NATPortMappingTimeout"` // in seconds
	LogPath                   string        `json:"LogPath"`
	ChainDBPath               string        `json:"ChainDBPath"`
	WalletFile                string        `json:"WalletFile"`
	MaxGetIDSeeds             uint32        `json:"MaxGetIDSeeds"`
	DBFilesCacheCapacity      int           `json:"DBFilesCacheCapacity"`
}

func (*Configuration) CheckPorts

func (config *Configuration) CheckPorts(myIP string) (bool, error)

func (*Configuration) CleanPortMapping

func (config *Configuration) CleanPortMapping() error

func (*Configuration) SetupPortMapping

func (config *Configuration) SetupPortMapping() error

type HeightDependentInt

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

func (*HeightDependentInt) GetValueAtHeight

func (hdi *HeightDependentInt) GetValueAtHeight(height uint32) int

Jump to

Keyboard shortcuts

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