The primary purpose of mining is to allow Bitcoin nodes to reach a secure, tamper-resistant consensus. Mining is also the mechanism used to introduce bitcoins into the system. Miners are paid transaction fees as well as a subsidy of newly created coins, called block rewards. This both serves the purpose of disseminating new coins in a decentralized manner as well as motivating people to provide security for the system through mining.
The blocks chain is secured by the miners. Miners secure the block by creating a hash that is created from the transactions in the block. This cryptographic hash is then added to the block. The next block of transactions will look to the previous block’s hash to verify it is legitimate. Then the miner will attempt to create a new block that contains current transactions and new hash before any other miner does.
Somewhere around 2017, the concept of web mining came to life. Simply put, web mining allows website owners to “hijack,” so to speak, their visitors’ CPUs and use them to mine Bitcoin. This means that a website owner can make use of thousands of “innocent” CPUs in order to gain profits. However, since mining Bitcoins isn’t really profitable with a CPU, most of the sites that utilize web mining mine Monero instead. Up until today, over 20,000 sites have been known to utilize web mining.
Some wallets, like Electrum, allow you choose in how many blocks your transaction should be confirmed. The faster you want your payment to go through, the more you will have to pay miners for confirming your activity. We find here another difference between Bitcoin wallets and Bank accounts. Given the right wallet, the control and oversight that we have over our transactions is far more extensive than that of the traditional banking system.
The difficulty is the measure of how difficult it is to find a new block compared to the easiest it can ever be. The rate is recalculated every 2,016 blocks to a value such that the previous 2,016 blocks would have been generated in exactly one fortnight (two weeks) had everyone been mining at this difficulty. This is expected yield, on average, one block every ten minutes.
Skipping over the technical details, finding a block most closely resembles a type of network lottery. For each attempt to try and find a new block, which is basically a random guess for a lucky number, a miner has to spend a tiny amount of energy. Most of the attempts fail and a miner will have wasted that energy. Only once about every ten minutes will a miner somewhere succeed and thus add a new block to the blockchain.
Nakamoto is estimated to have mined one million bitcoins before disappearing in 2010, when he handed the network alert key and control of the code repository over to Gavin Andresen. Andresen later became lead developer at the Bitcoin Foundation. Andresen then sought to decentralize control. This left opportunity for controversy to develop over the future development path of bitcoin.