Proof-of-Work Hash Demo

Interactively mine a block hash with adjustable difficulty in the browser

Ad placeholder (leaderboard)

The Proof-of-Work Hash Demo lets you mine a block hash in your browser. You set the block data and a difficulty target, and the page iterates nonces with SHA-256 until it finds a hash that meets the target — exactly how proof-of-work mining works, just at a learnable scale.

How it works

A miner repeatedly hashes the block data combined with a changing nonce and checks whether the result meets a difficulty target. Here the target is a number of leading hexadecimal zeros:

attempt = SHA256( blockData + nonce )
valid   = attempt starts with N zero hex digits

Because SHA-256 output is effectively random, you cannot predict which nonce will work — you simply try nonce = 0, 1, 2, … until one succeeds. The first nonce that produces a qualifying hash is the proof of work.

Why difficulty scales by 16

Each hexadecimal digit has 16 possible values, so the chance a given digit is zero is 1/16. Requiring N leading zeros means the chance any single hash qualifies is (1/16)^N. The expected number of attempts is therefore 16^N: about 16 for one zero, 256 for two, 4,096 for three, and so on. This is why real networks raise difficulty to keep block times steady as hash power grows.

Example and notes

Mining the data hello at difficulty 4 means searching for a SHA-256 hash that begins with 0000, which takes on average 16^4 = 65,536 attempts — a fraction of a second in the browser. Push difficulty to 6 or 7 and you will feel the exponential cost first-hand. This demo runs a single SHA-256 pass locally and is not connected to any blockchain.

Ad placeholder (rectangle)