Documentation ¶
Index ¶
Constants ¶
const ( // Max gas that one block contains MaxBlockGas = uint64(10000000) VMGasRate = int64(200) StorageGasRate = int64(1) MaxGasAmount = int64(200000) DefaultGasCredit = int64(30000) //config parameter for coinbase reward CoinbasePendingBlockNumber = uint64(100) InitialBlockSubsidy = uint64(125000000000) // config for pow mining BlocksPerRetarget = uint64(2016) TargetSecondsPerBlock = uint64(150) SeedPerRetarget = uint64(256) // MaxTimeOffsetSeconds is the maximum number of seconds a block time is allowed to be ahead of the current time MaxTimeOffsetSeconds = uint64(60 * 60) MedianTimeBlocks = 11 PayToWitnessPubKeyHashDataSize = 20 PayToWitnessScriptHashDataSize = 32 CoinbaseArbitrarySizeLimit = 128 BTMAlias = "BTM" )
consensus variables
Variables ¶
var ActiveNetParams = TestNetParams
ActiveNetParams is ...
var BTMAssetID = &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}), }
BTMAssetID is BTM's asset id, the soul asset of Bytom
var BTMDefinitionMap = map[string]interface{}{ "name": BTMAlias, "symbol": BTMAlias, "decimals": 8, "description": `Bytom Official Issue`, }
BTMDefinitionMap is the ....
var InitialSeed = &bc.Hash{ V0: uint64(11412844483649490393), V1: uint64(4614157290180302959), V2: uint64(1780246333311066183), V3: uint64(9357197556716379726), }
InitialSeed is SHA3-256 of Byte[0^32]
var NetParams = map[string]Params{ "wisdom": TestNetParams, "solonet": SoloNetParams, }
NetParams is the correspondence between chain_id and Params
var SoloNetParams = Params{ Name: "solo", Bech32HRPSegwit: "sm", Checkpoints: []Checkpoint{}, }
SoloNetParams is the config for test-net
var TestNetParams = Params{ Name: "test", Bech32HRPSegwit: "gm", Checkpoints: []Checkpoint{ {12187, bc.NewHash([32]byte{0x76, 0xe7, 0x18, 0xd7, 0xa3, 0x61, 0xc1, 0x2c, 0x57, 0x88, 0xcd, 0x9d, 0x8a, 0xd8, 0xf2, 0x7f, 0xbc, 0x12, 0x4f, 0xdc, 0x11, 0x3b, 0xb6, 0x1f, 0x3b, 0x89, 0x48, 0x93, 0xbc, 0x95, 0xa7, 0xb1})}, }, }
TestNetParams is the config for test-net
Functions ¶
func BlockSubsidy ¶
BlockSubsidy calculate the coinbase rewards on given block height
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.
Types ¶
type Checkpoint ¶
Checkpoint identifies a known good point in the block chain. Using checkpoints allows a few optimizations for old blocks during initial download and also prevents forks from old blocks.
type Params ¶
type Params struct { // Name defines a human-readable identifier for the network. Name string Bech32HRPSegwit string Checkpoints []Checkpoint }
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