Jun 18, 2023
If you are active on Twitter, you often see tweets like the Bitcoin network is at its all-time high Hashrate. A tweet like this:
These numbers are stupendously large. At the time of writing, the hashrate is 391.96 EH/s or 391,958,260,757,078,500,000 H/s.
These numbers will only make sense if you know what hashrate is and what it means in the context of the Bitcoin network. In this article, I'll explain it using examples so that by the end of this article, you'll be able to make sense of it.
If I ask you what 5 * 5 is, and you take 1 sec to answer me, you can solve one math problem per second. Does that make sense?
What if I gave you the following mathematical problems, and how long did it take you to answer me?
Suppose someone asks me how many mathematics problems you solved in 1 second. Using the Unitary method, we'll come up with 5 / 10 = 0.5 maths/sec.
Please keep this analogy in mind. This will help us understand the hashrate. Now let's explain what a hashrate is:
Hashrate is a measure of the computing power of a network that uses the Proof-of-Work (PoW) consensus mechanism, such as Bitcoin. It indicates how many times per second the miners can attempt to solve a mathematical puzzle that validates transactions and creates new blocks.
Now using our analogy, consider yourself a miner and the puzzle as the mathematical problem I gave you. We do not measure it as maths/sec because that'll be hilarious.
Hashrate is usually measured in hashes per second (H/s) or multiples of it, such as kilohashes per second (KH/s), megahashes per second (MH/s), gigahashes per second (GH/s), terahashes per second (TH/s), petahashes per second (PH/s), and exahashes per second (EH/s). We'll soon understand why one is using the term hash.
Hell yeah. To the Moon.
Hashrates aren't constant; they fluctuate depending on various factors, such as the number and performance of miners, the puzzle's difficulty, the price and profitability of the cryptocurrency, and external events such as regulations, hacks, or forks.
When the hashrate increases, this means more miners are joining the network or upgrading their equipment. This makes the network more secure and faster but also increases the puzzle's difficulty, which requires more energy and resources from the miners. When the hashrate decreases, it means that some miners are leaving the network or reducing their activity. This makes the network less secure and slower but also decreases the puzzle's difficulty, making it easier and cheaper for the remaining miners to mine.
In our example, you were solving simple arithmetic. Do miners solve that only? No, miners solve way complex problems or puzzles.
Miners be Mooooo
I'll simplify this puzzle using our simple arithmetic example. If I say, can you find the value x that satisfies 2 * x = 100 without using any division operation? All you are required to do is hit and trial.
Well, you can try every number and see if it holds equality. Such as, you'll begin a loop and first put x = 1, then 2, 3, 4, 5, 6.. and so on, until you hit x = 50. At that point, the equation will hold the equality, and the solution to the above problem will be 50.
If you took one second for each step, i.e., 2 * 1 = 2 (1s), 2 * 2 = 4 (1s), 2 * 3 = 6 (1s), and so on.
Of course, 50s, because each operation took 1s.
Our miners solve something similar.
A mathematical puzzle miners must solve is a one-way function that takes an input and produces an output that meets specific criteria.For example, in Bitcoin, the input is the block header, which contains information such as the previous block hash, the transactions in the block, and a random number called a nonce. The output is the block header's hash, which is a fixed-length string of alphanumeric characters.
To compute the hash, the miner has to use a hash function, which is a mathematical algorithm that maps any input to an output of a fixed size. For example, Bitcoin uses the SHA-256 hash function, which produces a 256-bit output.
A hash function has the property that it is easy to compute the output given the input but hard to find the input given the output.
The puzzle miners have to solve is finding a nonce (a random number) that makes the block header's hash start with a certain number of zeros. The number of zeros required depends on the network's difficulty, which adjusts every 2016 block to keep the average time between blocks at 10 minutes. The more zeros are needed, the harder it is to find a valid nonce.
To solve the puzzle, miners must try different nonces until they find one that produces a valid hash. This process is essentially guessing and checking and requires a lot of computational power. The first miner who discovers a valid nonce gets to add the block to the blockchain and claim the block reward and transaction fees.
Let's assume the block data is as follows. It contains information about transactions made by people.
You can verify it yourself by copying the above data and pasting it to an online SHA256 function such as Online SHA-246
The only thing you can change in the block data is nonce; others can't change. So you'll put nonce = 2 (just like we changed the value of x).
We check the first two digits are still not 0s. We change it to 3, 4, 5, and so on.
I've written a simple Java program to help you find the nonce. All it needs is the block data and how many zeros you expect it to have in the output. You can copy the file content from here: SHA256 Example
After knowing all these things, one shall ask the question:
A big Yes. If a system can only try one nonce per second, its hashrate is one hash per second (H/s). However, most modern systems can try much more than one nonce per second, and the current hashrate of the Bitcoin network is over 300 exahashes per second (EH/s), which is 100 quintillion hashes per second.
Subscribe to the newsletter to learn more about the decentralized web, AI and technology.