Created
April 16, 2018 10:18
-
-
Save xd4rker/6fd01c797303dd1b38ab0eb03891ce5a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = {}; | |
web3.eth.getBlock(3045393, function(err, res) { | |
data.parentHash = res.parentHash; | |
data.timestamp = res.timestamp; | |
var answerHash = web3.sha3([res.parentHash.slice(2), res.timestamp.toString(16).padStart(64, "0")].join(''), {encoding: 'hex'}) | |
data.answer = parseInt(answerHash.slice(-2), 16); | |
console.log(data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment