Shaurya Malwa · 3 days ago · 2 min read
For a long time, most applications used traditional centralized databases to manage their data. Applications could read and write to a set database that was managed by a single entity, a master. But these systems had a major flaw: reliance on a single entity leaves the database more vulnerable to failures and attacks.
Systems that aspire to be truly decentralized such as blockchains can’t use such a model to maintain a network of value. Instead, blockchains required the creation of Nakamoto consensus, the Byzantine fault-tolerant consensus algorithm that Bitcoin uses.
In distributed computing systems, there must be a way for the system to continue functioning even if various individual components of the system fail. In the case of Byzantine fault-tolerance, the distributed system needs to be able to come to an agreement even when certain components fail and are unable to participate in the processes to reach consensus.
The name is derived from the “Byzantine Generals Problem”, a problem that explores the following idea: there is an army split with the two groups on opposing sides of an enemy city. If one of the two groups were to attack the enemy city alone, then the enemy city would be able to outlast them. The only way for an attack operation to succeed is for both groups to attack at the same time.
To do this, the two generals in charge of the two split groups need to come to an agreement on a time to attack the enemy city but, the only way for them to communicate is to send a messenger through the enemy city. Because the messenger has to travel through the enemy city, neither general can be confident in their message being delivered to the other; the messenger could be captured and replaced by another fake messenger to mislead the other general.
In the case of Bitcoin, the generals are replaced by the various nodes that need to come to an agreement. Nakamoto consensus uses a Proof-of-Work system to solve this problem.
What is Proof-of-Work?
Take the above problem, and label the two army groups, Group A and Group B. Group A’s general wants to initiate a message to send to Group B regarding the time of the attack. Instead of just sending the messenger through the city with the message and hoping that it will be delivered successfully, the general creates a nonce, an arbitrary number, and attaches it to the message.
The combined message is then hashed and sent to the other general. If both generals agree on some component of the hash, for example, that the hash must start with a certain set of numbers, the general for Group B can verify that the message has not been altered by the enemy city. If the enemy city was to alter the message and hash the new message, it would be likely to not have the same components of the hash that the two generals agreed upon. In effect, this system, a simplified explanation of the Proof-of-Work algorithm, largely prevents the enemy city from being able to artificially change the message and lead to a flawed attack.
In Bitcoin, special nodes called “miners” work to solve a cryptographic puzzle of finding a nonce such that when the block’s content is hashed with the nonce it fits a certain requirement. When the nonce is found, the node can publish the block with transactions to the network to be verified by the other nodes and to be added to the blockchain. The hash of each block also includes the hash of the previous block so that every block is connected in a chain (that’s where the name blockchain comes from).
To incentivize miners to carry out this process that establishes the security of the network, the first miner to find the nonce and publish the block is rewarded with newly-created Bitcoin. Currently, miners can earn a reward of 12.5 BTC, but in May 2020, the reward will drop to 6.25 BTC. This is known as the Bitcoin block halving, which happens every four years.
⇒ See here for a list of Proof-of-Work coins
The Proof-of-Work system is not perfect. A 51 percent attack is when a group of miners controls over 50 percent of the Bitcoin network’s mining hashrate which allows them to control the Bitcoin block verifications.
This means that they could prevent users from creating transactions and could double-spend Bitcoin themselves. In 2014, one mining pool, Ghash.io briefly crossed the 50 percent hashrate mark leading them to promise they would not cross the 39.99 percent hashrate for the Bitcoin network in the future.
Bitcoin’s Proof-of-Work is also extremely costly in terms of energy consumption. The Bitcoin network has a total carbon footprint that is comparable to that of the entire country of New Zealand. As global warming becomes an increasingly dire situation, Bitcoin’s carbon footprint must be addressed by the larger blockchain community.
What is Proof-of-Stake?
One major alternative to Proof-of-Work consensus is a Proof-of-Stake model. In this model, the computing power used to mine new blocks is replaced with the number of coins one holds. Basically, the more coins one is willing to “stake”, the larger their mining power is (although there can be some other factors like staking age, a calculation that combines the number of coins staked and how long those coins have been staked).
By minimizing the computing power that it takes to “forge” (an alternative term to “mine” often used by Proof-of-Stake systems) a new block, Proof-of-Stake effectively addresses the energy consumption problem.
Furthermore, to carry out a 51 percent attack in a Proof-of-Stake system, a single entity would need to acquire 51 percent of the coins being staked which would be very impractical for blockchains of scale. Proof-of-Stake also makes the attack largely impractical as it would likely decrease the value of the cryptocurrency that the attacker holds a majority of. As a result, the attacker would stand to lose a significant amount of value in such an event.
⇒ See here for a list of Proof-of-Stake coins
Nakamoto consensus was a crucial step in developing cryptocurrencies like Bitcoin. Byzantine fault-tolerance and Proof-of-Work made it possible to have a decentralized network of value with security. However, Proof-of-Work isn’t perfect, and Bitcoin and the rest of the cryptocurrency community stand to gain from updates to consensus mechanisms such as Proof-of-Stake.