Documentation
¶
Overview ¶
pow package is responsible for proof of work calculation/verification for an object transmitted over the network.
Index ¶
- func CalculateTarget(PayloadLength, TTL, NonceTrialsPerByte, PayloadLengthExtraBytes int) uint64
- func Check(objectData []byte, PayloadLengthExtraBytes, NonceTrialsPerByte int) bool
- func DoOpenCL(target uint64, initialHash []byte) uint64
- func DoParallel(target uint64, initialHash []byte, parallelCount int) uint64
- func DoSequential(target uint64, initialHash []byte) uint64
- type Do
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateTarget ¶
CalculateTarget calculates the target POW value. PayloadLength includes the full length of the payload (inluding the width of the initial nonce field). TTL is the time to live (in seconds). Information about NonceTrialsPerByte and PayloadLengthExtraBytes can be found at: https://bitmessage.org/wiki/Proof_of_work
func DoParallel ¶
DoParallel does the POW using cpuCount number of goroutines and returns the nonce value. TODO: Optimize parallel and make it stable. Performance is very volatile at the moment.
func DoSequential ¶
DoSequential does the POW sequentially and returns the nonce value.