You have probably heard of the term ‘”mining difficulty”, and perhaps you’ve encountered the terms pool difficulty and network difficulty. Perhaps you are a bit confused as to what these terms mean and why the pool difficulty always seems to be so much lower than the network difficulty.
You may even wonder why on earth anyone would want to increase their pool difficulty voluntarily? Well, if you want to learn about these topics, you’ve come to the right article.
I’m going to simplify several aspects of this explanation to make it as easy to understand as possible without compromising the core idea.
What is Mining Difficulty?
Bitcoin and its related cryptocurrencies have an amazing ability for self-balance. You’ll see this throughout the system, but one place where you see it often is in the mining difficulty. The mining difficulty determines how difficult it is to solve a block, but that may not tell you much so I’ll try to elaborate on what that means.
I’ll have to be a bit technical, though, but I’ll try to keep it simple.
Mining is the process of trying to find a hash value for a block of transactions. You need to understand what this means to understand mining difficulty.
Building and Solving Blocks
When a miner starts running, it will wait for new transactions in the Bitcoin network. It will then add those transactions into a block of data. Every miner does this, although for pools, the pool will accept the transactions and build the block for you.
Example: Alice sends Bobs 1฿, which she does through her wallet by signing a transaction using her private key. She then broadcasts that transaction to the network, and as soon as the transaction has propagated through the miners in the network, Bob will see that there is an incoming transaction of 1฿ coming to his wallet.
However, the transaction will still be unconfirmed, it has simply been added to the blocks that miners will try to solve.
Miners will continuously try to solve this block of data. The process of solving is a cryptographical task which involves generating a hash for the block. For Bitcoin and several other cryptocoins, the hash algorithm used is SHA-256, and for Litecoin and Novacoin, the algorithm is Scrypt.
A hash is essentially a checksum that is unique for the underlying data (the data is called the message) so that if the message changes, so does the checksum. For example, you can have a hash value for a file or document (the message), and because the hash will be unique for the message, you can verify that the message has not been modified since the hash was generated. If someone tampered with the message, the checksum will change too.
The benefit of a hash is that it is impossible to predict what it will be in advance without actually performing the computations to generate the hash. However, it is very easy to verify that a hash belongs to a message, simply by repeating the hashing computation and seeing that the results are the same.
Solving a block means that the miners try to find a hash value for the current block of transactions that is below a certain limit. This limit is determined by the current difficulty of the Bitcoin network. The higher the difficulty, the lower the hash value must be.
Because it is impossible to predict the result of a hashing computation without doing the computation, the only way to find a hash that has a value below a certain limit is thus to perform a lot of hashing computations.
“So,” you ask, “hashing is fine, but if the block or message does not change unless new transactions come in, why would a miner need to generate thousands or millions or billions of hashes? Wouldn’t the hash always remain the same?”
Great question! Of course, if the block remained the same, the hash value would also be the same. That’s why miners add a nonce to the data. A nonce is just a random piece of data, in Bitcoin’s case it is an incremental number, that the miner adds to the block to create a unique message. It does this for every computation.
Example: For simplicity’s sake, let’s say the block or message was AAAA. The miner will add a nonce value to the block, say 1, and generate a hash from AAAA1. If the hash value for that message is not below a certain limit, it will increase the nonce value to 2, and generate a new hash from that message (AAAA2). This goes on and on until you finds a nonce that combined with the current block message yields a value under a certain limit.
Once you find a hash value below the certain limit, you have solved the block and can submit the solution to the network and claim your reward. You actually create this reward money yourself, but the other nodes in the network will only allow you to spend it after it has been verified in the network. Verification means that your creation transaction must be part of a solved block.
Once you have solved the block, though, everyone will start solving a new block by collecting new transactions, adding nonces, and solving hashes. Also, at this point, Alice’s transaction, being part of the block you just solved, is considered to be confirmed once. Bob can choose to accept only one verification, or may wait around for other blocks to be solved to further secure that there is no possible way that there is anything wrong with the transaction.
The ‘certain limit’ comes back to haunt us, but that too is relatively simple to explain.
Why Difficulty Changes
Because the output of a hashing computation is more or less random, the chance of the hash value being below a certain limit becomes increasingly less likely the lower that limit is. The Bitcoin network adjusts the difficulty automatically to ensure that a block is solved around every ten minutes.
Let me illustrate with an example.
Let’s say, for the sake of simplicity, that the hash value range is 1 to 1000, and the difficulty starts at 1, meaning the difficulty is 1000/1 or just 1000. Also for the sake of simplicity, let’s say you manage to calculate 1 hash per minute.
You generate a hash, and the chance of your hash value being below 1000 is 100%. Thus you ‘solve’ the block very easily because every hash value will match.
However, let’s say the difficulty increases to 4. Now you have to find a hash value that is below 1000/4, or 250. Suddenly, the chance of finding a hash is just 25%. Still, you manage on average to find a hash after 4 minutes.
Let’s further say that we increase the difficulty to 100, so you have to find a value that is below 10. In this case, on average, you will only be able to solve a hash every 100 minutes.
Finally, you decide to bring a friend over to help calculate. Your friend, strangely enough, is exactly as quick as you are to calculate hashes, so now you have a hash rate of 2 hashes per minute. With this, you manage to solve the 100 difficulty hash at just 50 minutes.
Bitcoin does not like any of these situations because it wants a new block to be solved every 10 minutes. Thus, the network will adjust the difficulty so that with the number of people trying to solve a block, combined they are able to solve one block every ten minutes.
In our example, because you and your friend solves 2 hashes per minute, that means the difficulty should be 20. If your friend falls asleep of prefers to play Xbox instead, your rate of solving drops to 1 per minute again, and the network difficulty adjusts down to 10 again. If two of your friends drop by, the difficulty increases again to keep the whole system in a beautiful balance.
Note: The numbers aren’t this simple in reality, but this serves as an easy to understand example.
Oh, and other coins have different rates of distribution, but the principle works the same. Litecoin, for example, wants a new block solved every 2.5 minutes.
I you are mining in a pool, you may have seen another kind of difficulty, which is the pool difficulty. The pool difficulty is usually much lower than the network difficulty.
To understand this, you need to understand how a pool works.
When a miner starts working for a pool, the pool server will send the block to each miner and ask it to start solving it. However, instead of having the miner solve a block with the network difficulty, the pool sets another, much lower difficulty. The miner then has a much easier task of finding a hash value that is below that share, and can thus submit their nonce values much quicker.
Of course, it doesn’t help anyone to solve a block with much lower difficulty than the network because the network won’t accept it as a solution to the block. Thus, when the solutions from the miners come into the pool, the pool checks to see whether the solution is above the network difficulty, and if not, it simply discards the value. If the miner solution is correct and above the network hash value required, the pool can submit the solution to the network, receive the reward, and distribute that reward to the pool miners as appropriate.
Let me again show this with an example.
You and four friends, Alice, Bob, Charlie, and Donna, decide to mine for Bitcoin. However, rather than each of you trying to mine alone, and after all, Charlie is really bad at math, so he probably wouldn’t be able to make much at all, you decide to pool your efforts.
You nominate Charlie as the pool ‘master’, and the network difficulty is 200, meaning you need to find a number that is below 5 (in the range 1-1000 as in the previous example).
You, Alice, Bob, and Donna starts calculating hashes at a rate of 1 hash per minute. However, you submit your solutions to Charlie even if the hash value is below 100 (meaning a difficulty of 10).
Why would you do that? Well, every solution that has a number over 100 is guaranteed to be a wrong solution, so you can just throw them away. However, you have proven that you have done some work, so Charlie records your submission for later sharing of the reward.
Charlie not being as good with math, can now simply check the solutions you, Alice, Bob, and Donna submit, and see whether the value you submit is below 5 too. If not, he can simply throw away the result, and wait for the next result to come in.
At some point, Alice comes up with a solution of 3. Now Charlie sees that the number is below the network difficulty and thus submits the solution to the network. Of course, depending on how you agree to share the rewards, you all get a piece of the reward, even if Alice was the one to find the correct solution.
Here’s a trick question for you: Why doesn’t Alice just keep the solution in her pocket and take the whole reward herself? After all, she finds the right number and can easily submit it herself rather than sending it to Charlie for sharing with the others.
Bitcoin has a trick up its sleeve to prevent that from happening. You see, included in the block message that the pool generates is the transaction that sends the reward to Charlie. Thus, if Alive submits the solution herself, that’s fine, because Charlie still gets the money. If Alice changes the address to her own then her solution is no longer valid, and won’t be accepted in the network.
I hope this makes it easier to understand how mining and mining difficulty works, but feel free to ask questions or leave feedback in the comments below.
Found this article valuable? Want to show your appreciation? Here are some options:
a) Visit my sponsors to let them know you appreciate them helping me run this site.
b) Donate Bitcoins! I love Bitcoins, and you can donate if you'd like by clicking the button below.
c) Spread the word! To the left, you should find links to sharing this article on your favorite social media sites. I'm an attention junkie, so sharing is caring in my book!