In the News
The Fundamentals and Future of Blockchain and Bitcoin: Part 3 of 4
In Part 2 of this series, I detailed the technical implementation of how blockchain works, without discussion of how cryptocurrency becomes a player through this process. This time, we will explore the mathematics behind mining cryptocurrency, and how Satoshi Nakamoto’s white paper added value to it.
Proof of Work, Mining, and the Crypto Coin
I’ve gotten this far with little mention of cryptocurrency on purpose because blockchain and bitcoins et al., tend too often to be conflated without establishing the nature of their relationship. So far, the technical discussion, and the function of ledgers altogether, has not necessitated the additional and provocative element of alternate, and heretofore speculative, currencies. However, the innovation that makes it possible to have a public, distributed, immutable ledger not financed by a central authority is the digital crypto coin (hereafter, coin) itself. This reverses the usual causal relationship—the Nakamoto proposal was for BitCoin as an end, not a means—but as you will see, a public, distributed, immutable ledger cannot be sustained, so far, without crypto coins as conceived. This examination will not delve into Proof of Stake, which also requires coin, nor the many alternative coin-less blockchains that are not public or not *self* sustaining (e.g., are private, corporate, or government backed, and are not necessarily distributed).
Back to the physical block analogy: let’s make them wooden blocks. Let’s create an arbitrary rule that the only way to submit new blocks to the network of block holders is to hand carve them. So, now, to forge or add a block, a potential criminal has to take the time to carve it, then write new data on it, then hash the data, and distribute it on the network. If it’s a new block, it may get accepted if no competing block is added at the same time, but if it’s a forgery of an existing block on the network, there is no inherent reason for it be trusted as the correct version of the competing blocks. The only way, assuming a democratic consensus, would be if 51% of the network conspired to accept the forged block, and thereby claimed a majority consensus. Further, if it’s not a new block, it’s likely that other blocks that have been added since the block to be replaced was accepted, and since each subsequent block contains a reference to the prior block (and also its hash) and data about itself, and it’s all hashed again to make it internally consistent, a forger would not only have to carve the one block but forged versions of all subsequent blocks after it. And even then, the forger would have to control or collaborate with 51% of the network to form a new consensus to accept the forged blocks over the original ones. Without collaboration of 51% of the network, the most a nefarious actor could hope to do is to overwhelm the network (DDoS attack) for some purpose. But if the blocks must be hand carved, that requires an impractical amount effort and resources; by design, in fact, too much effort to be worthwhile, and it is inherently self-defeating.
The digital equivalent of carving the blocks, in this case, is math. Specifically, it gets back to cryptographic hashing algorithms. I should warn that this detail gets a bit technical in nature, but if the terminology doesn’t put you off, the concepts and examples should be easy to follow. Recall that a hash cannot be predicted from its input. That is to say, if “Sam I am” results in a hash of 9E43B74DDDE154DB565EACECDADF2E3BE004C3E0D8446789D864064EF8095797, “Sam I am!” results in an entirely dissimilar hash (try it here). Now, see if you can figure out what to add, other than the “!” to “Sam I am” to create a hash that starts with “0”. I just did, and after about a dozen random attempts, I discovered that “Sam I amf35” results in 079DFDAC8DCC96692ACE50793A30406BFBF240910E1036538612CBD1E1946DA5. Go try it yourself to verify that you get the same hash. What we’re doing is discovering, through trial and error, an arbitrary string “f35” (referred to as a nonce) that can be appended to a known value to result in some part of the hash matching a specific criterion. In other words, if the criteria is to create a hash that begins with “0” from a string that starts with “Sam I am” our challenge is to try appending different values until we get lucky. Now, what if the challenge was to discover a hash that began with “00” or “000”. As you might imagine the odds of discovering a hash that meets the criteria get exponentially less likely with more specificity of the outcome. If it’s less likely, then we have to try more combinations. This requires processing power, i.e. work, as each pass through the hashing algorithm requires significant math. But notice that with hashing, because you always get the same result from the same input, once you know the nonce (arbitrary string) you can reproduce the hash in one try. So, even if it takes a billion attempts to discover a hash starting with “000000” from a string starting with “Sam I am” it takes only one pass through the hashing algorithm to verify the nonce once its discovered. By providing a nonce with a block, along with the resulting hash that begins with the arbitrary rule that it has to begin with some number of zeros, the submitter is proving that work, or processing power, was done to create the hash. The proof of work functions exactly like the carving of each wooden block in that it limits the ability of an attacker to defraud the information in the ledger. In fact, it would take resources greater than 50% of all the processing power in the network to cause the network to reach consensus that the fraudulent blocks were the correct version of the ledger. The requirement to do work, in the form of processing power, leads to a critical question at this point. For the honest network participants, why bother investing in computing equipment and electricity to do all this work to add new blocks?
Enter the crypto coin. When the Nakamoto white paper first came out, the purpose of the scheme was to create BitCoins. The idea was clearly compelling, but at first, coins had no value. Nonetheless, the deal was this, if you (or your computer) do the work to discover the nonce to create a hash for each block starting with a specified number of zeros, you will get bitcoins. In this initial stage, technical curiosity and hope were enough to get early adopters working on the problem. Recall, though, that with a criteria of only a one “0” prefix, it took me only 12 tries to discover a nonce. I did that manually in seconds. A computer could do it almost instantly, meaning that the computing cost is near zero with the minimum prefix criteria. So early on, there was symmetry between the cost of adding blocks, and the reward of bitcoin (0=0). As interest in the possibility of BitCoin as an alternative currency caught on, the coin began to appreciate and have tradable value, just as Nakamoto intended. Many of us on the outside of this phenomenon relegated the valuations to something similar to kids buying power-ups in a video game. The manufactured desire to possess more BitCoin stuff lead to a similarly manufactured market for coin. Maybe we were right, but, then again, maybe all the smart people who have since jumped on board are more right. In any case, another mechanism is that as the price of coin goes up and market forces drive the network to create blocks at a faster rate (invest more computing power), the number of zeros required in the hash increases. Additionally, the bitcoin rewarded for each new block can be adjusted automatically to impact market incentive to mine. These simple market levers work to retain the symmetry of cost of adding blocks and the reward of coin even as BitCoin valuations skyrocket.
For those who noticed, I’ve skipped over rolling transactions into blocks, and verifying them using merkle trees. I’ve probably skipped some other details as well, but hoped to capture the essentials of blockchain in sufficient detail for the curious layman.
With the information we have learned over the course of the series thus far, we will discuss what the speculative future, and perhaps roadblocks of cryptocurrency will be. Check back here for that and more, in the final installment of our series.