When it comes to conventional fiat money systems, governments simply print more money when they need to. However, in bitcoin, money isn’t printed at all – ‘miners’ discover it. Essentially, computers worldwide ‘mine’ for coins by competing with one another.
How Does Bitcoin Mining Take Place?
Okay, here’s how it works: people are able to send bitcoins to each other over the bitcoin network 24/7, but unless someone keeps a tally of the transactions, no-one would be able to keep track of who had paid x amount.
The bitcoin network deals with this vulnerability by collecting all of the transactions made during a set period into a long list. This is called a ‘block’. The miner will then confirm those transactions, and compose them into a general ledger.
The General Ledger: What is it?
The general ledger, also known as the ‘blockchain’, is a long list of blocks, and it can be used to explore any transaction that has been made between any two bitcoin addresses, at any point in time on the network. If a new block of transactions is created, it will be added to the blockchain, which creates an increasingly long list of all the transactions that took place on the network. If you participate, you will receive a constantly updated copy of the block so you know what is going on.
It is important to keep in mind that a general ledger has to be trusted, and held digitally. So, how can you be 100% that the blockchain stays intact, and is not interfered with? Well, this is where the miner’s job comes in.
When a block of transactions is created, miners will put it through a specific process. The bitcoin miners will take the information in the block of transactions, and apply a mathematical formula to it, which turns it into something else. The result will be a far shorter, random sequences of letters and numbers referred to as a hash. The hash is stored along with the block, at the end of the blockchain at that moment in time.
Hashes have some intriguing properties. For instance, it’s easy to create a hash from a group of data like a bitcoin block. However, it’s almost impossible to work out what the data was just by looking at the hash. If you were to change one character in a bitcoin block, its hash would change completely.
As for the miners, they will not just use the transactions in a block to generate a hash, but they will also use other pieces of data as well. One of these pieces, for instance, is the hash of the last block stored in the blockchain.
Since each block’s hash is created by using the hash of the block before it, it transforms into a digital version of a wax seal. The block – and every block after it – is legitimate, and if someone were to meddle with it, everyone would be alerted.
Further, if you were to fake a transaction by changing a block that had previously been stored in the blockchain, that block’s hash would also change. Someone could check the block’s authenticity by running the hashing function on it and find that the hash was different from the one that had already been stored in the blockchain. The block would be spotted as a fake immediately.
Due to the fact that each block’s hash is used to help create the hash of the next block in the chain, tinkering with a block would also make the subsequent block’s hash wrong as well. This would essentially cause a domino effect; it would continue all the way down the chain, throwing everything out of sync.
Bitcoin: The Coins, The Miners, and their Rivals
That’s how miners ‘seal off’ a block. Each miner competes with the other to do this, and they do so by using software written specifically to mine blocks. If someone successfully creates a hash, they are rewarded with 25 bitcoins, the blockchain is updated, and everyone on the network hears the news. Many find this to be the push needed to keep mining and to keep the transactions flowing and working.
However, like most things, there are a few problems with this. One thing is that it is extremely easy to create a hash from a collection of data. Computers, in particular, are very good at this. The network has to make it more challenging, otherwise, everyone would have the ability to hash hundreds of transaction blocks each second. This would result in bitcoins getting mined in minutes. The bitcoin protocol – the rules that make bitcoin work – deliberately makes it more challenging, by rolling out something called ‘proof of work’.
In fact, the bitcoin protocol won’t accept just any old hash. It asks, no it demands, that a block’s hash has to look a certain way. For starters, it has to have a certain number of zeroes at the start. What’s important to understand is that there is no guarantee on telling what a hash is going to look like before you create it, and once you add a new piece of data into the mix, it’s game over, the hash will be completely different.
The job of the bitcoin miner is not to monkey around with the transaction data in a block, but to change the data they’re using to create a different hash. How do they do this? They do it by using another, random piece of data called a ‘nonce’. An individual will use a ‘nonce’ with the transaction data to produce a hash. If the hash does not meet the required format, the nonce will change, and the whole thing is hashed again. This is key because this is how miners earn their bitcoins; miners are trying to do this process in the network, all at the same time, and the process itself can take a number of attempts to find a nonce that works. If you can’t handle the heat, get out of the kitchen right?
Featured Image: Depositphotos/© urban_light
Credit: Source link