params

package
v0.0.0-...-b9128f4 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//ForkID0 init
	ForkID0 = uint64(0)
	//ForkID1 account first name > 12, asset name contain account name
	ForkID1 = uint64(1)
	//ForkID4 miner pubkey separate
	ForkID4 = uint64(4)

	// NextForkID is the id of next fork
	NextForkID uint64 = ForkID4
)
View Source
const (
	// BlockGasLimit Gas limit of the  block.
	BlockGasLimit uint64 = 30000000
	// MinGasLimit Minimum the gas limit may ever be.
	MinGasLimit uint64 = 5000
	// GasLimitBoundDivisor The bound divisor of the gas limit, used in update calculations.
	GasLimitBoundDivisor uint64 = 1024
	// MaximumExtraDataSize Maximum size extra data may be after Genesis.
	MaximumExtraDataSize uint64 = 32 + 65

	EpochDuration   uint64 = 30000 // Duration between proof-of-work epochs.
	CallCreateDepth uint64 = 1024  // Maximum depth of call/create stack.
	StackLimit      uint64 = 1024  // Maximum size of VM stack allowed.

	MaxCodeSize uint64 = 24576     // Maximum bytecode to permit for a contract
	MaxTxSize   uint64 = 32 * 1024 // Heuristic limit, reject transactions over 32KB to prfeed DOS attacks

	EcrecoverGas            uint64 = 3000   // Elliptic curve sender recovery gas price
	Sha256BaseGas           uint64 = 60     // Base price for a SHA256 operation
	Sha256PerWordGas        uint64 = 12     // Per-word price for a SHA256 operation
	Ripemd160BaseGas        uint64 = 600    // Base price for a RIPEMD160 operation
	Ripemd160PerWordGas     uint64 = 120    // Per-word price for a RIPEMD160 operation
	IdentityBaseGas         uint64 = 15     // Base price for a data copy operation
	IdentityPerWordGas      uint64 = 3      // Per-work price for a data copy operation
	ModExpQuadCoeffDiv      uint64 = 20     // Divisor for the quadratic particle of the big int modular exponentiation
	Bn256AddGas             uint64 = 500    // Gas needed for an elliptic curve addition
	Bn256ScalarMulGas       uint64 = 40000  // Gas needed for an elliptic curve scalar multiplication
	Bn256PairingBaseGas     uint64 = 100000 // Base price for an elliptic curve pairing check
	Bn256PairingPerPointGas uint64 = 80000  // Per-point price for an elliptic curve pairing check
)
View Source
const (
	MaxSignDepth  = uint64(10)
	MaxSignLength = uint64(50)
	MaxAuthorNum  = uint64(10)
)
View Source
const (
	AssetFeeType    = uint64(0)
	ContractFeeType = uint64(1)
	CoinbaseFeeType = uint64(2)
)

type for fee

View Source
const (
	//ClientIdentifier Client identifier to advertise over the network
	ClientIdentifier = "oex"
)
View Source
const (
	MaxFeeResultCount = uint64(1000)
)

rpc max fee result count

View Source
const (
	// oex
	Oex = 1e18
)

Variables

View Source
var (
	DifficultyBoundDivisor = big.NewInt(2048)   // The bound divisor of the difficulty, used in the update calculations.
	GenesisDifficulty      = big.NewInt(131072) // Difficulty of the Genesis block.
	MinimumDifficulty      = big.NewInt(131072) // The minimum that the difficulty may ever be.
	DurationLimit          = big.NewInt(13)     // The decision boundary on the blocktime duration used to determine whether difficulty should go up or not.
)
View Source
var DefaultChainconfig = &ChainConfig{
	BootNodes: []string{},
	ChainID:   big.NewInt(1),
	ChainName: "oexchain",
	ChainURL:  "https://oexproject.com",
	AccountNameCfg: &NameConfig{
		Level:         2,
		AllLength:     31,
		MainMinLength: 7,
		MainMaxLength: 16,
		SubMinLength:  2,
		SubMaxLength:  8,
	},
	AssetNameCfg: &NameConfig{
		Level:         2,
		AllLength:     31,
		MainMinLength: 2,
		MainMaxLength: 16,
		SubMinLength:  1,
		SubMaxLength:  8,
	},
	ChargeCfg: &ChargeConfig{
		AssetRatio:    80,
		ContractRatio: 80,
	},
	ForkedCfg: &FrokedConfig{
		ForkBlockNum:   10000,
		Forkpercentage: 80,
	},
	DposCfg: &DposConfig{
		MaxURLLen:                     512,
		UnitStake:                     big.NewInt(1000),
		CandidateAvailableMinQuantity: big.NewInt(10),
		CandidateMinQuantity:          big.NewInt(10),
		VoterMinQuantity:              big.NewInt(2),
		ActivatedMinCandidate:         3,
		ActivatedMinQuantity:          big.NewInt(100),
		BlockInterval:                 3000,
		BlockFrequency:                6,
		CandidateScheduleSize:         3,
		BackupScheduleSize:            0,
		EpochInterval:                 1080000,
		FreezeEpochSize:               3,
		ExtraBlockReward:              big.NewInt(1),
		BlockReward:                   big.NewInt(5),
		HalfEpoch:                     10,
		RoundReward:                   big.NewInt(10 * 3 * 6 * 10000),
		RoundPow:                      []uint64{1, 1, 1},
	},
	SnapshotInterval: 180000,
	SysName:          "oexchain.founder",
	AccountName:      "oexchain.account",
	AssetName:        "oexchain.asset",
	DposName:         "oexchain.dpos",
	FeeName:          "oexchain.fee",
	SysToken:         "oextoken",
}
View Source
var (
	// GasTable contain the gas re-prices
	GasTableInstance = GasTable{
		ActionGas:             100000,
		ActionGasCallContract: 200000,
		ActionGasCreation:     500000,
		ActionGasIssueAsset:   10000000,
		SignGas:               50000,

		ExtcodeSize: 700,
		ExtcodeCopy: 700,
		Balance:     400,
		SLoad:       200,
		Calls:       700,
		ExpByte:     50,

		SetOwner:        200,
		WithdrawFee:     700,
		GetAccountTime:  200,
		GetSnapshotTime: 200,
		GetAssetInfo:    200,
		SnapBalance:     200,
		IssueAsset:      10000000,
		DestroyAsset:    200,
		AddAsset:        200,
		GetAccountID:    200,
		GetAssetID:      200,
		CryptoCalc:      20000,
		CryptoByte:      1000,
		DeductGas:       200,
		GetEpoch:        200,
		GetCandidateNum: 200,
		GetCandidate:    200,
		GetVoterStake:   200,

		TxDataNonZeroGas: 68,
		TxDataZeroGas:    4,

		CallValueTransferGas: 9000,
		QuadCoeffDiv:         512,
		SstoreSetGas:         20000,
		LogDataGas:           8,
		CallStipend:          0,

		Sha3Gas:        30,
		Sha3WordGas:    6,
		SstoreResetGas: 5000,
		JumpdestGas:    1,
		CreateDataGas:  200,
		LogGas:         375,
		CopyGas:        3,
		LogTopicGas:    375,
		CreateGas:      32000,
		MemoryGas:      3,
	}
)

Variables containing gas prices for different phases.

Functions

This section is empty.

Types

type ChainConfig

type ChainConfig struct {
	BootNodes        []string      `json:"bootnodes"` // enode URLs of the P2P bootstrap nodes
	ChainID          *big.Int      `json:"chainId"`   // chainId identifies the current chain and is used for replay protection
	ChainName        string        `json:"chainName"` // chain name
	ChainURL         string        `json:"chainUrl"`  // chain url
	AccountNameCfg   *NameConfig   `json:"accountParams"`
	AssetNameCfg     *NameConfig   `json:"assetParams"`
	ChargeCfg        *ChargeConfig `json:"chargeParams"`
	ForkedCfg        *FrokedConfig `json:"upgradeParams"`
	DposCfg          *DposConfig   `json:"dposParams"`
	SysName          string        `json:"systemName"`  // system name
	AccountName      string        `json:"accountName"` // account name
	AssetName        string        `json:"assetName"`   // asset name
	DposName         string        `json:"dposName"`    // system name
	SnapshotInterval uint64        `json:"snapshotInterval"`
	FeeName          string        `json:"feeName"`     //fee name
	SysToken         string        `json:"systemToken"` // system token
	SysTokenID       uint64        `json:"sysTokenID"`
	SysTokenDecimals uint64        `json:"sysTokenDecimal"`
	ReferenceTime    uint64        `json:"referenceTime"`
}

ChainConfig is the core config which determines the blockchain settings.

func (*ChainConfig) Copy

func (cfg *ChainConfig) Copy() *ChainConfig

type ChargeConfig

type ChargeConfig struct {
	AssetRatio    uint64 `json:"assetRatio"`
	ContractRatio uint64 `json:"contractRatio"`
}

type DposConfig

type DposConfig struct {
	MaxURLLen                     uint64   `json:"maxURLLen"` // url length
	UnitStake                     *big.Int `json:"unitStake"` // state unit
	CandidateAvailableMinQuantity *big.Int `json:"candidateAvailableMinQuantity"`
	CandidateMinQuantity          *big.Int `json:"candidateMinQuantity"` // min quantity
	VoterMinQuantity              *big.Int `json:"voterMinQuantity"`     // min quantity
	ActivatedMinCandidate         uint64   `json:"activatedMinCandidate"`
	ActivatedMinQuantity          *big.Int `json:"activatedMinQuantity"` // min active quantity
	BlockInterval                 uint64   `json:"blockInterval"`
	BlockFrequency                uint64   `json:"blockFrequency"`
	CandidateScheduleSize         uint64   `json:"candidateScheduleSize"`
	BackupScheduleSize            uint64   `json:"backupScheduleSize"`
	EpochInterval                 uint64   `json:"epochInterval"`
	FreezeEpochSize               uint64   `json:"freezeEpochSize"`
	ExtraBlockReward              *big.Int `json:"extraBlockReward"`
	BlockReward                   *big.Int `json:"blockReward"`
	HalfEpoch                     uint64   `json:"halfEpoch"`
	RoundReward                   *big.Int `json:"roundReward"`
	RoundPow                      []uint64 `json:"roundPow"`
}

type FrokedConfig

type FrokedConfig struct {
	ForkBlockNum   uint64 `json:"blockCnt"`
	Forkpercentage uint64 `json:"upgradeRatio"`
}

type GasTable

type GasTable struct {
	ActionGas             uint64
	ActionGasCallContract uint64
	ActionGasCreation     uint64
	ActionGasIssueAsset   uint64
	SignGas               uint64
	TxDataNonZeroGas      uint64
	TxDataZeroGas         uint64

	ExtcodeSize          uint64
	ExtcodeCopy          uint64
	Balance              uint64
	SLoad                uint64
	Calls                uint64
	ExpByte              uint64
	CallValueTransferGas uint64
	QuadCoeffDiv         uint64
	SstoreSetGas         uint64
	LogDataGas           uint64
	CallStipend          uint64

	SetOwner        uint64
	GetAccountTime  uint64
	GetSnapshotTime uint64
	GetAssetInfo    uint64
	SnapBalance     uint64
	IssueAsset      uint64
	DestroyAsset    uint64
	AddAsset        uint64
	GetAccountID    uint64
	GetAssetID      uint64
	CryptoCalc      uint64
	CryptoByte      uint64
	DeductGas       uint64
	WithdrawFee     uint64
	GetEpoch        uint64
	GetCandidateNum uint64
	GetCandidate    uint64
	GetVoterStake   uint64

	Sha3Gas        uint64
	Sha3WordGas    uint64
	SstoreResetGas uint64
	JumpdestGas    uint64
	CreateDataGas  uint64
	LogGas         uint64
	CopyGas        uint64
	LogTopicGas    uint64
	CreateGas      uint64
	MemoryGas      uint64
}

GasTable organizes gas prices for different phases.

type NameConfig

type NameConfig struct {
	Level         uint64 `json:"level"`
	AllLength     uint64 `json:"alllength"`
	MainMinLength uint64 `json:"mainminlength"`
	MainMaxLength uint64 `json:"mainmaxlength"`
	SubMinLength  uint64 `json:"subminLength"`
	SubMaxLength  uint64 `json:"submaxLength"`
}

Jump to

Keyboard shortcuts

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