consensus

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2018 License: AGPL-3.0 Imports: 2 Imported by: 70

Documentation

Index

Constants

View Source
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(140700041250000000)

	// 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

View Source
var ActiveNetParams = MainNetParams

ActiveNetParams is ...

View Source
var BTMAssetID = &bc.AssetID{
	V0: uint64(18446744073709551615),
	V1: uint64(18446744073709551615),
	V2: uint64(18446744073709551615),
	V3: uint64(18446744073709551615),
}

BTMAssetID is BTM's asset id, the soul asset of Bytom

View Source
var BTMDefinitionMap = map[string]interface{}{
	"name":        BTMAlias,
	"symbol":      BTMAlias,
	"decimals":    8,
	"description": `Bytom Official Issue`,
}

BTMDefinitionMap is the ....

View Source
var InitialSeed = &bc.Hash{
	V0: uint64(11412844483649490393),
	V1: uint64(4614157290180302959),
	V2: uint64(1780246333311066183),
	V3: uint64(9357197556716379726),
}

InitialSeed is SHA3-256 of Byte[0^32]

View Source
var MainNetParams = Params{
	Name:            "main",
	Bech32HRPSegwit: "bm",
}

MainNetParams is the config for production

View Source
var NetParams = map[string]Params{
	"mainnet": MainNetParams,
	"testnet": TestNetParams,
	"solonet": SoloNetParams,
}

NetParams is the correspondence between chain_id and Params

View Source
var SoloNetParams = Params{
	Name:            "solo",
	Bech32HRPSegwit: "sm",
}

TestNetParams is the config for test-net

View Source
var TestNetParams = Params{
	Name:            "test",
	Bech32HRPSegwit: "tm",
}

TestNetParams is the config for test-net

Functions

func BlockSubsidy

func BlockSubsidy(height uint64) uint64

BlockSubsidy calculate the coinbase rewards on given block height

func IsBech32SegwitPrefix added in v0.1.4

func IsBech32SegwitPrefix(prefix string, params *Params) bool

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 Params added in v0.1.4

type Params struct {
	// Name defines a human-readable identifier for the network.
	Name            string
	Bech32HRPSegwit string
}

Params store the config for different network

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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