Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BigToCompact ¶
BigToCompact converts a whole number N to a compact representation using an unsigned 64-bit number. Sign is not really being used, but it's kept here.
func CalcNextRequiredDifficulty ¶
func CalcNextRequiredDifficulty(lastBH, compareBH *types.BlockHeader) uint64
CalcNextRequiredDifficulty return the difficulty using compact representation for next block, when a lower difficulty Int actually reflects a more difficult mining progress.
func CheckProofOfWork ¶
CheckProofOfWork checks whether the hash is valid for a given difficulty.
func CompactToBig ¶
CompactToBig converts a compact representation of a whole unsigned integer N to an big.Int. The representation is similar to IEEE754 floating point numbers. Sign is not really being used.
------------------------------------------------- | Exponent | Sign | Mantissa | ------------------------------------------------- | 8 bits [63-56] | 1 bit [55] | 55 bits [54-00] | ------------------------------------------------- N = (-1^sign) * mantissa * 256^(exponent-3) Actually it will be nicer to use 7 instead of 3 for robustness reason.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.