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 HeightDependentInt64
- type HeightDependentString
- type HeightDependentUint256
Constants ¶
View Source
const ( PublicKeySize = 32 VRFSize = 32 VRFProofSize = 96 MaxNumTxnPerBlock = 4096 MaxBlockSize = 1 * 1024 * 1024 // in bytes ConsensusDuration = 20 * time.Second ConsensusTimeout = 60 * time.Second NodeIDBytes = 32 SigChainBlockDelay = 1 SigChainPropogationTime = 2 MinNumSuccessors = 8 NumRandomGossipNeighborsFactor = 1 NumRandomVotingNeighborsFactor = 3 MinNumRandomGossipNeighbors = 8 MinNumRandomVotingNeighbors = 24 MaxNumInboundRandomNeighbors = 256 GossipSampleChordNeighbor = 0.15 GossipMinChordNeighbor = 8 VotingSampleChordNeighbor = 0.0 VotingMinChordNeighbor = 0 SigChainObjectionSampleNeighbor = 0.1 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 GenerateIDBlockDelay = 8 RandomBeaconUniqueLength = VRFSize RandomBeaconLength = VRFSize + VRFProofSize ProtocolVersion = 40 MinCompatibleProtocolVersion = 40 MaxCompatibleProtocolVersion = 49 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 ( SyncPruning = true LivePruning = false 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{ Height: []uint32{980000, 0}, Values: []string{"(^[A-Za-z0-9][A-Za-z0-9-_.+]{2,254}$)", "(^[A-Za-z][A-Za-z0-9-_.+]{2,254}$)"}, } AllowNameRegex = HeightDependentString{ Height: []uint32{980000, 0}, Values: []string{"(^[A-Za-z0-9][A-Za-z0-9-_+]{5,62}$)", "(^[A-Za-z][A-Za-z0-9-_.+]{2,254}$)"}, } LegacyNameService = HeightDependentBool{ Heights: []uint32{980000, 0}, Values: []bool{false, true}, } MaxSubscribeIdentifierLen = HeightDependentInt32{ Height: []uint32{133400, 0}, Values: []int32{64, math.MaxInt32}, } MaxSubscribeMetaLen = HeightDependentInt32{ Height: []uint32{133400, 0}, Values: []int32{1024, math.MaxInt32}, } MaxSubscribeBucket = HeightDependentInt32{ Height: []uint32{245000, 0}, Values: []int32{0, 1000}, } MaxSubscribeDuration = HeightDependentInt32{ Height: []uint32{245000, 0}, Values: []int32{400000, 65535}, } MaxSubscriptionsCount = 0 // 0 for unlimited MaxGenerateIDTxnHash = HeightDependentUint256{ Height: []uint32{2570000, 245000, 0}, Values: []common.Uint256{ common.MaxUint256, { 0x00, 0x00, 0x00, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, }, common.MaxUint256, }, } MaxTxnAttributesLen = 100 AllowTxnRegisterName = HeightDependentBool{ Heights: []uint32{980000, 7500, 0}, Values: []bool{true, false, true}, } ChargeNanoPayTxnFee = HeightDependentBool{ Heights: []uint32{1072500, 0}, Values: []bool{true, false}, } AllowSigChainHashSignature = HeightDependentBool{ Heights: []uint32{1200000, 0}, Values: []bool{false, true}, } SigChainBitShiftMaxLength = HeightDependentInt32{ Height: []uint32{2651000, 2633000, 2543000, 0}, Values: []int32{18, 16, 14, 0}, } SigChainVerifyFingerTableRange = HeightDependentBool{ Heights: []uint32{2570000, 0}, Values: []bool{true, false}, } SigChainVerifySkipNode = HeightDependentBool{ Heights: []uint32{2570120, 2570000, 0}, Values: []bool{false, true, false}, } SigChainObjection = HeightDependentBool{ Heights: []uint32{2570120, 2570000, 0}, Values: []bool{false, true, false}, } MinGenIDRegistrationFee = HeightDependentInt64{ Height: []uint32{2570000, 0}, Values: []int64{10 * common.StorageFactor, 0}, } AllowGenerateIDSender = HeightDependentBool{ Heights: []uint32{2570000, 0}, Values: []bool{true, false}, } AllowTxnGenerateIDMinVersion = HeightDependentInt32{ Height: []uint32{2570000, 0}, Values: []int32{1, 0}, } AllowTxnGenerateIDMaxVersion = HeightDependentInt32{ Height: []uint32{2570000, 0}, Values: []int32{1, 0}, } AllowGetIDMinVersion = HeightDependentInt32{ Height: []uint32{2600000, 2570000, 0}, Values: []int32{1, 0, 0}, } AllowGetIDMaxVersion = HeightDependentInt32{ Height: []uint32{2600000, 2570000, 0}, Values: []int32{1, 1, 0}, } SigChainBitShiftPerElement = HeightDependentInt32{ Height: []uint32{2651000, 0}, Values: []int32{8, 4}, } SigChainRecentMinerBlocks = 4096 SigChainRecentMinerBitShift = HeightDependentInt32{ Height: []uint32{2651000, 2633000, 0}, Values: []int32{10, 4, 0}, } SigChainSkipMinerBlocks = 4096 SigChainSkipMinerMaxAllowed = HeightDependentInt32{ Height: []uint32{2651000, 0}, Values: []int32{2, 3}, } SigChainSkipMinerBitShift = HeightDependentInt32{ Height: []uint32{2633000, 0}, Values: []int32{10, 0}, } SigChainMinerSalt = HeightDependentBool{ Heights: []uint32{2900000, 0}, Values: []bool{true, false}, } SigChainMinerWeightBase = HeightDependentInt32{ Height: []uint32{2900000, 0}, Values: []int32{2, 1}, } SigChainMinerWeightMaxExponent = HeightDependentInt32{ Height: []uint32{2900000, 0}, Values: []int32{4, 0}, } DonationNoDelay = HeightDependentBool{ Heights: []uint32{3030000, 0}, Values: []bool{true, false}, } )
View Source
var ( Version string SkipNAT bool ConfigFile string LogPath string ChainDBPath string WalletFile string BeneficiaryAddr string SeedList string StunList string GenesisBlockProposer string AllowEmptyBeneficiaryAddress bool WebGuiListenAddress string WebGuiCreateWallet bool PasswordFile string StatePruningMode string SyncMode 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, SyncStateMaxThread: 0, SyncHeaderMaxSize: 0, SyncHeaderMaxMemorySize: 0, SyncBatchWindowSize: 0, SyncBlockHeadersBatchSize: 128, SyncBlocksBatchSize: 4, SyncBlocksMaxMemorySize: 0, RPCReadTimeout: 5, RPCWriteTimeout: 10, RPCIdleTimeout: 0, RPCKeepAlivesEnabled: false, NATPortMappingTimeout: 365 * 86400, NumTxnPerBlock: 256, TxPoolPerAccountTxCap: 32, TxPoolTotalTxCap: 0, TxPoolMaxMemorySize: 0, RegisterIDRegFee: 0, RegisterIDTxnFee: 0, RegisterIDReplaceTxPool: false, LogPath: "Log", ChainDBPath: "ChainDB", WalletFile: "wallet.json", DefaultTlsDomainTmpl: []string{"{{.DashedIP}}.ipv4.staticdns1.io", "{{.DashedIP}}.ipv4.staticdns2.io", "{{.DashedIP}}.ipv4.staticdns3.io"}, CertDirectory: "certs", CertRenewBefore: 720, CertCheckInterval: 86400, MaxGetIDSeeds: 3, DBFilesCacheCapacity: 100, NumLowFeeTxnPerBlock: 0, LowFeeTxnSizePerBlock: 2048, LowTxnFee: 10000000, LowTxnFeePerSize: 50000, AllowEmptyBeneficiaryAddress: false, WebGuiListenAddress: "127.0.0.1", WebGuiPort: 30000, WebGuiCreateWallet: false, PasswordFile: "", StatePruningMode: "lowmem", RecentStateCount: 16384, RecentBlockCount: 32768, MinPruningCompactHeights: 32768, NodeIPRateLimit: 1, NodeIPRateBurst: 10, WsIPRateLimit: 10, WsIPRateBurst: 100, RPCIPRateLimit: 10, RPCIPRateBurst: 100, RPCRateLimit: 1024, RPCRateBurst: 4096, SyncBlockHeaderRateLimit: 8192, SyncBlockHeaderRateBurst: 32768, SyncBlockRateLimit: 256, SyncBlockRateBurst: 1024, SyncMode: "full", MaxRollbackBlocks: 180, ClientMsgCacheSize: 0, GenesisBlockProposer: "a0309f8280ca86687a30ca86556113a253762e40eb884fc6063cad2b1ebd7de5", SeedList: []string{ "http://mainnet-seed-0001.nkn.org:30003", "http://mainnet-seed-0002.nkn.org:30003", "http://mainnet-seed-0003.nkn.org:30003", "http://mainnet-seed-0004.nkn.org:30003", "http://mainnet-seed-0005.nkn.org:30003", "http://mainnet-seed-0006.nkn.org:30003", "http://mainnet-seed-0007.nkn.org:30003", "http://mainnet-seed-0008.nkn.org:30003", }, StunList: []string{ "stun:stun.l.google.com:19302", "stun:stun.cloudflare.com:3478", "stun:stunserver.stunprotocol.org:3478", }, } )
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"` StunList []string `json:"StunList"` HttpWssDomain string `json:"HttpWssDomain"` HttpWssCert string `json:"HttpWssCert"` HttpWssKey string `json:"HttpWssKey"` HttpWsPort uint16 `json:"HttpWsPort"` HttpWssPort uint16 `json:"HttpWssPort"` HttpJsonPort uint16 `json:"HttpJsonPort"` HttpsJsonDomain string `json:"HttpsJsonDomain"` HttpsJsonCert string `json:"HttpsJsonCert"` HttpsJsonKey string `json:"HttpsJsonKey"` HttpsJsonPort uint16 `json:"HttpsJsonPort"` DefaultTlsCert string `json:"DefaultTlsCert"` DefaultTlsKey string `json:"DefaultTlsKey"` DefaultTlsDomainTmpl []string `json:"DefaultTlsDomainTmpl"` ACMEUserFile string `json:"ACMEUserFile"` ACMEResourceFile string `json:"ACMEResourceFile"` CertRenewBefore uint16 `json:"CertRenewBefore"` //in hours CertCheckInterval time.Duration `json:"CertCheckInterval"` // in seconds CertDirectory string `json:"CertDirectory"` CertDomainName string `json:"CertDomainName"` NodePort uint16 `json:"-"` LogLevel int `json:"LogLevel"` MaxLogFileSize uint32 `json:"MaxLogSize"` MaxLogFileTotalSize uint32 `json:"MaxLogFileTotalSize"` GenesisBlockProposer string `json:"GenesisBlockProposer"` NumLowFeeTxnPerBlock uint32 `json:"NumLowFeeTxnPerBlock"` LowFeeTxnSizePerBlock uint32 `json:"LowFeeTxnSizePerBlock"` // in bytes LowTxnFee int64 `json:"LowTxnFee"` LowTxnFeePerSize float64 `json:"LowTxnFeePerSize"` RegisterIDRegFee int64 `json:"RegisterIDRegFee"` RegisterIDTxnFee int64 `json:"RegisterIDTxnFee"` RegisterIDReplaceTxPool bool `json:"RegisterIDReplaceTxPool"` Hostname string `json:"Hostname"` Transport string `json:"Transport"` NAT bool `json:"NAT"` Mining bool `json:"Mining"` MiningDebug bool `json:"MiningDebug"` BeneficiaryAddr string `json:"BeneficiaryAddr"` SyncStateMaxThread uint32 `json:"SyncStateMaxThread"` SyncHeaderMaxSize uint32 `json:"SyncHeaderMaxSize"` SyncHeaderMaxMemorySize uint32 `json:"SyncHeaderMaxMemorySize"` 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"` StatePruningMode string `json:"StatePruningMode"` RecentStateCount uint32 `json:"RecentStateCount"` RecentBlockCount uint32 `json:"RecentBlockCount"` MinPruningCompactHeights uint32 `json:"MinPruningCompactHeights"` NodeIPRateLimit float64 `json:"NodeIPRateLimit"` // requests per second NodeIPRateBurst uint32 `json:"NodeIPRateBurst"` WsIPRateLimit float64 `json:"WsIPRateLimit"` // requests per second WsIPRateBurst uint32 `json:"WsIPRateBurst"` RPCIPRateLimit float64 `json:"RPCIPRateLimit"` // requests per second RPCIPRateBurst uint32 `json:"RPCIPRateBurst"` RPCRateLimit float64 `json:"RPCRateLimit"` // requests per second RPCRateBurst uint32 `json:"RPCRateBurst"` SyncBlockHeaderRateLimit float64 `json:"SyncBlockHeaderRateLimit"` // headers per second SyncBlockHeaderRateBurst uint32 `json:"SyncBlockHeaderRateBurst"` SyncBlockRateLimit float64 `json:"SyncBlockRateLimit"` // blocks per second SyncBlockRateBurst uint32 `json:"SyncBlockRateBurst"` BlockHeaderCacheSize uint32 `json:"BlockHeaderCacheSize"` SigChainCacheSize uint32 `json:"SigChainCacheSize"` SyncMode string `json:"SyncMode"` MaxRollbackBlocks uint32 `json:"MaxRollbackBlocks"` ClientMsgCacheSize uint32 `json:"ClientMsgCacheSize"` // in mega bytes (MB), 32 means 32MB }
func (*Configuration) IsFastSync ¶ added in v2.1.7
func (config *Configuration) IsFastSync() bool
func (*Configuration) IsLightSync ¶ added in v2.1.7
func (config *Configuration) IsLightSync() bool
type HeightDependentBool ¶
func (*HeightDependentBool) GetValueAtHeight ¶
func (hdi *HeightDependentBool) GetValueAtHeight(height uint32) bool
type HeightDependentInt32 ¶
func (*HeightDependentInt32) GetValueAtHeight ¶
func (hdi *HeightDependentInt32) GetValueAtHeight(height uint32) int32
type HeightDependentInt64 ¶ added in v2.1.0
func (*HeightDependentInt64) GetValueAtHeight ¶ added in v2.1.0
func (hdi *HeightDependentInt64) GetValueAtHeight(height uint32) int64
type HeightDependentString ¶
func (*HeightDependentString) GetValueAtHeight ¶
func (hdi *HeightDependentString) GetValueAtHeight(height uint32) string
type HeightDependentUint256 ¶
func (*HeightDependentUint256) GetValueAtHeight ¶
func (hdi *HeightDependentUint256) GetValueAtHeight(height uint32) common.Uint256
Click to show internal directories.
Click to hide internal directories.