Created
September 22, 2018 23:02
-
-
Save riccjohn/e5ed20d9be2a0c91ded62c527ad82555 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 createBlockchain = num => { | |
| const blockchain = [createGenesisBlock()]; | |
| let previousBlock = blockchain[0]; | |
| for (let i = 1; i < num; i += 1) { | |
| const blockToAdd = nextBlock(previousBlock, `This is block #${i}`); | |
| blockchain.push(blockToAdd); | |
| previousBlock = blockToAdd; | |
| } | |
| console.log(blockchain); | |
| }; | |
| const lengthToCreate = 20; | |
| createBlockchain(lengthToCreate); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment