Mining meaning in simple words...
Miners guess a random target number that solves an equation generated by the Bitcoin Protocol. Miners guess a random target number that solves an equation generated by the Bitcoin Protocol. Of course, computers make this guess, not people.
A "guess number" is formed from a final hash of current block hash, nonce, data and previous block hash. A brute-force search is repeated until miners discover a hash that is less than the target number.
Example
I've written a tiny Swift app to calculate a number of tries to discover a hash starting with 2, 4 and 8 zeros. As you can see below, we need 426 million tries to find a first hash number with eight leading zeros – "00000000".
Executing the following code just gives you an idea of how many tries it takes to find the hash with the required value (consider, this script does not reflect the criteria for bitcoin mining).
import SwiftUI import CryptoKit struct ContentView: View { @State var counter: UInt32 = 0 @State var digest: SHA256.Digest? = nil var body: some View { HStack { VStack { Button("Start") { startMining() } } } } fileprivate func startMining() { repeat { counter += 1 let data = Data(String(counter).utf8) digest = SHA256.hash(data: data) print((digest?.description)!) print("\(counter) tries.") } while !(digest!.description.starts(with: "SHA256 digest: 0000")) } } Results
Let's launch this app and see what we got in the Xcode console if we search for 00:
SHA256 digest: 00328ce57bbc14b33bd6695bc8eb32cdf2fb5f3a7d89ec14a42825e15d39df60 286 tries. Then search for 0000:
SHA256 digest: 0000a456e7b5a5eb059e721fb431436883143101275c4077f83fe70298f5623d 88484 tries. And at last, search for 00000000:
SHA256 digest: 00000000690ed426ccf17803ebe2bd0884bcd58a1bb5e7477ead3645f356e7a9 426479724 tries. Now you know how much efforts a mining task requires and to what extent it loads the CPU.
P.S.
Today (August 25th, 2021) miners look for a hash number with nineteen leading zeros – "0000000000000000000", like in Block 697561.
