Traditional Crypto Mining: Proof-of-Work
When Satoshi Nakamoto released the original Bitcoin whitepaper he was lauded for his ingenuity and creativity. One of his finer achievements was harnessing the concept of proof-of-work, a process which uses computer processing power to simulate the effort of real-life mining, simultaneously creating an artificial scarcity which gave his “fake” money real value. This system works very well – for now, that is. In this article I will touch on what mining really is, and how it actually works in respect to the blockchain. While I will focus on Bitcoin, this process is applicable to the vast majority of other cryptocurrencies that use proof-of-work.
People who have some idea of what mining is will typically explain it as a process where “computers solve complicated math problems to create blocks of transactions on the Bitcoin network”. This is not wrong by any means, but there’s a little more to it than that. Transactional data is hashed by computers performing proof-of-work into “blocks”. Functionally, there are five main parts to a “block” (this does not include the block number itself):
- The nonce. This number is arbitrary and meaningless. It is the variable of the block that is manipulated to change the hash – more on this later.
- The coinbase transaction. This is the first transaction in each new block. Since each new block generates (mines) new Bitcoins, this transaction dictates where these new Bitcoins go.
- The general transaction ledger. This portion includes data from all other transactions verified in that block.
- A reference. This portion of the block simply contains the hash of the previous block. By including the previous block’s hash, it creates a chain – the blockchain.
- The hash. This is the output of all the rest of the block’s data, combined and “hashed” into one value, which is random and has a fixed length.
Now, take all of that information about what each portion of the block actually is and stow it away for the time being; I want you to think of these pieces simply as data, numbers in an equation. Bitcoin uses a SHA-256 hash algorithm to generate it’s hashes, meaning it takes all 5 of the variables above and puts them into an equation that generates the hash itself – a random string of numbers and letters that is always the same length. Even a slight change to any part of the input data will completely change the hash value. This serves to encrypt the information and also to condense it. Simple enough?
Now, a little elaboration on the nonce: the nonce is the part of the block that is most important to the mining process; it is the independent variable in the equation that gives us our hash. This means that unlike the other information (previous hash, transaction data, etc.) it can be manipulated without affecting the content of the block. The reason the nonce exists is so that the difficulty of solving each block can be increased. The network strives to keep on a specific time frame, and to accomplish that it is automatically adjusted “such that it targets a goal of solving an average of 6 blocks per hour. Every 2016 blocks (solved in about two weeks), all Bitcoin clients compare the actual number created with this goal and modify the target by the percentage that it varied. The network comes to a consensus and automatically increases (or decreases) the difficulty of generating blocks” (6). In simpler terms, the “target” of the hash is changed accordingly to ensure a time of around 10 minutes per block.
The “complex mathematical problems” that people are talking about when they describe mining are simply the miner’s attempts at guessing the nonce of the next block. When miners “mine” they are using brute computer processing force to guess the fixed value of the next block’s nonce which, once hashed, will have the correct number of leading zeroes and have a lower value than the “target”, which is predetermined value based on the difficulty explained above, and will unlock that transaction block.
All of the technical aspects behind us, it is easy to understand how the blockchain works. Since each piece of the block is a value that is input to generate the hash, any change made to any transaction would change that block’s hash, making it invalid. This would then invalidate the next block (because of the reference hash) and subsequently the entire chain after that point. Since the ledger of the blockchain is distributed between all the miners, they would quickly and easily realize any time another miner was operating on an incorrect blockchain. It’s an intricate and highly functional system that removes the factor of trust. In the beginning, the concept was pretty flawless. Unfortunately, as we progress and adopt more miners (and in turn higher hash difficulty) there are some serious issues that arise.
To learn more about the shortcomings of proof-of-work mining, check out my follow-up article, “Why Proof-of-Work is Unsustainable”.
Join our community on Telegram
Learn How To Build Wealth With Crypto. Get Started Now.