Last active
December 18, 2019 15:17
-
-
Save ssaurel/9e1bafe7ccb174d973ee4176698dd218 to your computer and use it in GitHub Desktop.
Blockchain Implementation in JS by @ssaurel
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 blockchain = new Blockchain(4); | |
var block1 = blockchain.newBlock("Second Block"); | |
blockchain.addBlock(block1); | |
var block2 = blockchain.newBlock("Third Block"); | |
blockchain.addBlock(block2); | |
var block3 = blockchain.newBlock("Fourth Block"); | |
blockchain.addBlock(block3); | |
console.log("Blockchain Validity: " + blockchain.isBlockchainValid()); | |
blockchain.display(); | |
var block4 = new Block(12, "falseHash", Date.now(), "Block Invalid"); | |
blockchain.addBlock(block4); | |
console.log("Blockchain Validity: " + blockchain.isBlockchainValid()); | |
blockchain.display(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment