Do we need to update date timestamp on every hash calculation update and also could someone explain how it's implemented in most popular cryptocurrencies?
function isValidHashDifficulty() { //validate calculated hash to fit requirements } function calculateHash(nextIndex, previousHash, timestamp, data, nonce) { //calculate hash } let nonce = 0; let nextIndex, previousHash, data; let timestamp = new Date().getTime(); // do we use this timestamp? while (!isValidHashDifficulty(nextHash)) { nonce = nonce + 1; timestamp = new Date().getTime(); //or do we get new date on every calculation attempt? nextHash = calculateHash(nextIndex, previousHash, timestamp, data, nonce); }