Skip to content

Instantly share code, notes, and snippets.

@azamsharp
Created January 16, 2018 18:36
Show Gist options
  • Save azamsharp/2e36a038b5b7e0d6c17d7ef6ce739130 to your computer and use it in GitHub Desktop.
Save azamsharp/2e36a038b5b7e0d6c17d7ef6ce739130 to your computer and use it in GitHub Desktop.
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