Skip to content

Instantly share code, notes, and snippets.

@wanderer
Created August 10, 2015 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wanderer/7520ae8cd84397c6dc91 to your computer and use it in GitHub Desktop.
Save wanderer/7520ae8cd84397c6dc91 to your computer and use it in GitHub Desktop.
const Ethash = require('./')
const levelup = require('levelup')
const memdown = require('memdown')
Ethash.prototype.verifySubmit = function (number, headerHash, nonce, cb) {
var self = this
console.log(number);
this.loadEpoc(number, function () {
console.log("EPOC set");
console.log(self.seed.toString('hex'));
var a = self.run(headerHash, new Buffer(nonce, 'hex'));
cb(a.hash);
})
}
var cacheDB = levelup('', {
db: memdown
})
var ethash = new Ethash(cacheDB);
var header = Buffer('0e2887aa1a0668bf8254d1a6ae518927de99e3e5d7f30fd1f16096e2608fe05e', 'hex');
ethash.verifySubmit(35414, header, 'e360b6170c229d15', function (result) {
console.log(result.toString('hex'));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment