In crypto, mining signifies the process of confirming new blocks of transactions via a process called proof-of-work. A complex cryptographic puzzle is solved by miners to create (mine) a new block of transactions. For this achievement the miner that managed to solve the puzzle is rewarded with some coins.
What is mining?
In the most general terms, mining is the process of processing transactions in a trusted and predictable manner.
A trustless system like Bitcoin faces a few challenges which proof-of-work elegantly solves. On Bitcoin, mining is the process where new groups of transactions (called blocks) are added to the chain.
Prevent double spending of digital assets
The most pressing problem for a dependable digital vehicle of value is that digital assets can easily be duplicated. Digital ledgers and blockchains all have this problem. In the Bitcoin whitepaper, the proposed solution to solve the “double spend problem” is proof-of-work. Performing proof-of-work is called mining.
On Bitcoin and virtually every other blockchain all transactions are publicly announced to every node on the network. Validator nodes or miners are interested and incentivized to only perform valid transactions and prevent double spending. This means that such transactions will not be accepted into a new block. A 51% attack is the only known way to circumvent this and would require significant resources to pull off.
Why would anyone want to do this?
Mining a block rewards the miner or miners who managed to solve a cryptographic puzzle with some coins. The reward is made of newly minted BTC, called the block reward and of transaction fees paid by transactors whose transactions were mined. Miners need to run dedicated hardware and software setups for mining which consumes energy.
When it comes to profit, miners need to balance the costs of running mining operations (hardware, software, maintenance and the cost of energy) with yields of new BTC coins to their accounts.
Why is mining becoming more expensive?
Mining serves to secure and harden the network. Bitcoin has an adaptive mechanism of mining difficulty which makes the cadence of mining new blocks (and new coins) very predictable. The more miners there are, the more likely it is that they will solve the cryptographic puzzles faster than intended. In this case the mining complexity is increased. Conversely, when many miners stop their operations, it becomes more likely that the block time will increase. In this scenario the difficulty will be lowered. For this reason, Bitcoin blocks are always mined in intervals of ~10 minutes.
What do miners actually do?
Initially, a block is composed of the previous block’s hash and the block data (transactions). The network sets a target difficulty where the next block’s hash must satisfy some criteria like how many zeroes it will start with.
The miners are tasked with finding a value that will produce a new valid hash. This value is called “nonce”. When the previous block hash, transaction data and the nonce return a valid hash when run through a hashing algorithm (in Bitcoin this is SHA-256), the miner posts their result. The nonce is very, very hard to guess but very simple to verify once found.
After this, the results are propagated across the network and every other node can validate the result. When they do, the block is added to the chain and the process starts over again. For a deeper understanding of the whole process see this article:
How do they do it?
Miners on Bitcoin must use dedicated Application-Specific Integrated Circuit (ASIC) hardware. It used to be possible to mine Bitcoin with standard graphic cards, and most other PoW systems can still be mined using them.
When miners receive a fresh block of transactions, they repeatedly try adding a nonce to the block to see the resulting hash. Once the hash satisfies the requirements a block can be considered mined. The block is added to the chain and the work needs to restart from scratch.
Check out the data structure of a block here.
This process is performed by machines which are not aware of all the ins and outs of mining. The people or organizations running mining operations however need to keep three main things in mind to stay profitable. The cost of hardware, the cost of energy and the value of BTC. For miners the main source of income is BTC. The current reward for a mined block is 6.25 BTC but keep in mind that there is fierce competition in the mining industry.
How can I start mining?
One way is to buy all the mining gear and just jump into it but the industry has evolved so much that that does not make much sense. An exception could be made for smaller networks where a home mining rig could compete.
There are two ways to make money from mining even if you don’t own a dedicated mining rig. A mining broker like NiceHash lets you provide hashing power from your personal device(s). This way you participate in a so-called pool of miners who share the block rewards evenly depending on your hashing contribution.
A miner pool is a group of smaller miner operations that perform mining as one individual node. Once a block is mined they share the proceeds.
You can also participate in mining via brokerage by buying hashing power with the hope to turn a profit. In this model, a miner will sell their hashing power to you for a fixed income while you receive the proceeds of their mining operation.
Why do we call it Proof of Work?
The process explained above is not a trivial endeavor. Miners have to actually perform all of these computations in order to achieve the desired result. The result of this process, the nonce, is proof that this work was completed.
In theory, it is possible for a miner to randomly stumble upon a correct nonce immediately. In practice, the combination of available hashing power from the miners (calculations per second) and adjustable difficulty (every 2016 block) makes it possible to mine a block in approximately 10 minutes.
Some cons of mining
There are two main reservations about mining.
First, there is the question of profitability. Miners need to buy and maintain their hardware setups. Next, they need to search for the cheapest source or provider of energy. And last, they need to take into account the forecasts for the price of BTC. It’s a delicate balance that can be broken if even just one of these goes wrong.
The second consideration is one of the major critics of mining and Bitcoin in general. The environmental impact of mining is a contentious topic where proponents claim it’s a necessary cost to pay while adversaries claim it’s irresponsible to the environment. The fact of the matter on this topic is that greener alternatives exist to solve the same problems. There is still heated debate about whether these alternatives are as robust.
In conclusion
Mining crypto solves the problem of double spend, predictable supply and security of the network. Cryptographic functions are used to address all of these problems and mining is just one of the possible solutions. Its advantages and disadvantages are well documented. The crypto industry offers many ways to participate and mining is just one of them.