A Python program to simulate how much it would take for your CPU to mine a Bitcoin block in 2009.
In 2009, only 8 zeroes were needed to mine a block and get 50BTC ($1.7m, July 2021)
However, this doesn't mean it's easy.
This program is made to mimic how much it would take to mine a single block in 2009.
To randomly generate SHA256 hashes, I decided to use this method:
- Set a counter that starts from 0
- I add this number to a random int going from 0 to 1 million
- I take this sum and cipher it into an hex value
- I finally encode this hex value into SHA256 using hashlib
- If the hash doesn't have enough 0's, the counter will add 1 to itself and start all over again.