config

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: Apache-2.0 Imports: 16 Imported by: 3

Documentation

Index

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                = 2
	NumRandomGossipNeighborsFactor  = 1
	NumRandomVotingNeighborsFactor  = 2
	MinNumRandomGossipNeighbors     = 8
	MinNumRandomVotingNeighbors     = 3
	MaxNumInboundRandomNeighbors    = 256
	GossipSampleChordNeighbor       = 0.15
	GossipMinChordNeighbor          = 8
	VotingSampleChordNeighbor       = 0.0
	VotingMinChordNeighbor          = 0
	SigChainObjectionSampleNeighbor = 0.1
	HeaderVersion                   = 1
	DBVersion                       = 0x01
	InitialIssueAddress             = "RVSGny4Ct9kQ2DGTCJavqcop7dKDev1jxk4W"

	RevosTokenCorporateTreasury = "RVSRupVEBbyPuT9tTwjp9uH1YHFkqM2hMwM5" //Need to change the addresses
	RevosTokenSales             = "RVSBFvsW6j76aDFFkBaZUhYJXv8erTZuD8Vb"

	InitialIssueAmount   = 50000000 * common.StorageFactor
	TotalMiningRewards   = 1000000000 * common.StorageFactor
	TotalRewardDuration  = uint32(50)
	InitialReward        = common.Fixed64(54329372 * common.StorageFactor)
	RewardAdjustInterval = 1577846 //block number per year
	// ReductionAmount                = common.Fixed64(500000 * common.StorageFactor)
	DonationAddress              = "RVSSye4aYHHRcNgFLLZK3BMgaQx5fDeRhbu4"
	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                 = "Revos"
	NKNAssetSymbol               = "RVS"
	NKNAssetPrecision            = uint32(8)
	DataCreditsAssetName         = "Revos Data Credits"
	DataCreditsSymbol            = "RDC"
	DataCreditsPrecision         = uint32(8)
	DumpMemInterval              = 30 * time.Second
	MaxClientMessageSize         = 4 * 1024 * 1024
	MinNameRegistrationFee       = 0 * common.StorageFactor
	DefaultNameDuration          = 365 * 24 * 60 * 60 / int(ConsensusDuration/time.Second)
)

Variables

View Source
var (
	BaseDPB          = [7]float64{5, 5, 10, 20, 20, 20, 20}
	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,
	}
	DataCreditsAssetID = 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 = 0 // 0 for unlimited
	MaxGenerateIDTxnHash  = HeightDependentUint256{
							// contains filtered or unexported fields
	}
	MaxTxnAttributesLen  = 100
	AllowTxnRegisterName = HeightDependentBool{
							// contains filtered or unexported fields
	}
	ChargeNanoPayTxnFee = HeightDependentBool{
						// contains filtered or unexported fields
	}
	AllowSigChainHashSignature = HeightDependentBool{
								// contains filtered or unexported fields
	}
	SigChainBitShiftMaxLength = HeightDependentInt32{
								// contains filtered or unexported fields
	}
	SigChainVerifyFingerTableRange = HeightDependentBool{
									// contains filtered or unexported fields
	}
	SigChainVerifySkipNode = HeightDependentBool{
							// contains filtered or unexported fields
	}
	SigChainObjection = HeightDependentBool{
						// contains filtered or unexported fields
	}
	MinGenIDRegistrationFee = HeightDependentInt64{
							// contains filtered or unexported fields
	}
	AllowGenerateIDSender = HeightDependentBool{
							// contains filtered or unexported fields
	}
	AllowTxnGenerateIDMinVersion = HeightDependentInt32{
									// contains filtered or unexported fields
	}
	AllowTxnGenerateIDMaxVersion = HeightDependentInt32{
									// contains filtered or unexported fields
	}
	AllowGetIDMinVersion = HeightDependentInt32{
							// contains filtered or unexported fields
	}
	AllowGetIDMaxVersion = HeightDependentInt32{
							// contains filtered or unexported fields
	}
	SigChainBitShiftPerElement = HeightDependentInt32{
								// contains filtered or unexported fields
	}
	SigChainRecentMinerBlocks   = 4096
	SigChainRecentMinerBitShift = HeightDependentInt32{
								// contains filtered or unexported fields
	}
	SigChainSkipMinerBlocks     = 4096
	SigChainSkipMinerMaxAllowed = HeightDependentInt32{
								// contains filtered or unexported fields
	}
	SigChainSkipMinerBitShift = HeightDependentInt32{
								// contains filtered or unexported fields
	}
	SigChainMinerSalt = HeightDependentBool{
						// contains filtered or unexported fields
	}
	SigChainMinerWeightBase = HeightDependentInt32{
							// contains filtered or unexported fields
	}
	SigChainMinerWeightMaxExponent = HeightDependentInt32{
									// contains filtered or unexported fields
	}
	DonationNoDelay = HeightDependentBool{
					// contains filtered or unexported fields
	}
)
View Source
var (
	Version                      string
	SkipNAT                      bool
	ConfigFile                   string
	LogPath                      string
	ChainDBPath                  string
	WalletFile                   string
	BeneficiaryAddr              string
	PoPChallengersAddr           string
	PoPChallengeesAddr           string
	PoNConnectivityUtilization   string
	PoNComputeUtilization        string
	PoNStorageUtilization        string
	SeedList                     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,
		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,
		LogPath:                      "Log",
		ChainDBPath:                  "ChainDB",
		WalletFile:                   "wallet.json",
		DefaultTlsDomainTmpl:         "{{.DashedIP}}.ipv4.revos.net",
		CertDirectory:                "certs",
		CertRenewBefore:              720,
		CertCheckInterval:            86400,
		MaxGetIDSeeds:                3,
		DBFilesCacheCapacity:         100,
		NumLowFeeTxnPerBlock:         0,
		LowFeeTxnSizePerBlock:        2048,
		MinTxnFee:                    10000000,
		AllowEmptyBeneficiaryAddress: false,
		WebGuiListenAddress:          "127.0.0.1",
		WebGuiPort:                   30000,
		WebGuiCreateWallet:           false,
		PasswordFile:                 "",
		StatePruningMode:             "lowmem",
		RecentStateCount:             16384,
		RecentBlockCount:             32768,
		MinPruningCompactHeights:     32768,
		RPCRateLimit:                 1024,
		RPCRateBurst:                 4096,
		SyncBlockHeaderRateLimit:     8192,
		SyncBlockHeaderRateBurst:     32768,
		SyncBlockRateLimit:           256,
		SyncBlockRateBurst:           1024,
		SyncMode:                     "full",
		MaxRollbackBlocks:            180,
	}
)

Functions

func GetConfigFile

func GetConfigFile() string

func Init

func Init() error

func OpenConfigFile

func OpenConfigFile() ([]byte, error)

func SetBeneficiaryAddr

func SetBeneficiaryAddr(addr string, allowEmpty bool) error

func WriteConfigFile

func WriteConfigFile(configuration map[string]interface{}) error

Types

type Configuration

type Configuration struct {
	Version               int           `json:"Version"`
	SeedList              []string      `json:"SeedList"`
	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"`
	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
	MinTxnFee             int64         `json:"MinTxnFee"`
	RegisterIDRegFee      int64         `json:"RegisterIDRegFee"`
	RegisterIDTxnFee      int64         `json:"RegisterIDTxnFee"`
	Hostname              string        `json:"Hostname"`
	Transport             string        `json:"Transport"`
	NAT                   bool          `json:"NAT"`
	Mining                bool          `json:"Mining"`
	MiningDebug           bool          `json:"MiningDebug"`
	BeneficiaryAddr       string        `json:"BeneficiaryAddr"`
	PoPChallengersAddr    string        `json:"PoPChallengersAddr"`
	PoPChallengeesAddr    string        `json:"PoPChallengeesAddr"`

	PoNConnectivityUtilization   string        `json:"PoNConnectivityUtilization"`
	PoNComputeUtilization        string        `json:"PoNComputeUtilization"`
	PoNStorageUtilization        string        `json:"PoNStorageUtilization"`
	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"`
	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"`
}

func (*Configuration) IsFastSync

func (config *Configuration) IsFastSync() bool

func (*Configuration) IsLightSync

func (config *Configuration) IsLightSync() bool

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 HeightDependentInt64

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

func (*HeightDependentInt64) GetValueAtHeight

func (hdi *HeightDependentInt64) GetValueAtHeight(height uint32) int64

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

Jump to

Keyboard shortcuts

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