Documentation ¶
Index ¶
Constants ¶
const ( // Max gas that one block contains MaxBlockGas = uint64(10000000) VMGasRate = int64(200) StorageGasRate = int64(1) MaxGasAmount = int64(300000) // These configs need add to casper config in elegant way MaxNumOfValidators = int(10) InitJTASupply = 169290721678579170 + 50000000000 RewardThreshold = 0.5 BlockReward = uint64(570776255) // config parameter for coinbase reward CoinbasePendingBlockNumber = uint64(10) MinVoteOutputAmount = uint64(100000000) PayToWitnessPubKeyHashDataSize = 20 PayToWitnessScriptHashDataSize = 32 BCRPContractHashDataSize = 32 CoinbaseArbitrarySizeLimit = 128 BCRPRequiredJTAAmount = uint64(100000000) JTAAlias = "JTA" )
consensus variables
Variables ¶
var ActiveNetParams = MainNetParams
ActiveNetParams is ...
var JTAAssetID = &bc.AssetID{ V0: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}), V1: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}), V2: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}), V3: binary.BigEndian.Uint64([]byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}), }
JTAAssetID is JTA's asset id, the soul asset of janeta
var JTADefinitionMap = map[string]interface{}{ "name": JTAAlias, "symbol": JTAAlias, "decimals": 8, "description": `Janeta Official Issue`, }
JTADefinitionMap is the ....
var MainNetParams = Params{ Name: "main", Bech32HRPSegwit: "bn", DefaultPort: "58689", DNSSeeds: []string{}, CasperConfig: CasperConfig{ BlockTimeInterval: 6000, MaxTimeOffsetMs: 3000, BlocksOfEpoch: 100, MinValidatorVoteNum: 1e14, VotePendingBlockNums: []VotePendingBlockNum{ {BeginBlock: 0, EndBlock: 432000, Num: 14400}, {BeginBlock: 432000, EndBlock: math.MaxUint64, Num: defaultVotePendingNum}, }, FederationXpubs: []chainkd.XPub{ xpub("f9003633ccbd8cc37e034f4dbe70d9fae980d437948d8cb908d0cab7909780d74a324b4decb5dfcd43fbc6b896ac066b7e02c733a1537360e933278a101a850c"), xpub("d301fee5d4ba7eb5b9d41ca13ec56c19daceb5f6b752d91d49777fd1fc7c45891e5773cafb3b6d6ab764ef2794e8ba953c8bdb9dc77a3af51e979f96885f96b2"), xpub("2ba14bdd29fd84c73f67d6025d2a98292dbdd46b90a2af29c8669dd88dacb1cec62a3e9448d8b731a448f0454b0aa367748659d6c01ad7125d395ffda972da54"), xpub("1313379b05c38ff2d171d512f23f199f0f068a67d77b9d5b6db040f2da1edc0c35c68a21b068956f448fed6441b9c27294f1ca6aaedc2c580de322f3f0260c1f"), }, }, }
MainNetParams is the config for production
var NetParams = map[string]Params{ "mainnet": MainNetParams, "wisdom": TestNetParams, "solonet": SoloNetParams, }
NetParams is the correspondence between chain_id and Params
var SoloNetParams = Params{ Name: "solo", Bech32HRPSegwit: "sn", CasperConfig: CasperConfig{ BlockTimeInterval: 6000, MaxTimeOffsetMs: 24000, BlocksOfEpoch: 100, MinValidatorVoteNum: 1e8, VotePendingBlockNums: []VotePendingBlockNum{{BeginBlock: 0, EndBlock: math.MaxUint64, Num: 10}}, FederationXpubs: []chainkd.XPub{}, }, }
SoloNetParams is the config for test-net
var TestNetParams = Params{ Name: "test", Bech32HRPSegwit: "tn", DefaultPort: "98632", DNSSeeds: []string{}, CasperConfig: CasperConfig{ BlockTimeInterval: 6000, MaxTimeOffsetMs: 3000, BlocksOfEpoch: 100, MinValidatorVoteNum: 1e8, VotePendingBlockNums: []VotePendingBlockNum{{BeginBlock: 0, EndBlock: math.MaxUint64, Num: 10}}, FederationXpubs: []chainkd.XPub{ xpub("7732fac62320799ff5e4eec1dc4ba7b07dc0e5a647850bf0bc34cb9aca195a05a1118b57d377947d7936156c831c87b700ed945a82cae63aff14905beb39d001"), xpub("08543fef8c3ca27483954f80eee6d461c307b6aa564aafaf235a4bd2740debbc71b14af78715c94cbc1d16fa84da97a3eabc5b21f003ab49882e4af7f9f00bbd"), xpub("0dd00fe3880c1cb5d5b0b5d03993c004e7fbe3697a47ff60c3bc12950bead964843dfe45b2bab5d01ae32fb23a4b0460049e822d7787a9a15b76d8bb9dfcec74"), xpub("b0584ecaefc02d3c367f280e128ec310c9f9198d44cd76b6726cd6c06c002770a1a7dc069ddd06f7a821a176931573d40e63b015ce88b6de01a61205d719567f"), }, }, }
TestNetParams is the config for test-net
Functions ¶
func InitActiveNetParams ¶
InitActiveNetParams load the config by chain ID
func IsBech32SegwitPrefix ¶
IsBech32SegwitPrefix returns whether the prefix is a known prefix for segwit addresses on any default or registered network. This is used when decoding an address string into a specific address type.
func VotePendingBlockNums ¶
Types ¶
type CasperConfig ¶
type CasperConfig struct { // BlockTimeInterval, milliseconds, the block time interval for producing a block BlockTimeInterval uint64 // MaxTimeOffsetMs represent the max number of seconds a block time is allowed to be ahead of the current time MaxTimeOffsetMs uint64 // BlocksOfEpoch represent the block num in one epoch BlocksOfEpoch uint64 // MinValidatorVoteNum is the minimum vote number of become validator MinValidatorVoteNum uint64 // VotePendingBlockNumber is the locked block number of vote utxo VotePendingBlockNums []VotePendingBlockNum FederationXpubs []chainkd.XPub }
type Params ¶
type Params struct { // Name defines a human-readable identifier for the network. Name string Bech32HRPSegwit string // DefaultPort defines the default peer-to-peer port for the network. DefaultPort string // DNSSeeds defines a list of DNS seeds for the network that are used // as one method to discover peers. DNSSeeds []string // CasperConfig defines the casper consensus parameters CasperConfig }
Params store the config for different network
type ServiceFlag ¶
type ServiceFlag uint64
ServiceFlag use uint64 to indicate what kind of server this node can provide. one uint64 can represent 64 type of service flag
const ( // SFFullNode is a flag used to indicate a peer is a full node. SFFullNode ServiceFlag = 1 << iota // SFFastSync indicate peer support header first mode SFFastSync // SFSPV indicate peer support spv mode SFSPV // DefaultServices is the server that this node support DefaultServices = SFFullNode | SFFastSync | SFSPV )
func (ServiceFlag) IsEnable ¶
func (f ServiceFlag) IsEnable(checkFlag ServiceFlag) bool
IsEnable check does the flag support the input flag function