pow

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2021 License: ISC Imports: 10 Imported by: 6

Documentation

Overview

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file.

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Copyright (c) 2017-2020 The qitmeer developers license that can be found in the LICENSE file. Reference resources of rust bitVector

Index

Constants

View Source
const (
	PROOF_DATA_EDGE_BITS_START  = 0
	PROOF_DATA_EDGE_BITS_END    = 1
	PROOF_DATA_CIRCLE_NONCE_END = 169
)
View Source
const MAX_CUCKAROOEDGEBITS = 32
View Source
const MAX_CUCKAROOMMEDGEBITS = 29
View Source
const MAX_CUCKATOOEDGEBITS = 32
View Source
const MIN_CUCKAROOEDGEBITS = 24
View Source
const MIN_CUCKAROOMMEDGEBITS = 29
View Source
const MIN_CUCKATOOEDGEBITS = 29
View Source
const POW_LENGTH = 178

the pow length is 178

View Source
const PROOFDATA_LENGTH = 169

proof data length is 169

Variables

View Source
var (

	// oneLsh256 is 1 shifted left 256 bits.  It is defined here to avoid
	// the overhead of creating it multiple times.
	OneLsh256 = new(big.Int).Lsh(bigOne, 256)
)
View Source
var PowMapString = map[PowType]interface{}{
	BLAKE2BD:         "blake2bd",
	CUCKAROO:         "cuckaroo",
	CUCKATOO:         "cuckatoo",
	CUCKAROOM:        "cuckaroom",
	X16RV3:           "x16rv3",
	X8R16:            "x8r16",
	QITMEERKECCAK256: "qitmeer_keccak256",
	CRYPTONIGHT:      "cryptonight",
	MEERXKECCAKV1:    "meer_xkeccak_v1",
}

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 CalcCuckooDiff

func CalcCuckooDiff(scale uint64, blockHash hash.Hash) *big.Int

calc cuckoo diff

func CalcWork

func CalcWork(bits uint32, powType PowType) *big.Int

CalcWork calculates a work value from difficulty bits. it increases the difficulty for generating a block by decreasing the value which the generated hash must be less than.

This difficulty target is stored in each block header using a compact representation as described in the documentation for CompactToBig.

The main chain is selected by choosing the chain that has the most proof of work (highest difficulty).

Since a lower target difficulty value equates to higher actual difficulty, the work value which will be accumulated must be the inverse of the difficulty. Also, in order to avoid potential division by zero and really small floating point numbers, the result adds 1 to the denominator and multiplies the numerator by 2^256.

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 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. TODO, revisit the compact difficulty form design

func ConvertBytesToUint32Array

func ConvertBytesToUint32Array(data []byte) []uint32

func CuckooDiffToTarget

func CuckooDiffToTarget(scale uint64, diff *big.Int) string

calc cuckoo diff convert to target hash like 7fff000000000000000000000000000000000000000000000000000000000000

func GetPowName added in v0.10.1

func GetPowName(powType PowType) string

func HashToBig

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

HashToBig converts a hash.Hash into a big.Int that can be used to perform math comparisons.

Types

type Blake2bd

type Blake2bd struct {
	Pow
}

func (*Blake2bd) BlockData

func (this *Blake2bd) BlockData() PowBytes

pow proof data

func (*Blake2bd) Bytes

func (this *Blake2bd) Bytes() PowBytes

pow proof data

func (*Blake2bd) CompareDiff

func (this *Blake2bd) CompareDiff(newTarget *big.Int, target *big.Int) bool

compare the target wether target match the target diff

func (*Blake2bd) FindSolver added in v0.10.1

func (this *Blake2bd) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

solve solution

func (*Blake2bd) GetNextDiffBig

func (this *Blake2bd) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*Blake2bd) GetPowResult

func (this *Blake2bd) GetPowResult() json.PowResult

func (*Blake2bd) GetSafeDiff

func (this *Blake2bd) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*Blake2bd) Verify

func (this *Blake2bd) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type CryptoNight added in v0.10.1

type CryptoNight struct {
	Pow
}

func (*CryptoNight) BlockData added in v0.10.1

func (this *CryptoNight) BlockData() PowBytes

pow proof data

func (*CryptoNight) Bytes added in v0.10.1

func (this *CryptoNight) Bytes() PowBytes

pow proof data

func (*CryptoNight) CompareDiff added in v0.10.1

func (this *CryptoNight) CompareDiff(newTarget *big.Int, target *big.Int) bool

compare the target wether target match the target diff

func (*CryptoNight) FindSolver added in v0.10.1

func (this *CryptoNight) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

not support

func (*CryptoNight) GetNextDiffBig added in v0.10.1

func (this *CryptoNight) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*CryptoNight) GetPowResult added in v0.10.1

func (this *CryptoNight) GetPowResult() json.PowResult

func (*CryptoNight) GetSafeDiff added in v0.10.1

func (this *CryptoNight) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*CryptoNight) Verify added in v0.10.1

func (this *CryptoNight) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type Cuckaroo

type Cuckaroo struct {
	Cuckoo
}

func (*Cuckaroo) FindSolver added in v0.10.1

func (this *Cuckaroo) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

solve solution

func (*Cuckaroo) GetNextDiffBig

func (this *Cuckaroo) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*Cuckaroo) GetSafeDiff

func (this *Cuckaroo) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*Cuckaroo) GraphWeight

func (this *Cuckaroo) GraphWeight() uint64

calc scale the edge_bits is bigger ,then scale is bigger Reference resources https://eprint.iacr.org/2014/059.pdf 9. Difficulty control page 6 while the average number of cycles found increases slowly with size; from 2 at 2^20 to 3 at 2^30 Less times of hash calculation with the same difficulty 24 => 48 25 => 100 26 => 208 27 => 432 28 => 896 29 => 1856 30 => 3840 31 => 7936 assume init difficulty is 1000 24 target is 0c49ba5e353f7ced000000000000000000000000000000000000000000000000 (The meaning of difficulty needs to be found 1000/48 * 50 ≈ 1000 times in edge_bits 24, and the answer may be obtained once.) why * 50 , because the when edge_count/nodes = 1/2,to find 42 cycles the probality is 2.2% 29 target is db22d0e560418937000000000000000000000000000000000000000000000000 (The difficulty needs to be found 1000/1856 * 50 ≈ 26 times in edge_bits 29, and the answer may be obtained once.) so In order to ensure the fairness of different edge indexes, the mining difficulty is different.

func (*Cuckaroo) Verify

func (this *Cuckaroo) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type Cuckaroom added in v0.10.1

type Cuckaroom struct {
	Cuckoo
}

func (*Cuckaroom) FindSolver added in v0.10.1

func (this *Cuckaroom) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

not support

func (*Cuckaroom) GetNextDiffBig added in v0.10.1

func (this *Cuckaroom) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*Cuckaroom) GetSafeDiff added in v0.10.1

func (this *Cuckaroom) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*Cuckaroom) GraphWeight added in v0.10.1

func (this *Cuckaroom) GraphWeight() uint64

calc scale the edge_bits is bigger ,then scale is bigger Reference resources https://eprint.iacr.org/2014/059.pdf 9. Difficulty control page 6 while the average number of cycles found increases slowly with size; from 2 at 2^20 to 3 at 2^30 Less times of hash calculation with the same difficulty 24 => 48 25 => 100 26 => 208 27 => 432 28 => 896 29 => 1856 30 => 3840 31 => 7936 assume init difficulty is 1000 24 target is 0c49ba5e353f7ced000000000000000000000000000000000000000000000000 (The meaning of difficulty needs to be found 1000/48 * 50 ≈ 1000 times in edge_bits 24, and the answer may be obtained once.) why * 50 , because the when edge_count/nodes = 1/2,to find 42 cycles the probality is 2.2% 29 target is db22d0e560418937000000000000000000000000000000000000000000000000 (The difficulty needs to be found 1000/1856 * 50 ≈ 26 times in edge_bits 29, and the answer may be obtained once.) so In order to ensure the fairness of different edge indexes, the mining difficulty is different.

func (*Cuckaroom) Verify added in v0.10.1

func (this *Cuckaroom) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type Cuckatoo

type Cuckatoo struct {
	Cuckoo
}

func (*Cuckatoo) FindSolver added in v0.10.1

func (this *Cuckatoo) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

not support

func (*Cuckatoo) GetNextDiffBig

func (this *Cuckatoo) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*Cuckatoo) GetSafeDiff

func (this *Cuckatoo) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*Cuckatoo) GraphWeight

func (this *Cuckatoo) GraphWeight() uint64

calc scale the edge_bits is bigger ,then scale is bigger Reference resources https://eprint.iacr.org/2014/059.pdf 9. Difficulty control page 6 while the average number of cycles found increases slowly with size; from 2 at 2^20 to 3 at 2^30 Less times of hash calculation with the same difficulty 24 => 48 25 => 100 26 => 208 27 => 432 28 => 896 29 => 1856 30 => 3840 31 => 7936 assume init difficulty is 1000 24 target is 0c49ba5e353f7ced000000000000000000000000000000000000000000000000 (The meaning of difficulty needs to be found 1000/48 * 50 ≈ 1000 times in edge_bits 24, and the answer may be obtained once.) why * 50 , because the when edge_count/nodes = 1/2,to find 42 cycles the probality is 2.2% 29 target is db22d0e560418937000000000000000000000000000000000000000000000000 (The difficulty needs to be found 1000/1856 * 50 ≈ 26 times in edge_bits 29, and the answer may be obtained once.) so In order to ensure the fairness of different edge indexes, the mining difficulty is different.

func (*Cuckatoo) Verify

func (this *Cuckatoo) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type Cuckoo

type Cuckoo struct {
	Pow
}

func (*Cuckoo) BlockData

func (this *Cuckoo) BlockData() PowBytes

pow proof data

func (*Cuckoo) Bytes

func (this *Cuckoo) Bytes() PowBytes

cuckoo pow proof data

func (*Cuckoo) CompareDiff

func (this *Cuckoo) CompareDiff(newTarget *big.Int, target *big.Int) bool

compare the target wether target match the target diff

func (*Cuckoo) GetCircleNonces

func (this *Cuckoo) GetCircleNonces() (nonces [cuckoo.ProofSize]uint32)

func (*Cuckoo) GetEdgeBits

func (this *Cuckoo) GetEdgeBits() uint8

get edge bits

func (*Cuckoo) GetPowResult

func (this *Cuckoo) GetPowResult() json.PowResult

func (*Cuckoo) GetSipHash

func (this *Cuckoo) GetSipHash(headerData []byte) hash.Hash

get sip hash first header data 113 bytes hash

func (*Cuckoo) GraphWeight

func (this *Cuckoo) GraphWeight() uint64

func (*Cuckoo) SetCircleEdges

func (this *Cuckoo) SetCircleEdges(edges []uint32)

set edge circles

func (*Cuckoo) SetEdgeBits

func (this *Cuckoo) SetEdgeBits(edge_bits uint8)

set edge bits

type IPow

type IPow interface {
	// verify result difficulty
	Verify(headerData []byte, blockHash hash.Hash, targetDiff uint32) error
	//set header nonce
	SetNonce(nonce uint64)
	//calc next diff
	GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int
	GetNonce() uint64
	GetPowType() PowType
	//set pow type
	SetPowType(powType PowType)
	GetProofData() string
	//set proof data
	SetProofData([]byte)
	Bytes() PowBytes
	BlockData() PowBytes
	//if cur_reduce_diff > 0 compare cur_reduce_diff with powLimitBits or minDiff ,the cur_reduce_diff should less than powLimitBits , and should more than min diff
	//if cur_reduce_diff <=0 return powLimit or min diff
	GetSafeDiff(cur_reduce_diff uint64) *big.Int
	// pow percent
	PowPercent() *big.Int
	//pow result
	GetPowResult() json.PowResult
	//SetParams
	SetParams(params *PowConfig)
	//SetHeight
	SetMainHeight(height MainHeight)
	CheckAvailable() bool
	CompareDiff(newtarget *big.Int, target *big.Int) bool
	FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool
}

func GetInstance

func GetInstance(powType PowType, nonce uint64, proofData []byte) IPow

get pow instance

type MainHeight added in v0.10.1

type MainHeight uint32

type MeerXKeccakV1 added in v0.10.1

type MeerXKeccakV1 struct {
	Pow
}

func (*MeerXKeccakV1) BlockData added in v0.10.1

func (this *MeerXKeccakV1) BlockData() PowBytes

pow proof data

func (*MeerXKeccakV1) Bytes added in v0.10.1

func (this *MeerXKeccakV1) Bytes() PowBytes

pow proof data

func (*MeerXKeccakV1) CompareDiff added in v0.10.1

func (this *MeerXKeccakV1) CompareDiff(newTarget *big.Int, target *big.Int) bool

compare the target wether target match the target diff

func (*MeerXKeccakV1) FindSolver added in v0.10.1

func (this *MeerXKeccakV1) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

not support

func (*MeerXKeccakV1) GetNextDiffBig added in v0.10.1

func (this *MeerXKeccakV1) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*MeerXKeccakV1) GetPowResult added in v0.10.1

func (this *MeerXKeccakV1) GetPowResult() json.PowResult

func (*MeerXKeccakV1) GetSafeDiff added in v0.10.1

func (this *MeerXKeccakV1) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*MeerXKeccakV1) Verify added in v0.10.1

func (this *MeerXKeccakV1) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type Percent

type Percent map[MainHeight]PercentItem

type PercentItem added in v0.10.1

type PercentItem map[PowType]PercentValue

type PercentValue added in v0.10.1

type PercentValue uint32

type Pow

type Pow struct {
	PowType   PowType       //header pow type 1 bytes
	Nonce     uint64        //header nonce 4 bytes
	ProofData ProofDataType // 1 edge_bits  168  bytes circle length total 169 bytes
	// contains filtered or unexported fields
}

func (*Pow) CheckAvailable added in v0.10.1

func (this *Pow) CheckAvailable() bool

check pow is available

func (*Pow) GetNonce

func (this *Pow) GetNonce() uint64

func (*Pow) GetPowType

func (this *Pow) GetPowType() PowType

func (*Pow) GetProofData

func (this *Pow) GetProofData() string

func (*Pow) PowPercent added in v0.10.1

func (this *Pow) PowPercent() *big.Int

func (*Pow) SetMainHeight

func (this *Pow) SetMainHeight(mainHeight MainHeight)

func (*Pow) SetNonce

func (this *Pow) SetNonce(nonce uint64)

func (*Pow) SetParams

func (this *Pow) SetParams(params *PowConfig)

func (*Pow) SetPowType

func (this *Pow) SetPowType(powType PowType)

func (*Pow) SetProofData

func (this *Pow) SetProofData(data []byte)

set proof data except pow type

type PowBytes

type PowBytes []byte

type PowConfig

type PowConfig struct {
	// PowLimit defines the highest allowed proof of work value for a block
	// as a uint256.
	Blake2bdPowLimit *big.Int
	// PowLimitBits defines the highest allowed proof of work value for a
	// block in compact form.
	// highest value is mean min difficulty
	Blake2bdPowLimitBits uint32

	X16rv3PowLimit     *big.Int
	X16rv3PowLimitBits uint32

	X8r16PowLimit     *big.Int
	X8r16PowLimitBits uint32

	CryptoNightPowLimit     *big.Int
	CryptoNightPowLimitBits uint32

	QitmeerKeccak256PowLimit     *big.Int
	QitmeerKeccak256PowLimitBits uint32

	MeerXKeccakV1PowLimit     *big.Int
	MeerXKeccakV1PowLimitBits uint32

	// cuckoo difficulty calc params  min difficulty
	CuckarooMinDifficulty  uint32
	CuckaroomMinDifficulty uint32
	CuckatooMinDifficulty  uint32

	Percent map[MainHeight]PercentItem

	AdjustmentStartMainHeight MainHeight
	// contains filtered or unexported fields
}
var PowConfigInstance *PowConfig

func GetPowConfig

func GetPowConfig() *PowConfig

global cache

func (*PowConfig) Check

func (this *PowConfig) Check() error

check percent

func (*PowConfig) GetPercentByHeightAndType added in v0.10.1

func (this *PowConfig) GetPercentByHeightAndType(h MainHeight, powType PowType) PercentValue

get Percent By height

func (*PowConfig) Set

func (this *PowConfig) Set(p *PowConfig) *PowConfig

set config GetPowConfig().Set(params.PowConfig)

type PowType

type PowType byte
const (
	//pow type enum
	BLAKE2BD         PowType = 0
	CUCKAROO         PowType = 1
	CUCKATOO         PowType = 2
	CUCKAROOM        PowType = 3
	X16RV3           PowType = 4
	X8R16            PowType = 5
	QITMEERKECCAK256 PowType = 6
	CRYPTONIGHT      PowType = 7
	MEERXKECCAKV1    PowType = 8
)

type ProofDataType

type ProofDataType [PROOFDATA_LENGTH]byte

func (*ProofDataType) Bytes

func (this *ProofDataType) Bytes() []byte

func (*ProofDataType) String

func (this *ProofDataType) String() string

type QitmeerKeccak256 added in v0.10.1

type QitmeerKeccak256 struct {
	Pow
}

func (*QitmeerKeccak256) BlockData added in v0.10.1

func (this *QitmeerKeccak256) BlockData() PowBytes

pow proof data

func (*QitmeerKeccak256) Bytes added in v0.10.1

func (this *QitmeerKeccak256) Bytes() PowBytes

pow proof data

func (*QitmeerKeccak256) CompareDiff added in v0.10.1

func (this *QitmeerKeccak256) CompareDiff(newTarget *big.Int, target *big.Int) bool

compare the target wether target match the target diff

func (*QitmeerKeccak256) FindSolver added in v0.10.1

func (this *QitmeerKeccak256) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

not support

func (*QitmeerKeccak256) GetNextDiffBig added in v0.10.1

func (this *QitmeerKeccak256) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*QitmeerKeccak256) GetPowResult added in v0.10.1

func (this *QitmeerKeccak256) GetPowResult() json.PowResult

func (*QitmeerKeccak256) GetSafeDiff added in v0.10.1

func (this *QitmeerKeccak256) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*QitmeerKeccak256) Verify added in v0.10.1

func (this *QitmeerKeccak256) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type X16rv3 added in v0.10.1

type X16rv3 struct {
	Pow
}

func (*X16rv3) BlockData added in v0.10.1

func (this *X16rv3) BlockData() PowBytes

pow proof data

func (*X16rv3) Bytes added in v0.10.1

func (this *X16rv3) Bytes() PowBytes

pow proof data

func (*X16rv3) CompareDiff added in v0.10.1

func (this *X16rv3) CompareDiff(newTarget *big.Int, target *big.Int) bool

compare the target wether target match the target diff

func (*X16rv3) FindSolver added in v0.10.1

func (this *X16rv3) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

not support

func (*X16rv3) GetNextDiffBig added in v0.10.1

func (this *X16rv3) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*X16rv3) GetPowResult added in v0.10.1

func (this *X16rv3) GetPowResult() json.PowResult

func (*X16rv3) GetSafeDiff added in v0.10.1

func (this *X16rv3) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*X16rv3) Verify added in v0.10.1

func (this *X16rv3) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

type X8r16 added in v0.10.1

type X8r16 struct {
	Pow
}

func (*X8r16) BlockData added in v0.10.1

func (this *X8r16) BlockData() PowBytes

pow proof data

func (*X8r16) Bytes added in v0.10.1

func (this *X8r16) Bytes() PowBytes

pow proof data

func (*X8r16) CompareDiff added in v0.10.1

func (this *X8r16) CompareDiff(newTarget *big.Int, target *big.Int) bool

compare the target wether target match the target diff

func (*X8r16) FindSolver added in v0.10.1

func (this *X8r16) FindSolver(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) bool

not support

func (*X8r16) GetNextDiffBig added in v0.10.1

func (this *X8r16) GetNextDiffBig(weightedSumDiv *big.Int, oldDiffBig *big.Int, currentPowPercent *big.Int) *big.Int

func (*X8r16) GetPowResult added in v0.10.1

func (this *X8r16) GetPowResult() json.PowResult

func (*X8r16) GetSafeDiff added in v0.10.1

func (this *X8r16) GetSafeDiff(cur_reduce_diff uint64) *big.Int

func (*X8r16) Verify added in v0.10.1

func (this *X8r16) Verify(headerData []byte, blockHash hash.Hash, targetDiffBits uint32) error

Jump to

Keyboard shortcuts

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