Created
September 22, 2018 22:49
-
-
Save riccjohn/27eec928611275f9f9d7e36d262b0f39 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
| const sha256 = require('sha256'); | |
| class Block { | |
| constructor(index, timestamp, data, prevHash) { | |
| this.index = index; | |
| this.timestamp = timestamp; | |
| this.data = data; | |
| this.prevHash = prevHash; | |
| this.thisHash = sha256( | |
| this.index + this.timestamp + this.data + this.prevHash | |
| ); | |
| } | |
| } | |
| const createGenesisBlock = () => new Block(0, Date.now(), 'Genesis Block', '0'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment