₿itcoin concept
Created
November 14, 2023 20:25
-
-
Save lucien-loua/37f02d5d2f5b46c8f5018bdf0a54a166 to your computer and use it in GitHub Desktop.
This script finds a sha256 hash starting with 5 zeroes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const crypto = require('crypto') | |
| let nonce = 0; | |
| while (true) { | |
| const data = nonce.toString(); | |
| const hash = crypto.createHash('sha256'); | |
| hash.update(data); | |
| const hashResult = hash.digest('hex'); | |
| if (hashResult.startsWith('00000')) { | |
| console.log(hashResult); | |
| break; | |
| } | |
| nonce++; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment