Let’s take a deeper look at what may appear as a magical process: bitcoin mining.
An Overview Of What Bitcoin Miners Are Actually Doing
This article, to a degree, builds upon my previous one.
Before we peer under the hood, let’s look quickly at how miners have evolved.
At first, the mining difficulty level was extremely low (we’ll look at what that actually means shortly). In the early days of Bitcoin, bitcoin could be profitably mined on a simple personal computer’s central processing unit (CPU). In less than two years, people began mining on graphics cards (GPU) because they were, with the addition of some software, better suited due to higher clock speeds. That is to say, they were able to perform more calculations per second via parallel processing. Like CPUs, those were only profitable for a few years. In 2012, the first ASIC miner (Application Specific Integrated Circuit) came to market.
Miner performance is measured in hashes per second, or H/s. This is due to what they’re literally doing – brute forcing millions of hash function inputs in the search for the proper output. At the time of writing, the fastest miners on the market are rated in excess of 100 TH/s, or 100 million million hash attempts (tera hashes) per second.
ASICs are so fast because they are purpose-built. They are created to solve a single cryptographic hash function, which, in Bitcoin’s case, is SHA256. Theoretically, a bitcoin miner can mine any other cryptocurrency that also uses SHA256, but it would probably not be profitable due to a miner’s high power consumption. This large power requirement is what incentivizes miner operators to seek out the world’s cheapest power, which is frequently renewables or otherwise stranded energy.
A Bitcoin block consists of two overall parts: a header, and a transaction list. Within the header is some software information, the combined transaction information, the nonce, the hash from the previous block, and the target. The entire contents of the block are hashed. The nonce, a random number between zero and 2³², is added to the end of that hash. Both of those combined are hashed yet again.
Let’s look at the meaning of mining difficulty. This is the fundamental reason why CPUs and GPUs are no longer profitable.
The difficulty is determined by the target, in the form of leading zeroes. Due to probability theory, the more leading zeroes there are in the target, the more “rare” that hash is. To draw a more relatable parallel to base 10 (the number system we use in everyday life, a nine digit number with no repeated digit (102345678, for example) is much more rare than a number of the same length with a repeated digit.
Subsequently, difficulty increases as more leading zeros are added to the target. This change in difficulty is exponential, but we’re already talking about massive groups of potential answers. The target is calculated individually by nodes based upon the previous difficulty period. But, as they are all using the same blockchain, they all calculate the same target. Or, more specifically, they all calculate targets of the same difficulty level.
If you are wondering why it takes 10 minutes to try 4.3 billion nonce possibility hashes, given that a good miner can do 100 million million hashes per second, that would be a very astute observation. If none of the 4 billion nonce possibilities result in the target hash, some other information must be adjusted in order to adjust the hash. Additional nonce can be added, transactions can be added or dropped, or the mining start time can be adjusted.
Mining operators, if they implement multiple miners, frequently use specific software to delegate operations to individual miners in order to be more competitive.
All in all, Satoshi did an amazing job of accounting for the increase of computing power over time. He seems to have covered all the bases.
This is a guest post by Nameless. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc. or Bitcoin Magazine.