1.0.4 • Published 4 years ago

@biut-block/biutjs-pow v1.0.4

Weekly downloads
1
License
ISC
Repository
github
Last release
4 years ago

JavaScript Style Guide

[JavaScript Style Guide]

SECPow

This library is for sec blockchain pow mining and verification

new SECPow(config)

ParamTypeDescription
configObjectJSON format configurations for constructor

secPow.verifyPOW(block, callback) => None

Verify correctness of pow result

Kind: instance method of SECPow

ParamTypeDescription
blockObjectsingle block data
callbackfunctioncallback function

secPow.mineLight(block, difficulty, callback) => None

Light client mining function

Kind: instance method of SECPow

ParamTypeDescription
blockObjectsingle block data
difficultyIntegerdifficulty value
callbackfunctioncallback function

secPow.calcDifficulty(parentDiff, parentBlockNumber, parentTimeStamp, currentTimestamp) => Number

Calculate POW difficulty for next block

Kind: instance method of SECPow

ParamTypeDescription
parentDiffNumberparent block difficulty value
parentBlockNumberIntegerparent block number
parentTimeStampIntegerparent block generated timestamp
currentTimestampIntegercurrent generated timestamp

secPow.stopMining() => None

Stop the mining operation