This simple JavaScript program simulates a mining process using the SHA256 hash function. The mining process involves finding a nonce value that, when combined with the block information, produces a hash with a specific difficulty level.
- Adjust the mining difficulty by modifying the number of leading zeros in the hash.
- Track the number of attempts made to find a valid hash.
- Displays the details of each attempt, including the new hash.
- Install Node.js if not already installed.
- Install dependencies:
npm install
. - Run the mining simulation:
node index.js
.
index.js
: The main script containing the mining simulation logic.package.json
: Configuration file for Node.js project dependencies.