Skip to content
This repository has been archived by the owner on Dec 10, 2020. It is now read-only.

Ethash.prototype.calcDatasetItem not work #1

Closed
perl5577 opened this issue Aug 9, 2015 · 4 comments
Closed

Ethash.prototype.calcDatasetItem not work #1

perl5577 opened this issue Aug 9, 2015 · 4 comments

Comments

@perl5577
Copy link
Contributor

perl5577 commented Aug 9, 2015

For debuging
console.log('Ethash.prototype.calcDatasetItem 1');
console.log(mix);
console.log('i:' + i + ' n:' + n + ' r:' + r);
mix.writeInt32LE(mix.readUInt32LE(0) ^ i)

Ethash.prototype.calcDatasetItem 1
<Buffer 62 8e 0a 0d e9 eb 22 c1 0a b0 d7 b3 29 e0 ae f4 f0 b9 f2 5e ef da c5 9d b8 e3 a7 ee 7c 08 66 8a f8 c2 1c 1e b0 13 34 61 4f b9 5a 43 27 24 6d af 1c 86 5c ...>
i:12511692 n:264179 r:16

buffer.js:786
throw TypeError('offset is not uint');
^

@wanderer
Copy link
Member

Your are not really suppose to use that calcDatasetItem directly. I wrote you an example let me know how it goes!

@perl5577
Copy link
Contributor Author

Nop

I have add on index.js

Ethash.prototype.verifySubmit = function(number,headerHash,nonce, cb) {
var self = this
console.log(number);
this.loadEpoc(number, function(){
console.log("EPOC set");
console.log(this.seed);
var a = self.run(headerHash, new Buffer(nonce, 'hex'), self.fullSize);
var result = new BN(a.result);
cb(result);
})
}

And code running

const Ethash = require('ethashjs')
const levelup = require('levelup')
const memdown = require('memdown')

var cacheDB = levelup('', {
db: memdown
})

var ethash = new Ethash(cacheDB);

var header = Buffer('0e2887aa1a0668bf8254d1a6ae518927de99e3e5d7f30fd1f16096e2608fe05e','hex') ;

ethash.verifySubmit(35414,header, 'e360b6170c229d15',function (result) {
consol.log(result);
});

@perl5577
Copy link
Contributor Author

run -> verifySubmit -> loadEpoc - > getEpoc // this.epoc is set
-> findLastSeed // I have make many coorection for working ( not work if epoc >= 1 )
-> cacheDB.get //Fixing seed utils
->mkcache // Failed

@wanderer
Copy link
Member

ok @perl5577 can you run this https://gist.github.com/wanderer/7520ae8cd84397c6dc91 with the lastest code. And see if that works?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants