Skip to content

Instantly share code, notes, and snippets.

@riccjohn
Last active September 15, 2019 10:11
Show Gist options
  • Select an option

  • Save riccjohn/a5115315aedfc9954efc116cd4e8d274 to your computer and use it in GitHub Desktop.

Select an option

Save riccjohn/a5115315aedfc9954efc116cd4e8d274 to your computer and use it in GitHub Desktop.
const sha256 = require('sha256');
class Block {
constructor(index, timestamp, data, prevHash) {
this.index = index;
this.timestamp = timestamp;
this.data = data;
this.prevHash = prevHash;
this.thisHash = sha256(
this.index + this.timestamp + this.data + this.prevHash
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment