equihashjs-verify
Version:
Equihash JavaScript verification ported from ZCASH on Python
41 lines (29 loc) • 1.38 kB
Markdown
# equihashjs-verify
[](https://www.npmjs.com/package/equihashjs-verify)
[](https://travis-ci.org/Vutov/equihashjs-verify)
JavaScript check for valid Equihash solutions. Ported from ZCASH on Python
### ZCASH implementation: https://github.com/zcash/zcash/blob/master/qa/rpc-tests/test_framework/equihash.py
## Installation
``` bash
npm install equihashjs-verify
```
## Usage
````javascript
var eq = require('equihashjs-verify')
var equihash = new eq.Equihash(eq.networks.bitcoingold)
var header = new Buffer(..., 'hex') // include nonce in the header
var solution = new Buffer(..., 'hex') // do not include byte size preamble "fd4005"
var valid = equihash.verify(header, solution)
//returns boolean
````
````javascript
var eq = require('equihashjs-verify')
var equihash = new eq.Equihash(eq.networks.bitcoingold)
var header = new Buffer(..., 'hex') // nonce may not be included in the header
var solution = new Buffer(..., 'hex') // do not include byte size preamble "fd4005"
var nonce = new Buffer(..., 'hex')
var valid = equihash.verify(header, solution, nonce)
//returns boolean
````
## Example:
[Verify](https://github.com/Vutov/equihashjs-verify/blob/master/test/equihash.test.js#L16)