MCPcopy
hub / github.com/Savjee/SavjeeCoin / calculateHash

Method calculateHash

src/blockchain.js:95–105  ·  view source on GitHub ↗

* Returns the SHA256 of this block (by processing all the data stored * inside this block) * * @returns {string}

()

Source from the content-addressed store, hash-verified

93 * @returns {string}
94 */
95 calculateHash() {
96 return crypto
97 .createHash('sha256')
98 .update(
99 this.previousHash +
100 this.timestamp +
101 JSON.stringify(this.transactions) +
102 this.nonce
103 )
104 .digest('hex');
105 }
106
107 /**
108 * Starts the mining process on the block. It changes the 'nonce' until the hash

Callers 6

constructorMethod · 0.95
mineBlockMethod · 0.95
isChainValidMethod · 0.45
blockchain.test.jsFile · 0.45
block.test.jsFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected