TrustNote Pow-Miner
Install
$ npm install trustnote-pow-miner
Supported Platforms
MacOS, Linux, Windows
Documentation
.startMining( oOptions, pfnCallback )
start mining
- oOptions
name | type | optional | comment |
---|---|---|---|
.bufInputHeader | Buffer | no | 140 bytes Buffer object |
.difficulty | Number | no | number |
.calcTimes | Number | yes | default value : 30, compute times per loop |
.maxLoop | Number | yes | default value : 10000000, max loop |
- pfnCallback( err, oSolution )
oSolution is a plain object :
{ win : true, hashHex : sActualHashHex, nonce : uActualNonce }
{ win : false, gameOver : true, hashHex : null, nonce : 0 }
const _miner = ; /** * */let bufInput = 140 ;let nDifficulty = _miner;let oOptions = bufInputHeader : bufInput difficulty : nDifficulty calcTimes : 30 maxLoop : 1000000 ;_miner;
.stopMining()
stop mining
const _miner = ; _miner;console;
.checkProofOfWork( bufInputHeader, uDifficulty, uActualNonce, sActualHashHex, pfnCallback )
check proof of work
const _miner = ;