consensus

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: AGPL-3.0 Imports: 3 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

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

Types

This section is empty.

Jump to

Keyboard shortcuts

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