Created
April 16, 2018 10:18
-
-
Save xd4rker/6fd01c797303dd1b38ab0eb03891ce5a to your computer and use it in GitHub Desktop.
Revisions
-
xd4rker created this gist
Apr 16, 2018 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ 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); });