Do we need to update the date timestamp on every hash calculation update? How it's implemented in the 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); }