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,