BlockchainJavascript
BlockchainJavascript copied to clipboard
Adding first transaction twice into the blockchain
Looks like app.js
is reinserting the first transaction into the second block as part of that array. In theory, this might result in Mary giving John another 100 units of something.
I'd suggest instead, something like:
let tran1 = new Transaction('Mary', 'John', 100);
let block1 = blockchain.getNextBlock([tran1]);
blockchain.addBlock(block1);
let tran2 = new Transaction("Azam", "Jerry", 10);
let tran3 = new Transaction("Mary", "Jerry", 1);
let block2 = blockchain.getNextBlock([tran3,tran2]);
blockchain.addBlock(block2);