As we all watch the Crypto-markets go through their inevitable Bear cycle, lets look at the underlying way in which all of these magical transactions are created, verified and kept secure.
Cryptocurrency Mining. What is it? We hear the term often however the explanation for how it works is widely varied and range from, “there are these hidden pieces of code hidden around the internet, and miners search for them and piece them together to make bitcoin” to “a bunch of computers that solve math problems and get bitcoin.” Both of these explanations draw their roots from some form of truth, but I can only assume that a case of Chinese whispers has taken place to result in the previous examples.
To put it plainly though, Mining Cryptocurrency is the process of participating in a protocol and solving various math problems which collectively secure the transactions of the network and organise them into blocks. This process ensures that each block is cryptographically linked to the previous block that was generated, creating a chain of blocks, hence “Blockchain”.
In simplified terms Mining is the process of Securing and Organising encrypted blocks of transactions, and the miner that solves the ‘block’ first is rewarded.
First let’s talk about what a Hash is and how it works. A Hash is a 64-character long string comprised of both letters or numbers that is created after a piece of data (of any size) is passed through a hash function. The hash created is unique to the data that was input, so for example if I was to write my entire life story and pass it through a hash function, a unique 64 character hash would be created. If, later on I passed the exact same data through the function again, it would produce the same hash.However, if I changed anything or added to my life story, a completely different hash would be created. This is the glue that holds the blocks in the chain together – each transaction block creates a unique hash, which is used as the foundation of the next block.This means it is INCREDIBLY DIFFICULT (if done properly, completely impossible) to change previous transactions that have taken place.
Mining is done using ‘brute force’ (in proof of work only) calculations, meaning that the computer solving the hash basically tries one combination of letters and numbers after the other in the hopes that it works out. Imagine coming home wasted at 4am and trying to unlock your front door,using every key in your possession in the lock. A Hash works in a similar way. Eventually a miner in the network solves it and is therefore rewarded.
The ‘key’ miners are trying to find is called a ‘nonce’ (number used once). A miner will combine the data in a block with a ‘nonce’ and then pass it through the hashing algorithm to produce a hash. Where the fun for the miners comes in is that the order in which they put the transactions into the block, along with the randomly selected nonce will give wildly different results to other miners of the same block. However a block is only found to be valid when a Hash is output with a certain amount of 0’s in front of it.The amount of 0’s required is set by the network as a function of difficulty.
The difficulty of the block is determined by the amount of available miners ready to solve said block. It scales up and down depending on how much ‘hashing power’ is available;meaning that as more entrants enter the market, mining will become less and less profitable. In Bitcoin for example, the ideal mining time per block is 10 minutes.If the average block creation rate increases (more blocks over a shorter time span) then the network adjusts the difficulty. This is dynamic feature of the network and is calculated every 2016 blocks (or every 2 weeks).