Mining is the process by which cryptocurrency transactions get verified.
The process got its name from the fact that once a block is verified, whoever solved it will earns some coins as a reward, a little like gold mining – there’s a reward for the work.
When Bitcoin was launched, the idea was that every participating network node could be a mining node as well.
Nodes would send, receive, verify transactions and attempt to solve new blocks through mining.
As GPU and ASIC miners became profitable, the new dedicated machines made computer CPU mining unprofitable. The mining feature was disabled by default in later versions of the Bitcoin Core software.
Admittedly, Satoshi’s original intentions were much more decentralized than today’s mining infrastructure.
When you wish to send Bitcoin to someone, you compose a special structure called a transaction. A transaction contains the source of the Bitcoins, the target of the transaction or where you’re sending coins to, then all this is digitally signed by your private key. The result is an independent structure that is broadcast onto the network. This broadcast happens in a P2P network – your node looks for other people running Bitcoin around you and sends a copy of the data out to each peer.
After receiving transactions, peers store them on temporary space. This can be either RAM memory or disk and depends on the implementation. This collective memory of pending transactions can be thought of as a large “memory pool”. That’s where the Bitcoin mempool gets its name.
Miners will then receive the transactions the same way nodes received it via the P2P network. Then they will decide whether to include the transaction or not on a block based on the fee in the transaction.
Remember that, when sending BTC transactions, you choose how much you’d like to pay miners to mine your Tx. Higher fees make the transaction get chosen over those with lower fees. Miners will continue choose transactions from the mempool until the total data adds up to maximum block size.
When this limit is reached, miners will call this a block. This is when the mining work begins.
Mining pools generate a cryptographic digest for the newly assembled block, then they send this hash as a piece of work for miners. Miners take the digest and test trillions of numbers (nonce’s) against that hash until they get a desired hash. When the correct hash is found, we say the block has been mined.
Once mined, the block is forever committed onto the blockchain and the transaction is said to be confirmed. Actually, most merchants will wait 2 to 3 blocks to consider a transaction irreversible. There is a tiny probability that a TX may get reversed if it’s stored on the latest block on the accepted blockchain.
Each new block that gets added after it is called a new confirmation. This is because the longer the blockchain, the less probable it is for anyone to have been able to defraud it. It is usually good practice to wait for a few confirmations before considering a transaction permanent. For Bitcoin, there’s an average 10 minute wait per block, so this usually means you should wait between 20 minutes to an hour to make sure the transaction is definitive.
As mentioned before, back in the day you’d be able to mine Bitcoin using a specific application. Early on, Bitcoin Core itself did the mining using your CPU’s spare time.
Nowadays there is no longer a mining app. At least not in the sense of traditional apps we can install on a PC or smartphone.
The only mining apps available today are found embedded in the mining devices. For example, Bitmain mining devices run their own OS, probably derived from Linux or other open source platforms, with a specific mining kernel that controls the ASIC chips that perform the Proof of Work.
For instance, there is no such thing as a Bitcoin mining apk or anything of the sort. These are often advertised in malware ads. Be wary of any mobile phone application which promises Bitcoin mining capabilities – there is no such thing! No mobile phone is able to mine Bitcoin, Litecoin, Dogecoin or any other popular PoW coin.
When investing in ASIC machines, you need to be able to estimate how much Bitcoin each device will be able to produce hourly/daily/etc
Also, you need to consider the electrical and operational costs of mining operations.
To help miners estimate the expected returns, there are PoW mining calculators available, such as Coinwarz, NiceHash, Minerstat, Cryptocompare and so on.
It’s easy estimating mining returns using any of these tools. You just enter the electricity cost in dollars per kw/h and it’ll give you a ROI estimate. Of course, you should do your own calculations for regional taxes, operational costs and other factors not considered by mining calculators.
Some companies will lease some of their mining power against an hourly fee. The mining power is measured in hashes per second, or hashrate for short. You’ll usually be charged in hashrate-hours. You get X hashrate for Y hours against a fee.
While some folks are skeptical of online Bitcoin mining, because if the mining were profitable, why wouldn’t they mine for themselves instead of leasing out their hashrate?
As it turns out, selling some hashrate does make sense as a business model. Miners need fiat cash flow to pay for utility costs and employees monthly. Since Bitcoin price varies a lot, miners often find themselves with low liquidity, having to sell a lot of the mined BTC in order to cover operational costs. Thus, selling some of the hashrate for cash helps solve this issue.
We hope to have highlighted the importance of mining and the basics of how it works. The way Bitcoin reaches consensus in a completely decentralized way, without anyone in control, is simply revolutionary. To understand mining means to understand how this fascinating system works.
Bitcoin Mining at Investopedia
CoinTelegraph Beginners Guide to Mining