As many of you may already know, in traditional fiat money markets, the governments just print more money when it is needed. That is simply not the case when it comes to Bitcoin.
Bitcoin cannot be printed or manufactured, it is discovered. People from all around the world have computers specifically set up and designed to ‘mine’ for bitcoins by competing with one another.
How does mining actually work?
Through the bitcoin network people are constantly sending transactions, but unless there is someone in the background keeping records of all these transactions, no one would be able to know who had paid what. The bitcoin network handles these scenarios by aggregating all of the transaction that occur during a set period of time into a list, more commonly known as the block. It is the miners’ duty at that point in time to confirm all of those transactions, and code them into the general public ledger.
Now we begin hashing!
The general ledger we just mentioned is basically a long list of blocks, hence the term ‘blockchain’. It can be leveraged to explore any bitcoin transactions made between any bitcoin addresses, at any block on the network.
This process is basically repeated over and over. Whenever a new block of bitcoin transactions is put together, it is appended to the blockchain, creating a super long list of all the transactions that have ever taken place on the bitcoin network. What makes the network decentralized is the fact that this ledger does not exist on one person’s computer. Every miner that participates in the bitcoin network consistently receives an updated copy of the block, so everyone knows what is going on and no tampering of the ledger can ever occur.
But how can we be positive that no tampering of the general ledger can ever occur? How can the general ledger be so trusted at all times since it is held digitally? How can we feel confident in the blockchain remaining intact? This is where those mighty miners come in.
The mining process officially begins once a block of transactions is created. The miners take that block and the information contained in it, and they apply a complex mathematical formula to the block, converting it into something else. That something else that they create is a much shorter, random sequence of numbers and letters commonly known as a ‘hash’. At that point in time, that hash and the original block are stored at the end of the blockchain. This process repeats and repeats and repeats.
Hashes are pretty interesting once you look deeper into them. All in all, it’s sort of easy to create a hash from a specific pool of data like a bitcoin block, but it’s damn near impossible to understand what the original data was just by looking at the hash. Also, each hash is completely unique. No two hashes can be identical. Lastly, if you change just one simple character on a hash it will completely change that hash.
When miners create a hash they aren’t just using the bitcoin transactions in a specific block to do so. Some other pieces of data are leveraged too. One of the pieces of data we are referring to is the previous hash of the last block stored in the blockchain.
Since each new block’s hash needs to be created using the previous block’s hash. It becomes a modern version of a wax seal. It basically confirms to the whole network that this block, and every block that follows after it, is absolutely legitimate, because if a miner were to tamper with it the whole blockchain would know immediately.
How are miners incentivized?
Since all of the bitcoin miners are constantly competing with each other to be the first to ‘seal off’ a particular block, they have begun to use software written specifically to mine blocks quicker. Each time a miner successfully creates a hash for a block, they get rewarded with a certain amount of bitcoins, the blockchain gets fully updated across the network, and everyone on that network hears about it. That’s essentially the incentive placed out there for miners to keep mining and keep transactions going.
The problem that then arises when you look at this process at face value is the fact that creating a hash is very easy to do. Computers are just too good at this process in this day and age. The bitcoin network then has to make protocols to make mining more difficult to do, otherwise everyone and their mom would be able to set up a computer to just mine all day long for them. So what they introduced is something called ‘proof of work’.
This bitcoin protocol states that it will not just accept any old hash that is created. It basically demands that a hash has to follow a very specific format.
The blockchain rules essentially state that miners aren’t supposed to tinker with the transaction data in a particular block, but that presents an issue because in order for a miner to create a hash, they have to change the data that they are using. So miners get around this issue by using another, random string of data called a ‘nonce’. This is then leveraged with the transaction data the miner has been presented with to create a hash. If the new hash that is produced doesn’t fit the protocol format, the nonce is then changed, and the whole piece of data is hashed again.
It can take a miner many, many attempts to find a nonce that works just right, and on top of that, there are a ton of miners in the same network that are trying to do all of this at the same time. And that is essentially how miners earn their bitcoins.