Skip to content

Instantly share code, notes, and snippets.

@thecreazy
Created January 16, 2018 13:40
Show Gist options
  • Save thecreazy/35910621cb7f1e74775a693cb0169479 to your computer and use it in GitHub Desktop.
Save thecreazy/35910621cb7f1e74775a693cb0169479 to your computer and use it in GitHub Desktop.
Gist for my medium article on blockchain
class Blockchain {
constructor () {
// Create chain and transaction
this.chain = []
this.current_transactions = []
// Binding of this
this.newBlock = this.newBlock.bind(this)
this.newTransaction = this.newTransaction.bind(this)
this.lastBlock = this.lastBlock.bind(this)
this.proofOfWork = this.proofOfWork.bind(this)
}
newBlock () { /* Create the new block */ }
newTransaction () { /* Store a new transaction */ }
hash (block) { /* hash the block */ }
lastBlock () { /* return the last block */}
}
module.exports = Blockchain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment