Created
February 24, 2017 21:33
-
-
Save lhartikk/9029e732712345d17db90f005817f466 to your computer and use it in GitHub Desktop.
This file contains 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 generateNextBlock = (blockData) => { | |
var previousBlock = getLatestBlock(); | |
var nextIndex = previousBlock.index + 1; | |
var nextTimestamp = new Date().getTime() / 1000; | |
var nextHash = calculateHash(nextIndex, previousBlock.hash, nextTimestamp, blockData); | |
return new Block(nextIndex, previousBlock.hash, nextTimestamp, blockData, nextHash); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment