Weekly Bytes 2: How Blockchains Agree — Decentralized Consensus

Peter Michalopoulos
Blockchain at Fordham
6 min readSep 16, 2019

In the last Weekly Bytes, we discussed what blockchains are and how they connect using hashes to create an immutable ledger serving as a single universal truth. We also talked about how blockchains are append-only, meaning you can only add to them. But how do distrusting people on a decentralized network come to an agreement about what to add to the blockchain? Well, that’s where consensus comes in.

Consensus simply means a shared agreement.

Byzantine Fault Tolerance

Before we jump into how consensus is achieved on decentralized networks, we need to discuss Byzantine Fault Tolerance (BFT). Derived from the Byzantine Generals Problem, BFT is the property of a network that is able to come to consensus in the presence of malicious messages. You’ll hear this word being thrown around a lot in discussions of decentralized systems. And rightfully so, it’s a problem that all blockchains face.

For example, in Bitcoin, a network of thousands of very powerful computers race to add the next block to the chain in order to receive a monetary reward. So, of course, there will be individuals who try to manipulate the chain for their benefit. But, these bad actors cannot be completely eliminated since anyone can participate in the network. So, decentralized networks need a way of tolerating these malicious individuals without compromising the integrity of the blockchain.

This is where BFT comes in. Networks that are BFT can keep functioning correctly with part of the network failing or acting maliciously. Typically, two-thirds of the network needs to be functioning correctly, but this fraction can vary across consensus protocols. Usually, this is achieved by collecting votes in real-time from validators on the network and using majority rule to determine consensus before committing a block.

How is consensus actually reached?

We’ve discussed that decentralized networks need a system of tolerating bad actors (BFT), but how do they actually do this. The answer is consensus protocols, the mechanism by which a decentralized network comes to an agreement.

Proof-of-Work

Prof-of-Work (PoW) is the consensus protocol created by Satoshi Nakamoto for Bitcoin. Abstractly, Miners on the network race to complete a cryptographic puzzle, which takes a certain amount of work to complete. This work to complete the puzzle serves as validation that the miner expended significant computing efforts.

Here’s how it works, there are two types of people on a Bitcoin network, generally. People who validate and store transactions, the Miners. And those who commit transactions, you and me, the users. We will discuss the other components of a Bitcoin network in a later post, but for now, we’re taking a high-level look.

In our example, Alice sends 10 Bitcoins (BTC) to Bob. To do this, she specifies Bob’s address and the amount in BTC (a small portion of Alice’s 10 BTC’s to Bob will be used for the mining fee). Alice then signs the transaction with her private keys and hits send. Private keys are how Alice proves to the Miners that she, in fact, owns those BTC’s she’s sending to Bob.

Alice’s transaction is then sent to a transaction pool, where other transactions like hers are waiting to be validated by Miners. Meanwhile, the Miners are hard at work packaging the transactions from the transaction pool into a block. Each Miner will verify every transaction in its proposed block, then start the PoW algorithm.

Miners prove they have valid transactions in their block by working on a pre-set algorithm. In Bitcoin, this algorithm changes in difficulty to ensure only one block is created every ten minutes (learn about why it’s every 10 min. here).

Think about the PoW algorithm like a game of dice. If someone tells you to roll two dice below 10, it is going to take a certain amount of rolls and will be pretty easy. But, if you decrease that number to 5, half the dice are out of the game and you can say with certainty that the probability will fall below 50%.

The cryptographic puzzle Miners need to solve has a pre-set difficulty. Just like how you know the probability for rolling dice, there is a known probability for the cryptographic puzzle. This is how the other Miners on the network can validate another Miner completed a certain amount of work for their block.

The reason Miners have to solve the puzzle is to prevent someone from spamming the network with fake blocks. It’s very easy to validate and add transactions to a block, but if a Miner has to prove they’ve solved a puzzle with a known difficulty then they can prove they’ve put the work in to solve a block.

If a Miner does solve the puzzle, they then send the block to the network where each Miner validates the solution themselves and if correct, adds the block to their copy of the blockchain. The beautiful part of PoW is that it is very difficult to solve the puzzle but extremely easy to validate the answer. Meaning, once the puzzle is solved and a block is sent to other Miners, the new block propagates very quickly.

Once the validated block has been propagated across the network to a majority of Miners, a new round begins and Miners must race again to solve the puzzle for the next block. When a Miner solves the puzzle and gets to add their block to the blockchain, they receive all the fees of the transactions in their block and newly minted Bitcoins.

Problems with PoW

Now if you think this sounds like a lot of work for the computers, you’re right. PoW requires an incredible amount of computational power to solve, which is why there are dedicated warehouses full of Bitcoin mining rigs.

The problem is, these computers require a massive amount of energy to run and cool off. Which, makes the Bitcoin network as a whole pretty taxing on the environment and not the most sustainable option.

There’s also the amount of money at stake. As Bitcoin’s price has risen, so has the value and difficulty of mining. So, big money has been put into these mining warehouses with very powerful computers, meaning the days of setting up a mining rig at home are gone. With this shift, the Bitcoin network has slowly become centralized, computationally controlled by a handful of individuals.

Not to mention, a new block is only created once every ten minutes, which equates to 7 transactions per second (TPS). Compared to Visa’s 24,000 TPS max, this doesn’t make Bitcoin the most compelling payment mechanism. Check out the Lightning Network here, a workaround to this problem.

These problems are why Ethereum is trying to move from PoW to Proof-of-Stake. And why other cryptocurrencies use different consensus protocols like Proof-of-Authority.

But for all of PoW’s shortcomings, it has laid the framework for a pretty radical new system of decentralized money without the need for a 3rd party to verify transactions.

What’s next?

Want to know what those keys were that let people know you own a Bitcoin? Or maybe you’re curious about how a cryptocurrency wallet works? Well, you’re in luck. Those topics will be covered in the next few installments of Weekly Bytes.

We only scratched the surface of consensus, so I encourage you to learn about how other cryptocurrencies and blockchain platforms approach this problem because there are some pretty exciting solutions!

Weekly Bytes are weekly meetings held at Fordham University’s Rose Hill campus breaking down a range of blockchain topics.

--

--