Documentation ¶
Index ¶
- Constants
- Variables
- func GetConfigFile() string
- func Init() error
- func OpenConfigFile() ([]byte, error)
- func SetBeneficiaryAddr(addr string, allowEmpty bool) error
- func WriteConfigFile(configuration map[string]interface{}) error
- type Configuration
- type HeightDependentBool
- type HeightDependentInt32
- type HeightDependentString
- type HeightDependentUint256
Constants ¶
View Source
const ( 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 GossipSampleChordNeighbor = 0.1 GossipSampleRandomNeighbor = 1.0 VotingSampleChordNeighbor = 0.5 VotingSampleRandomNeighbor = 0.0 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 TxPoolCleanupInterval = ConsensusDuration ShortHashSize = uint32(8) MaxAssetPrecision = uint32(8) NKNAssetName = "NKN" NKNAssetSymbol = "nkn" NKNAssetPrecision = uint32(8) GASAssetName = "New Network Coin" GASAssetSymbol = "nnc" GASAssetPrecision = uint32(8) DumpMemInterval = 30 * time.Second MaxClientMessageSize = 4 * 1024 * 1024 MinNameRegistrationFee = 10 * common.StorageFactor DefaultNameDuration = 365 * 24 * 60 * 60 / int(ConsensusDuration/time.Second) )
Variables ¶
View Source
var ( Debug = false PprofPort = "127.0.0.1:8080" 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, } AllowSubscribeTopicRegex = HeightDependentString{ // contains filtered or unexported fields } AllowNameRegex = HeightDependentString{ // contains filtered or unexported fields } LegacyNameService = HeightDependentBool{ // contains filtered or unexported fields } MaxSubscribeIdentifierLen = HeightDependentInt32{ // contains filtered or unexported fields } MaxSubscribeMetaLen = HeightDependentInt32{ // contains filtered or unexported fields } MaxSubscribeBucket = HeightDependentInt32{ // contains filtered or unexported fields } MaxSubscribeDuration = HeightDependentInt32{ // contains filtered or unexported fields } MaxSubscriptionsCount = 100000 MaxGenerateIDTxnHash = HeightDependentUint256{ // contains filtered or unexported fields } MaxTxnAttributesLen = 100 AllowTxnRegisterName = HeightDependentBool{ // contains filtered or unexported fields } ChargeNanoPayTxnFee = HeightDependentBool{ // 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 AllowEmptyBeneficiaryAddress bool WebGuiListenAddress string WebGuiCreateWallet bool PasswordFile string StatePruningMode string Parameters = &Configuration{ Version: 1, Transport: "tcp", NodePort: 30001, HttpWsPort: 30002, HttpWssPort: 30004, HttpJsonPort: 30003, HttpsJsonPort: 30005, NAT: true, Mining: true, MiningDebug: true, LogLevel: 1, MaxLogFileSize: 20, MaxLogFileTotalSize: 100, SyncBatchWindowSize: 0, SyncBlockHeadersBatchSize: 128, SyncBlocksBatchSize: 4, SyncBlocksMaxMemorySize: 0, RPCReadTimeout: 5, RPCWriteTimeout: 10, RPCIdleTimeout: 0, RPCKeepAlivesEnabled: false, NATPortMappingTimeout: 365 * 86400, NumTxnPerBlock: 256, TlsDomain: "{{.DashedIP}}.ipv4.nknlabs.io", TxPoolPerAccountTxCap: 32, TxPoolTotalTxCap: 0, TxPoolMaxMemorySize: 0, RegisterIDRegFee: 0, RegisterIDTxnFee: 0, LogPath: "Log", ChainDBPath: "ChainDB", WalletFile: "wallet.json", HttpWssCert: "certs/STAR.ipv4.nknlabs.io.cert", HttpWssKey: "certs/STAR.ipv4.nknlabs.io.key", HttpsJsonCert: "certs/STAR.ipv4.nknlabs.io.cert", HttpsJsonKey: "certs/STAR.ipv4.nknlabs.io.key", MaxGetIDSeeds: 3, DBFilesCacheCapacity: 100, NumLowFeeTxnPerBlock: 0, LowFeeTxnSizePerBlock: 2048, MinTxnFee: 10000000, AllowEmptyBeneficiaryAddress: false, WebGuiListenAddress: "127.0.0.1", WebGuiPort: 30000, WebGuiCreateWallet: false, PasswordFile: "", RecentStateCount: 1024, StatePruningMode: "none", } )
Functions ¶
func GetConfigFile ¶
func GetConfigFile() string
func OpenConfigFile ¶
func SetBeneficiaryAddr ¶
func WriteConfigFile ¶
Types ¶
type Configuration ¶
type Configuration struct { Version int `json:"Version"` SeedList []string `json:"SeedList"` HttpWssCert string `json:"HttpWssCert"` HttpWssKey string `json:"HttpWssKey"` HttpWsPort uint16 `json:"HttpWsPort"` HttpWssPort uint16 `json:"HttpWssPort"` HttpJsonPort uint16 `json:"HttpJsonPort"` HttpsJsonCert string `json:"HttpsJsonCert"` HttpsJsonKey string `json:"HttpsJsonKey"` HttpsJsonPort uint16 `json:"HttpsJsonPort"` NodePort uint16 `json:"-"` LogLevel int `json:"LogLevel"` MaxLogFileSize uint32 `json:"MaxLogSize"` MaxLogFileTotalSize uint32 `json:"MaxLogFileTotalSize"` IsTLS bool `json:"IsTLS"` GenesisBlockProposer string `json:"GenesisBlockProposer"` NumLowFeeTxnPerBlock uint32 `json:"NumLowFeeTxnPerBlock"` LowFeeTxnSizePerBlock uint32 `json:"LowFeeTxnSizePerBlock"` // in bytes MinTxnFee int64 `json:"MinTxnFee"` RegisterIDRegFee int64 `json:"RegisterIDRegFee"` RegisterIDTxnFee int64 `json:"RegisterIDTxnFee"` Hostname string `json:"Hostname"` TlsDomain string `json:"TlsDomain"` 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"` SyncBlocksMaxMemorySize uint32 `json:"SyncBlocksMaxMemorySize"` // in megabytes (MB) NumTxnPerBlock uint32 `json:"NumTxnPerBlock"` TxPoolPerAccountTxCap uint32 `json:"TxPoolPerAccountTxCap"` TxPoolTotalTxCap uint32 `json:"TxPoolTotalTxCap"` TxPoolMaxMemorySize uint32 `json:"TxPoolMaxMemorySize"` // in megabytes (MB) RPCReadTimeout time.Duration `json:"RPCReadTimeout"` // in seconds RPCWriteTimeout time.Duration `json:"RPCWriteTimeout"` // in seconds RPCIdleTimeout time.Duration `json:"RPCIdleTimeout"` // in seconds RPCKeepAlivesEnabled bool `json:"RPCKeepAlivesEnabled"` NATPortMappingTimeout time.Duration `json:"NATPortMappingTimeout"` // in seconds LogPath string `json:"LogPath"` ChainDBPath string `json:"ChainDBPath"` WalletFile string `json:"WalletFile"` MaxGetIDSeeds uint32 `json:"MaxGetIDSeeds"` DBFilesCacheCapacity uint32 `json:"DBFilesCacheCapacity"` AllowEmptyBeneficiaryAddress bool `json:"AllowEmptyBeneficiaryAddress"` WebGuiListenAddress string `json:"WebGuiListenAddress"` WebGuiPort uint16 `json:"WebGuiPort"` WebGuiCreateWallet bool `json:"WebGuiCreateWallet"` PasswordFile string `json:"PasswordFile"` RecentStateCount uint32 `json:"RecentStateCount"` StatePruningMode string `json:"StatePruningMode"` }
func (*Configuration) CheckPorts ¶
func (config *Configuration) CheckPorts(myIP string) (bool, error)
func (*Configuration) ClearPortMapping ¶
func (config *Configuration) ClearPortMapping() error
func (*Configuration) SetupPortMapping ¶
func (config *Configuration) SetupPortMapping() error
type HeightDependentBool ¶
type HeightDependentBool struct {
// contains filtered or unexported fields
}
func (*HeightDependentBool) GetValueAtHeight ¶
func (hdi *HeightDependentBool) GetValueAtHeight(height uint32) bool
type HeightDependentInt32 ¶
type HeightDependentInt32 struct {
// contains filtered or unexported fields
}
func (*HeightDependentInt32) GetValueAtHeight ¶
func (hdi *HeightDependentInt32) GetValueAtHeight(height uint32) int32
type HeightDependentString ¶
type HeightDependentString struct {
// contains filtered or unexported fields
}
func (*HeightDependentString) GetValueAtHeight ¶
func (hdi *HeightDependentString) GetValueAtHeight(height uint32) string
type HeightDependentUint256 ¶
type HeightDependentUint256 struct {
// contains filtered or unexported fields
}
func (*HeightDependentUint256) GetValueAtHeight ¶
func (hdi *HeightDependentUint256) GetValueAtHeight(height uint32) common.Uint256
Click to show internal directories.
Click to hide internal directories.