Menambahkan bukti pekerjaan ke blockchain
Blockchain.prototype.proofOfWork = function(prevBlockHash, currentBlockData) {
let nonce = 0;
let hash = this.hashBlock(prevBlockHash, currentBlockData, nonce);
while (hash.substring(0,4) !== '0000') {
nonce++;
hash = this.hashBlock(prevBlockHash, currentBlockData, nonce);
}
return nonce;
}
Outrageous Ostrich