12 - Coming to consensus & proof of work
Wedding rings are rich in symbolism although most people take the concept of a wedding ring for granted. The common belief is that when you get married, you give each other wedding rings to show the other person how much you care about them. But why a ring and why not something else? First, rings are very visible. Wearing a ring tells the rest of the world that you’re accounted for. Second, the ring helps keep the wearer honest. If there is ever a temptation to stray, the ring is a friendly and public reminder that you shouldn’t.
The benefits of a wedding ring could be accomplished by any loop of metal around someone’s finger but we insist on spending thousands of dollars to buy gold and diamonds. A diamond wedding ring averages about $5,900 and diamond distributors encourage people to spend two months’ worth of their salary on the shiny rocks. We are willing to do this as a more tangible sign of our affection for the person. Spending that kind of money on something that has no direct utility is the ultimate sign of wealth and affection. It shows the purchaser can and is willing to metaphorically light two months of income on fire to prove the world they love you. It’s wildly extravagant but extremely important…. just like digital asset mining.
Consensus
In our discussion about Building Blocks we ended with a description of how miners take the transactions waiting in nodes, use them to find an acceptable hash, and then publish a block to the network. Miners do this because they are rewarded with newly created digital assets and with the transaction fees paid by people conducting transactions. Miners are compensated for providing the network the latest block in the chain. They are responsible for literally creating new pages in our digital ledger.
On the Island of Yap, agreeing on the correct copy of a ledger is easy. Everyone on the Island can congregate in one location and compare each other's ledgers. Writing a new page was as easy as taking 20 minutes to write down the day's transactions. If everyone did it together, then there was no real way for anyone to cheat while updating their ledger. The islanders held each other accountable to make sure that everyone’s ledgers matched before disbanding for the day. In the blockchain world we need a way to coordinate the block updating process and determine how to come to an agreement about the current copy of the blockchain. The process of coming to an agreement is called consensus.
Miners are responsible for helping a blockchain reach consensus. Through block creation, they tell the network what the most current version of the blockchain is. Unlike the Island of Yap, however, the other blockchain participants (other miners and nodes) do not have time to sit down with the miner who created a block to ensure the new block is accurate. Blockchains need a way to validate that the information the miner is presenting in a block is correct and accurate. Miners must follow a specific set of rules when creating a block such as the total amount of transactions that can be included in a block, ensuring that no person spends more digital assets then they have, and the total amount of new digital assets created is below the maximum allowed by the network. In order to ensure miners don’t cheat, blockchains employ something called a “consensus algorithm.” The most common two types of consensus algorithms are: 1) proof of work; and 2) proof of stake.
Proof of Work (PoW)
The Bitcoin blockchain pioneered the most well known and controversial type of consensus algorithms, proof of work. Proof of work requires that blockchain miners expend large amounts of energy by running computers that are trying to find valid hashes. Mining is the process of trying to calculate a hash that will be accepted by the network. During this process miners burn real world energy through the use of computers and, if they are successful, they will receive compensation in the form of whatever digital asset is native to the blockchain they are mining.
The cost of mining is just like a wedding ring. It is a way to keep the miner honest. If the miner decides to cheat by adding a transaction to a block that is invalid (someone attempts to send 3 bitcoin when they only have 2), then the miner will not receive their block reward and not be compensated for the electricity costs they incurred. Blockchain data is very straightforward and determining if a miner cheated can be done almost instantly. Even so, miners on the Bitcoin blockchain must wait for 100 blocks to be created after the block they mined before they can access their mining compensation (new digital asset). The wait time acts as another control so that the entire network has time to review the miners’ work and ensure that no rules were broken.
In the years since the Bitcoin network was created mining bitcoin has required more energy. The increase in energy is caused by more people mining. If miners are solving hash functions in order to be compensated for their work, the probability that a hash gets found increases as the number of people who are looking for hashes increases. Over time, as more miners search for hashes, blocks would be created more quickly, slowly creeping toward instantaneously. If blocks were made instantaneously then the 100 blocks would go by in a matter of seconds and the community would not have time to review a miner’s work before they were compensated for it.
The original designers of the Bitcoin network understood this so they made the hash function miners must solve more difficult as more people tried to solve it. Increasing the difficulty of solving a hash function has the benefit of ensuring that on the Bitcoin network, blocks will continue to be created at a consistent 10 minute rate, ensuring ample time for a block to be visible to the network before a reward is paid.
PoW and the Environment
The increasing number of miners on the Bitcoin network and the resulting increases in energy consumption have led to lots of external criticism of the network. Many people outside the industry see this use of energy as abhorrent. News articles have stated that the electricity consumption of the network rivals that of small countries. The data being collected in these studies is iffy at best for two reasons.
First, until recently it has been uncommon for miners to report their actual energy consumption so, these studies are taking educated guesses at best. Second, there is even less information about the source of the energy being used to mine. No one should have a problem if miners were using 100% hydropower. The impact on the environment would be negligible. Harvard Business Review did a great job describing some considerations around bitcoin mining.
Regardless of the concerns around energy consumption, it is important to take a step back and get some perspective. Bitcoin mining is an integral part of securing a blockchain network. For that reason, people who believe in the value of supporting a free and open financial network see the energy expense as completely warranted. Just like the expense of a wedding ring puts skin in the game of a married couple and helps to secure a relationship, mining puts skin in the game of miners and helps to secure a network. Said another way, we don’t mind energy consumption when we believe that the consumption is valuable.
The environmental concerns and technical issues has resulted in the industry looking for an alternative to proof of work. The next most popular consensus algorithm is called proof of stake. Next week we will discuss how it works and some of its pros and cons.