-
-
Save azamsharp/2e36a038b5b7e0d6c17d7ef6ce739130 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
let Block = require('./models/block') | |
let Transaction = require('./models/transaction') | |
let Blockchain = require('./models/blockchain') | |
// create genesis block | |
let genesisBlock = new Block() | |
let blockchain = new Blockchain(genesisBlock) | |
// create a transaction | |
let transaction = new Transaction('Mary','John',100) | |
let block = blockchain.getNextBlock([transaction]) | |
blockchain.addBlock(block) | |
let anotherTransaction = new Transaction("Azam","Jerry",10) | |
let block1 = blockchain.getNextBlock([anotherTransaction,transaction]) | |
blockchain.addBlock(block1) | |
console.log(blockchain) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment