Introduction to Blockchain: Consensus Algorithms – Part 1

Why use blockchains?

This question can be best answered by taking a look at the history of government. A lot of the same principles that apply to democracy, also apply to blockchains. Democracy was founded on the basis that power belongs to the people, and blockchains achieve a similar decentralization.
The pillars of democracy that many of us experience every day, has not yet transferred over to technology.

What is DLT?

DLT stands for Distributed Ledger Technology and is one of the largest technological advancements of our time. A distributed ledger is just a database that is spread over multiple sites. This allows for more consistent uptime and the elimination for a centralized power. A blockchain is a type of distributed ledger.

How does a blockchain work?

The word blockchain is pretty self-explanatory. In the most literal sense, blocks are added to a chain. The addition of every following block, makes it harder to alter the original block (in order to get back to the original, every block after it would need to be removed). Each block is composed of a group of transactions that is bundled together by a node. The way that the node does this, is by utilizing a consensus algorithm, which will be explained in the next section. After a node solves the block, it is broadcasted on the network to the other nodes. If the other nodes verify that the solution provided is correct, the block is accepted onto the chain.

 

Consensus algorithms

Perhaps the single most defining and important characteristic of a blockchain is the chosen consensus algorithm. This algorithm is what verifies that a block that is to be added to the blockchain is the real version. Without a consensus algorithm, anyone could potentially add information to the blockchain, which would derail the legitimacy of the entire system. There are two main types of consensus algorithms:

1. Proof-of-work (POW): Requires the nodes to perform “work” in order to verify a block. This is usually in the form of processing power and is also referred to as “mining”. The processing power is used to solve a cryptographic problem. This algorithm is straightforward, has few variations, and is currently used by Bitcoin and Ethereum.

Hash: An algorithm is used to generate a long series of random numbers that requires a certain amount of processing power. Generating a hash with a value lower than the target will solve the block.

CPU vs GPU vs ASIC: CPU’s were initially used to mine, but were outperformed by GPUs. ASIC hardware then made GPU’s obsolete. Each of these transitions, resulted in a massive spike in mining difficulty.

Mining difficulty algorithm: The higher the hash rate (current mining performance) goes, the more difficult mining becomes.

Mining pools: The massive increase in mining difficulty resulted in a huge problem for miners with less processing power. It would take too long and be inefficient for them to generate a block. A mining pool is a software that enabled miners to pool their processing power in order to solve the block. In turn, the participants are given parts of the reward based on their proof of work.

While proof-of-work provided a way to thwart DDoS attacks, it presents problems that shake the foundation of decentralization. The result of the advancements in tech and the increased mining difficulty, has created a situation where the mining pools control significant chunks of power. The creators of these pools, now have significant power over the network. Even more important than that, proof-of-work tends to not be scalable enough. The increasing number of miners, also increases the amount of energy required for the network to operate. Theoretically, proof-of-work is prone to Sybil attacks (forging identities in p2p network) if it doesn’t satisfy the 3 E’s of Sybil resistance; entry cost, existence cost, and exit penalty. For example, bitcoin maximizes existence cost because it doesn’t satisfy the other two E’s.

2. Proof-of-stake (POS): The node that verifies the next block is chosen using various chance-based algorithms in addition to wealth (the amount of the currency that is staked). The idea is based on the logic that a person with a larger stake would be less likely to derail the system.

Proof of stake also presents some flaws. A node with a higher stake will verify more blocks. This results in a scenario where the rich become richer (indirectly opposing the idea of decentralization). Also, network security is an issue. Consensus failure is a huge problem, because there is no cost to support several chains. This could also result in “double-spending”. Denial of service attacks could also occur.

Even though proof-of-stake provides more benefits to the network than proof-of-work, it is far from being perfected. Solutions have come up over time that have increased the security of proof-of-stake, but at the cost of centralization.

Ex. In order to mitigate denial of service attacks, a rule can be implemented to require a minimum stake. Even if staking pools would arise to allow someone to stake any amount, it would result in the centralization of wealth and power.

At this point, it is clear that a variation of proof-of-stake is the next step in creating a scalable and safe network. Compared to proof-of-work, proof-of-stake has better security, less centralization, and is more energy efficient.

Byzantine Fault Tolerance (BFT): BFT aims to fix the problem of a rogue node. Proof-of-work already provides BFT through the use of processing power. Proof-of-stake, on the other hand, requires a more distinct solution. One solution goes back to our comparison to democracy. Nodes will periodically vote in order to separate the true from the false. This solution only works as long as under 50% of the nodes are rogue.

Using a version of proof-of-stake that conforms with BFT seems to be the most promising way to approve transactions onto the blockchain.

 

Forking

Another important attribute of blockchains, is the ability to be forked. Forking allows for a blockchain to be upgraded for a variety of reasons. This allows for it to remain scalable.

Hard Fork- A hard fork occurs when there is a permanent split in the blockchain. This could occur if the nodes on one chain cannot remain being nodes (for whatever reason) after the update. This results in the creation of two cryptocurrencies.Soft Fork- A temporary split in the blockchain which is a result of non upgraded nodes not adhering to the upgraded protocol. A soft fork does not require nodes to be upgraded in order to maintain consensus. Instead, the blocks with the soft forked in protocol also adhere to the old protocol. A soft fork will only work if the majority of nodes are running a client that is following the new protocol.

 

Steps:

  1. Protocol is updated and soft fork occurs.
  2. Some nodes switch to a client following the new protocol (also follows old protocols). Some nodes continue using a client following the old protocol, but cannot mine   unless the block continues to only use the old protocol.
  3. The soft-forked in block is mined by the nodes following the new protocol.
  4. If the majority of miners switch to a client following only the old protocol, the nodes using a new protocol client will be breaking consensus.

Leave a Reply