pull down to refresh
0 sats \ 0 replies \ @BTCMiner OP 6 Jan 2023 \ on: Tool that demonstrates how the SHA256 hash function and bitcoin mining works bitcoin
Here's what it does:
Every time you change the Input and/or the Nonce, a new Hash is the result.
To find a solution, a miner will take the input and then keep increasing the Nonce until a hash is the result which meets a "difficulty" requirement. For simplicity, let's assume a character position with a "0" is the difficulty in this example.
So you can change the Nonce likely thousands of times and after a dozen or two attempts you will likely end up with a hash that begins with "0".
Now try two find a hash that begins with two zeros. That will take longer. Maybe a couple hundred attempts, maybe a lot more. But eventually you'll hit it.
Now try to get a hash that has four leading zeros. [Well, ... don't try ... you won't get there anytime soon.]
But if you press the Mine button, it will increment the nonce over and over until it finds four leading zeros and will tell you what value was needed for the nonce to find a hash that meets the difficulty requirement, for that specific Input.
With Bitcoin mining, the difficulty will adjust every 2,016 blocks. So if miners are solving blocks more frequently than every 10 minutes, difficulty will increase. With this tool, that would be the equivalent of now needing five leading zeros, instead of four leading zeros. If the difficulty drops, that instead would be the equivalent of needing just three leading zeros. With a lower difficulty, it takes less time (less "work") to find a valid hash and thus blocks are mined faster.
So that's essentially what bitcoin mining rigs do. They simply perform the work to find a hash that meets the requirement for a specific input. That input will change based on what transactions are being included and also what the hash was for the prior block.