Cryptocurrency mining is key to how many blockchains function but it’s a process that’s often misunderstood. In this guide, I’m going to separate the fact from the fiction so you can answer the question, What is cryptocurrency mining? for yourself.
It’s a tricky subject to get your head around, so we’ll start right at the beginning…
So, What is Cryptocurrency Mining?
What is referred to as cryptocurrency mining is most commonly the act of verifying transactions in a Proof-of-Work (PoW) protocol. This is currently used in many popular public blockchains, including the Bitcoin and Ethereum blockchains.
(Although, Ethereum is moving to Proof of Stake in the near future)
In a blockchain, a network of nodes (computers which collaboratively run the blockchain) are tasked with verifying the transactions submitted to the blockchain.
For instance, when Bitcoin is sent from one user to another, the Bitcoin nodes must verify that the transaction is valid before it can be recorded on the blockchain with the updated balances of each user.
To do this, they must solve complex math problems. Each node races to be the first one to find the correct solution for the problem. The node that finds it first is rewarded with the blockchain’s native currency (e.g. Bitcoin is awarded to Bitcoin nodes).
That’s how it’s similar to real-world mining — rather than gold, the Bitcoin nodes mine blocks to find new Bitcoin. In Ethereum, the Ethereum nodes mine blocks to find new Ethereum.
This is why we often hear nodes referred to as miners.
Note: The reason the miners need to be rewarded is because mining uses a lot of electricity, which is one of the primary reasons Proof-of-Work blockchains are regarded as unscalable — they cannot sustain the growth required by the demand for the network. That’s why Ethereum is switching over to Proof of Stake!
So, now you know that cryptocurrency mining is a key part of how transactions are processed and added to blockchains. You also know that it involves “complex math problems.”
But what on earth does that mean? In order to find out, we’ll need to take a closer look at cryptography and how it relates to cryptocurrency mining…
A Brief Introduction to Cryptography
Cryptography is the art (or science, if you prefer!) of writing and solving codes. It’s used throughout computing and is absolutely essentially to the operation of blockchains.
Cryptocurrency literally means hidden money but this is something of a misnomer as the money isn’t actually hidden at all. On a blockchain, all transfers of value are recorded publicly and are visible to every user of the network.
The crypto in cryptocurrency actually refers to its users and the identities of cryptocurrency users are obscured using cryptography. When you use Bitcoin or Ethereum, your name, date of birth and nationality are completely unimportant. All that matters are your private keys and your public addresses.
As long as you hold both of these pieces of information, then you can move and store your cryptocurrency as you see fit, no other information is necessary.
Public addresses are a little bit like email addresses, information can be sent to them and from them. If you wish to receive cryptocurrency, then you must first provide the sender with a public address to which it can be sent.
Private keys are like the passwords that you use to access your public addresses. Say you found out someone’s email address, that doesn’t mean that you can start using it to send emails, does it? You’d need their password too.
Cryptocurrencies work in the same way. In order send coins, you need an address to send them from and the private key that corresponds with said address. Think of it like signing for a delivery. A transaction can’t go ahead without a valid signature (ie. the correct private key).
The role cryptography plays in all this is to secure the link between your private keys and your public addresses. This means that no one will be able to use you public address to work out your private keys.
Cryptography is used to encrypt or hash the connection between the two. This is how your email account works, as well as, your login details for online shopping and banking services.
However, cryptocurrencies take cryptography one step further and use the process to secure a long and immutable chain (a blockchain, in fact!) of transaction information, ensuring that everyone using the network trusts that the record is valid.
All this will make more sense when we look at how individual transactions are processed but for now let’s look at how blockchain mining works in general…
How Mining Works
In our example from earlier, we said that the nodes mine blocks to find their reward. The reason they mine ‘blocks’ rather than transactions themselves is because, in blockchains, the transactions are grouped into blocks: rather than mining each transaction individually, the nodes mine a group of transactions at once.
Different blockchains have different block sizes, so the number of transactions that go into one block differs from blockchain to blockchain.
Let’s imagine the block size in TokenChain (our imaginary blockchain) facilitates 10 transactions. This is how mining on TokenChain might look if written in plain English:
- 10 transactions are submitted by users of TokenChain
- The miners begin solving the math problem for the block
- Once one of the miners has solved the problem, it sends its solution to the rest of the nodes so that they can check its validity
- If more than half of the nodes agree that the solution is correct, the block is confirmed and recorded on the blockchain
- The miner that solved the problem is rewarded with new TokenChain coins
This is the general framework that cryptocurrency mining follows for coins which are based on proof-of-work algorithms. Next, I want to show you how this process works in practice. The best way to do that is is by showing you how a single transaction is processed, from start to finish…
Before I explain exactly how a transaction works, a word of warning!
DISCLAIMER: Cryptocurrency mining is a very complicated business and involves mathematical principles and cryptography which most people (myself included!) struggle to fully understand. Fear not! Just as you don’t need to understand how a combustion engine works in order to drive a car, you don’t need to fully understand how encryption works in order to understand mining. So, pop your thinking cap on and we’ll begin!
The Life of a Transaction
Imagine yourself in your favourite coffee shop. You’re about to buy a low-cal-iced-frappuccino-with-a-twist-of-lemon, you know, the usual….
Today, you won’t be paying with cash or a credit card though, you’ll be paying with Bitcoin!
First, we’ll look at what will happen in the coffee shop, then we’ll see what’s occurring at the same time on the Bitcoin blockchain.
The Coffee Shop
- The cashier will tell you much your low-cal-iced-frappuccino-with-a-twist-of-lemon costs and you’ll enter the amount into your payment device which, the way things are going, will more than likely be a mobile phone.
- Next, you’ll need an address to send a payment to. You’ll obtain this from the cashier, probably in the form of a scanable QR-code.
- Once you’ve signed the transfer of funds using your private key, the transaction will be sent to the Bitcoin blockchain for verification and confirmation. Until it’s confirmed and added to the blockchain, your transaction is considered pending.
- After roughly ten minutes and if the transaction is valid (ie. you haven’t already spent the BTC your trying to buy coffee with elsewhere), the payment will be completed and you’ll be the proud owner of a low-cal-iced-frappuccino-with-a-twist-of-lemon!
A note on transaction times: In practice, you won’t have to wait the full ten minutes to find out if your transaction has been a success. The coffee shop will be able to tell within a matter of seconds whether or not (mathematically speaking) the transaction is likely to fail.
Now, I’ll show you what’s going on under the bonnet of your transaction…
The Bitcoin Blockchain
- As you soon as you hit send, your transaction is sent to the Bitcoin blockchain along with various pieces of important information which include: wallet addresses, a time and date stamp, a unique transaction code and an optional message or greeting.
- In come the miners and the cryptographic magic begins! All the information you send is encrypted into a line of alphanumeric code called a hash. In the case of Bitcoin, the hashing algorithm used is called SHA-256 but this varies from cryptocurrency to cryptocurrency.
- The hash of your transaction is now combined with the unhashed information of another transaction and this combined information is now hashed again. This process is repeated until the mining nodes have hashed enough transaction information to form a whole block (each Bitcoin block is currently 1MB of transaction data).
- Whilst all this hashing is going on, miners are also competing with each other to guess what the block’s final overall hashcode will be. Guessing is incredibly difficult and requires huge amounts of computational power and, therefore, electricity.
It’s thought that much of Bitcoin’s value is derived from how expensive it is to mine and is also the reason why the reward for guessing a block’s hashcode is so high (12.5 BTC).
- Once a lucky miner has guessed the block’s hashcode, it can be added to the blockchain.
However, your transaction (and all the others that it’s bundled up with) isn’t confirmed until at least 51% of the network agrees that the information held in the new block is valid. Once the network has reached a consensus, the new block is confirmed and you’ll become the proud owner of a low-cal-iced-frappuccino-with-a-twist-of-lemon. You know, the usual!
Using cryptography, miners are able to organize, verify and record millions of individual payments in such a way that is both public and private at the same time!
Transactions are visible to all but user information is carefully hidden and the whole system is practically unhackable with no need for a centralized authority.
Pretty neat, huh?
Now that you know how mining works on the Bitcoin blockchain, let’s have a look at how it works on some of the market’s other big name cryptocurrencies…
Cryptocurrency mining has long been a controversial subject and has even lead to cryptocurrency hard forks.
Note: Hard forks occur when nodes in a network fail to reach consensus on changes to a blockchain’s protocol. This can cause an irreversible divide in the network with two rival cryptocurrencies being formed.
Different cryptocurrencies have come up with various different ways to tackle this thorny subject and here are some of the most famous examples;
Ethereum (ETH) Mining
Whereas Bitcoin mining favours the brute strength of powerful computers, the creators of Ethereum wanted users with smaller, weaker computers to be able to participate in mining too.
Ethereum’s mining algorithm, Ethash, makes it deliberately difficult for large computers or groups of computers (known as mining pools) to gain the upper hand. Its block reward is also much smaller (3ETH) and its block time is much faster (a new block is confirmed every 10-20 secs) than Bitcoin’s.
Litecoin (LTC) Mining
Similarly to Ethereum, Litecoin is designed to favour less powerful miners whilst offering a block reward twice the size of Bitcoin’s (25 LTC) as well as having a block time four times faster (2.5 mins).
Litecoin’s Scrypt mining algorithm makes it tricky for the kinds of powerful mining hardware commonly used on the Bitcoin blockchain (eg. ASIC mining rigs) to operate effectively.
Bitcoin Cash (BCH) Mining
Formed as an offshoot of the original Bitcoin protocol, Roger Ver’s Bitcoin Cash has sought to improve upon Satoshi Nakamoto’s groundbreaking vision.
One of the ways it has tried to do this is by making its blocks eight times bigger (8MB) whilst using the same mining algorithm and reward scheme.
Ripple (XRP) Mining
The unique thing about Ripple mining is that it doesn’t really exist! The Ripple protocol doesn’t use a 51% consensus mechanism like the other coins on our list, it uses a system of “trusted nodes” to verify transactions.
Whilst contrary to what a lot of purists believe to be a central tenet of crypto ideology, Ripple isn’t the only blockchain which foregoes mining. Next generation blockchains like IOTA and COTI have decided to eliminate the need for miners as well.
In the next section we’ll look at why blockchains are increasingly moving away from proof-of-stake mining and what alternatives there might be…
Planet Earth’s Great Mining Problem
As touched on earlier, cryptocurrency mining isn’t necessarily all that it’s made out to be. It is extremely demanding on computer hardware and the amount of energy required is increasing at an exponential rate. In fact, in 2017, it was estimated that Bitcoin mining is using more electricity per year than the country of Ireland.
With the influx of competition that cryptocurrency mining is experiencing, Proof of Work is seeming less viable by the day. It simply isn’t sustainable in the long term.
Not only does it mean the miners are having to expensively upgrade their equipment to compete with others, but it is also producing a global environmental crisis. The unsustainability means blockchains using Proof of Work face huge scalability issues, with Bitcoin currently limited to 10tx/s and Ethereum currently limited to 15 tx/s.
It’s not difficult to understand why Ethereum are so keen to move from Proof of Work to Proof of Stake.
The Future of Mining — Proof of Stake
Ethereum’s impending upgrade will see them move from Proof of Work to Proof of Stake.
When using PoS, the nodes can be referred to as stakers instead of miners. You’ll no doubt hear both terms being thrown around, so use whichever you please. We just prefer to refer to the nodes in PoS protocols as stakers to ensure clarity in our explanations.
In PoS, only one validating node is required per block. The validating nodes are selected at random, but they must ‘stake’ some of the blockchain’s native cryptocurrency (hence stakers) to be allowed to verify blocks.
With only one node used for validations per block, there is only one node’s computational power being used. This is a huge contrast to PoW which uses all of the nodes’ power for each block. So, PoS saves tons of electricity and is much more sustainable and scalable!
For more on Proof of Stake, see our full What is Proof of Stake guide.
After reading this guide, you should have a much greater understanding of mining and be able to confidently answer the question What is Cryptocurrency Mining? the next time someone asks you. It may have seemed a rather daunting and complicated subject to begin with, but we hope it seems a lot simpler to you now.
That being said, there is so much to detail regarding mining, and there are so many questions to answer. So, if you have any further questions, please do not hesitate to ask us. We’ll always be happy to help!