umint

package module
v0.0.0-...-4ccbfa9 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2015 License: ISC Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

umint

µ-minter for ppc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigToCompact

func BigToCompact(n *big.Int) uint32

BigToCompact converts a whole number N to a compact representation using an unsigned 32-bit number. The compact representation only provides 23 bits of precision, so values larger than (2^23 - 1) only encode the most significant digits of the number. See CompactToBig for details.

func CheckStakeKernelHash

func CheckStakeKernelHash(t *StakeKernelTemplate) (hashProofOfStake []byte, success bool, err error, minTarget *big.Int)

func CompactToBig

func CompactToBig(compact uint32) *big.Int

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

Like IEEE754 floating point, there are three basic components: the sign, the exponent, and the mantissa. They are broken out as follows:

  • the most significant 8 bits represent the unsigned base 256 exponent

  • bit 23 (the 24th bit) represents the sign bit

  • the least significant 23 bits represent the mantissa

    ------------------------------------------------- | Exponent | Sign | Mantissa | ------------------------------------------------- | 8 bits [31-24] | 1 bit [23] | 23 bits [22-00] | -------------------------------------------------

The formula to calculate N is:

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

This compact form is only used in bitcoin to encode unsigned 256-bit numbers which represent difficulty targets, thus there really is not a need for a sign bit, but it is implemented here to stay consistent with bitcoind.

func CompactToDiff

func CompactToDiff(bits uint32) (diff float32)

func DiffToTarget

func DiffToTarget(diff float32) (target *big.Int)

func IncCompact

func IncCompact(compact uint32) uint32

Types

type CoinStakeSource

type CoinStakeSource struct {
	BlockTime     int64
	StakeModifier uint64
	TxOffset      uint32
	TxTime        int64

	TxSha []byte

	Outputs map[string]*TxOut
}

type StakeKernelTemplate

type StakeKernelTemplate struct {
	BlockFromTime int64
	StakeModifier uint64
	PrevTxOffset  uint32
	PrevTxTime    int64

	PrevTxOutIndex uint32
	PrevTxOutValue int64

	IsProtocolV03 bool
	StakeMinAge   int64
	Bits          uint32
	TxTime        int64
}

type TxOut

type TxOut struct {
	Value    int64
	PkScript []byte
}

Directories

Path Synopsis
tools
findstake command
webunspents command

Jump to

Keyboard shortcuts

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