consensus

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2017 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// define the Max transaction size and Max block size
	MaxTxSize    = uint64(1024)
	MaxBlockSzie = uint64(16384)

	BlocksPerRetarget = uint64(1024)
)

Variables

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

define the BTM asset id, the soul asset of Bytom

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

Functions

func BigToCompact

func BigToCompact(n *big.Int) uint64

BigToCompact converts a whole number N to a compact representation using an unsigned 64-bit number

func BlockSubsidy

func BlockSubsidy(height uint64) uint64

func CalcNextRequiredDifficulty

func CalcNextRequiredDifficulty(lastBH, compareBH *legacy.BlockHeader) uint64

func CheckProofOfWork

func CheckProofOfWork(hash *bc.Hash, bits uint64) bool

func CompactToBig

func CompactToBig(compact uint64) *big.Int

CompactToBig converts a compact representation of a whole number N to an unsigned 64-bit number. The representation is similar to IEEE754 floating point numbers.

-------------------------------------------------
|   Exponent     |    Sign    |    Mantissa     |
-------------------------------------------------
| 8 bits [63-56] | 1 bit [55] | 55 bits [54-00] |
-------------------------------------------------

N = (-1^sign) * mantissa * 256^(exponent-3)

func HashToBig

func HashToBig(hash *bc.Hash) *big.Int

perform math comparisons.

func InitBlock

func InitBlock() []byte

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
}

Jump to

Keyboard shortcuts

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