How Does Bitcoin Mining Work?
In traditional fiat money systems, governments simply print more money when they need to. But in bitcoin, money isn’t printed at all – it is discovered. Computers around the world ‘mine’ for coins by competing with each other.
In traditional fiscal system, governments and banks can (and do) issue more money whenever they want to. However, no one can do that in Bitcoin, since the money issuance process revolves around mining – an extremely clever process of confirming Bitcoin transactions and recording them on a decentralized ledger at the same time.
But how does Bitcoin mining work? In this guide, we dive into the fundamentals of Bitcoin mining and the key processes behind it.
What is Bitcoin mining?
Bitcoin mining can be defined as a process of “discovering” bitcoins. Much like gold, bitcoins are artificially limited, and there can never be more than 21 million BTC. Also, like gold, you need to allocate resources and hard work to extract it. However, unlike mining gold, bitcoins are designed to be minted using the computational power of millions of competing computers from all over the world.
It may be tricky to wrap your head around it at first, but in fact, it is quite genius. Everyone is free to run a Bitcoin node and try their luck at mining, but no one is guaranteed to be profitable at it. However, these millions of computers ensure one thing – the functionality and security of the network.
If you want to dive deeper into the topic of “what is bitcoin mining,” see our namesake guide.
For now, all you need to know is that Bitcoin mining serves multiple purposes:
- Secures the Bitcoin network.
- Incentivizes the miners to allocate their resources to the Bitcoin network.
- Confirms Bitcoin transactions.
- Ensures the decentralization of Bitcoin (which makes it free global peer-to-peer (P2P) money).
- Makes bitcoins scarce and hard to get.
- Penalizes bad actors in the network by making it unprofitable to go against the system.
How does mining work?
People can send bitcoins (or any other digital assets) all the time, but it doesn’t mean much unless someone keeps tabs on all of them. This is especially true with digital assets which are super easy to copy. So to have a fully functioning digital cash you need to keep a record on who paid what and to whom, and that’s essentially what banks do for us.
But how do we know that person A has sent bitcoins to person B if there are no organizations to oversee it? How do we prevent double-spending where person A sends the same bitcoins to person C?
The answer is Bitcoin mining.
The Bitcoin network replaces banks and other intermediaries by processing all the network transactions, putting them into a list, and locking them up into immutable blocks. Eventually, it’s the miners who do all the work – allocate their hashing power to confirm those transactions and record them into a distributed public ledger.
Bitcoin mining requires a computer and special Bitcoin program (client). When you install Bitcoin client on your computer, you become a miner and can compete with rival miners in solving complex math puzzles. Every ten minutes, all computers try to solve a block with the latest transaction data in it using cryptographic hash functions.
What are bitcoin hashes?
Every solved block is added to the public ledger. Essentially, the distributed public ledger consists of a long list of blocks which make up the Bitcoin blockchain.
The Bitcoin distributed ledger aka blockchain is a public record of all the transactions that took place on the network. Since the file is public, it can be explored by anyone using any bitcoin block explorer. A new block is added to the ledger approximately every 10 minutes. Therefore, the blockchain size is continuously increasing. An updated copy on a new block is shared between miners, so everyone always knows what’s going on.
Now, what purpose does that serve?
In traditional systems, a ledger must be trusted, meaning that there has to be a trusted person or entity which oversees it and guarantees no one tampers with it. In the Bitcoin network, that role is played by the miners.
When a block of transactions is ready, the miners need to process it. They apply the SHA-256 Cryptographic Hash Algorithm to turn into a seemingly random sequence of numbers and letters known as a hash. The hash is stored together with the block at the end of the blockchain at that particular point in time, which serves as a proof of work and validation.
But how are these hashes so reliable?
Well, it’s easy to make a hash out of data included in the Bitcoin block. However, it is practically impossible to decrypt the data just by looking at the hash because it is entirely random and each hash is unique. If you change even one symbol in the original input, you will get an entirely different hash. Therefore, it is completely impossible to predict the output and the only way to match it is by blind guessing, which is what miners do.
Nevertheless, the miners don’t merely wrap the transactions into hashes but use some other pieces of data, too. One of these pieces is the hash of the last block.
Since each block’s hash contains the hash of the previous block, it works as like a digital a wax seal. It guarantees that the produced block, as well as every block before it, is legitimate. If the block is falsified, other miners can see it and reject it.
In other words, a fake transaction would change a block along with its original hash. Since each block’s hash is used to create the next block’s hash, that would affect all blocks on the chain. So if someone checked it, they would immediately notice the difference between correct and false blocks since they don’t match the ones already verified on the blockchain.
That’s how miners “seal off” a block. Now let’s have a look at the competition part.
Competing for coins
We’ve already established that the only way to seal off a block is to guess the output of the hash correctly, and the most efficient way to do so is random guessing done by computers.
All miners compete with each other who can guess it faster using the mining software. The miner who is first to do this mines the block (which takes billions of random computer-generated guesses from all over the world) and reaps the block reward which is currently set at 12.5 BTC per block and decreases by half every 210,000 blocks. At the current rate, it means the block reward will fall to 6.25 BTC per block sometime in 2021.
Essentially, it serves as an incentive to keep on mining to keep the system working. Since the block rewards are continually decreasing, it is expected BTC price will continue to appreciate. However, block rewards aren’t the only incentive mechanism for the miners, as they also share the collective Bitcoin transaction fees.
Check out this guide to learn more about the value of bitcoins.