Bitcoin is a decentralized peer-to-peer financial network where all transactions on the network are verified by a peer, instead of a centralized authority. Each transaction on the Bitcoin network is encrypted with SHA26 algorithm with a predefined output. Peers on the network need to put in a certain amount of hash power or computational power to solve the encryption and verify the transaction.
Mining difficulty is an indicator which highlights how difficult it would be for a miner to find the right hash function to get to the pre-defined output on the encrypted transaction.
Bitcoin network has a constant block generation time of 10 minutes, which means that every 10 minutes a new block containing verified transaction gets added to the network. In order to maintain the constant block time of 10 minutes, mining difficulty is adjusted dynamically to ensure that miners with more powerful mining rigs do not disrupt the network or mine the blocks before time.
Bitcoin mining was intended to be inexpensive, something which can be performed using a household CPU computer. However, as Bitcoin gained mainstream attention and its price started to soar, people realized mining could be one of the easier ways to earn Bitcoin. This is the reason the mining community grew exponentially and so did mining difficulty, as the trend of specialized mining rigs caught on. The first generation of mining rigs were simple CPU-based computers, followed by GPU-based mining rigs and the latest being ASIC ones.
The math behind mining difficulty
Mining difficulty of the Bitcoin network is dynamic and based on the average block time of previous 2016 blocks. If the average block time of previous 2016 blocks is less than 10 minutes, then the mining difficulty is increased and if the average block time is more than 10 minutes, the mining difficulty is decreased.
So, as the mining machines keep getting powerful, so would be the mining difficulty to maintain that constant block time. For every mined block, a miner is rewarded with a fixed block reward. This is currently at 12.5 BTC/block and set to be halved in the first quarter of 2020.
Mining difficulty and its correlation with Bitcoin price as well as miners
Although there is no direct correlation between dynamic mining difficulty and the prices of Bitcoin, it surely impacts its prices in other ways. Mining difficulty has a direct impact on miner’s behavior, where an increased mining difficulty would require more powerful mining machines along with added electricity cost. If the market price of Bitcoin is low and the mining difficulty is more, miners might not find it feasible or profitable to operate.
This was quite evident during the longest crypto-winter in 2018, during which the price fell to near $3,000 from its all-time high of 2017. Many miners decided to drop from the network as the cost of the mining operations was not leaving much profit for miners.
Similarly, if miners on the network start to leave the network due to increased mining difficulty leading to lesser profit, the network can lower the mining difficulty to lure them back, as they are not just responsible for verifying the transaction, but also the security. Higher the mining activity on a network, more secure the network is against the likes of a 51% attack.