Created
April 16, 2018 13:08
-
-
Save xd4rker/a3503318cb019d65eebe94c812cca77e 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
web3.eth.getBlock('latest', function(e, r) { | |
var data = {number: r.number, hash: r.hash, timestamp: r.timestamp }; | |
var sha3 = web3.sha3([data.hash.slice(2), (data.timestamp + 14).toString(16).padStart(64, "0")].join(''), {encoding: 'hex'}); | |
data.answer = parseInt(sha3.slice(-2), 16); | |
contractInstance.guess(data.answer, {value: 1000000000000000000}, function(x, v) { }) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment