How Blockchains Operate | Web3 Explained

Zachary Bloss
CodeX
Published in
7 min readJun 28, 2022

Blockchains are very simple tools at face value. They are lists of transactions organized into blocks. The blocks are then connected together via the “Current Hash” of Block A becoming the “Previous Hash” of Block B and this continues on forever. If you want a refresher on this, check out the previous article in the Web3 Explained series. In this article, I will explain who and what are operating these blockchains, their motivation, and the environmental impact of doing so.

Private Blockchains

Something we have not discussed yet, but is absolutely crucial, is that blockchains can either be privately or publicly available. You are probably familiar with, or have at least heard of, the big public blockchains: Bitcoin & Ethereum. However, there are private blockchains like Ripple and Hyperledger as well. These private chains are targeted towards enterprises hoping to maintain control over access and immutability. Private blockchains often have a centralized authority that determines who is allowed to access the network and what data is written to it. Think of this authority as an administrator. Enterprises are attracted to these features because they allow them to create process and data sharing operations on a subscription model with other companies and in the event data needs to be “changed” or “corrected”, the administrator has access to do so.

Ripple logo placed above a hyperledger logo
Ripple source: https://1000logos.net/ | Hyperledger source: https://en.bitcoinwiki.org/

Public Blockchains

When most people talk about blockchains, they are talking about public ones. First, a node is any computer that is participating in a blockchain. But how does one “participate” in a blockchain? Remember back to our previous article when we talked about how blockchains are connected: The Current Hash of one block becomes the Previous Hash of the next. Given these blockchains are public, and there could be millions of nodes using the blockchain at the same time, who is to say which block’s hashes match and get published on chain? What we are asking is, what determines consensus across all of the nodes?

Ethereum logo placed above a bitcoin logo.
Ethereum source: https://logos-world.net/ | Bitcoin source: https://upload.wikimedia.org/

The answer to this question is it depends on what Consensus Mechanism the blockchain uses. A consensus mechanism is a set of code that allows nodes who do not know or necessarily trust each other to agree on what data should be written to a block. These consensus mechanisms are often open-sourced, meaning anyone in the world can see, edit, and see who edited the codebase. This transparency gives most people a sense of trust in the code. While there are many consensus mechanisms out there, there are two popular ones that dominate the blockchain space: Proof-of-Work & Proof-of-Stake.

Consensus Mechanism — a set of code that allows nodes who do not know or necessarily trust each other to agree on what data should be written to a block.

It’s time to call out my own bias on Web3 technology: I believe having a centralized authority defeats the purpose of a blockchain. A blockchain is a fantastic store of data, permissions, and actions when it is governed by consensus amongst all participants. Take the summer trip example from our previous article, If a single actor, say the AirBnb Host, has the ability to change the amount Zach sent Dave or Dave sent Sally, then the blockchain only benefits the centralized authority. Private blockchains will see wide adoption by enterprises, but as users grow to expect having ownership and control in the network, they will eventually drive adoption in public blockchains.

Proof-of-Work

The more widely used of the two, Proof-of-Work (PoW) is the oldest consensus mechanism and is responsible for the environmental damage and current reputation of the Web3 space. It is the consensus mechanism of Bitcoin and for now Ethereum as well (we’ll cover this in the next section). But why is it bad for the environment?

PoW is a process that allows nodes to compete to determine what the next block hash should be. In the previous article, we learned that the Current Hash of this block becomes the Previous Hash of the next block. This was a stretch of the truth on my part for simplicity’s sake. In reality, there are rules that determine what a valid next hash can be. These rules drive competition between computers in a race to find the next valid hash, the people and computers who participate in this competition are called Miners, and the winners are rewarded with the blockchain’s native-cryptocurrency. For example, Bitcoin miners are currently rewarded 6.25 Bitcoin (~$131,145) for mining the next block.

Take Bitcoin for example. At the time of writing, a bitcoin hash is only valid if it begins with 19-zeros. So how do you find a transaction hash that starts with 19-zeros and contains both the Previous Transaction Hash and Record? Remember that cryptographic hashing is both deterministic and can not be unhashed, meaning the only viable option for determining a valid hash is via guessing and checking. The nerd-term for this guessing-and-checking is called Mining. Yes, it’s that simple.

While the process is simple, the amount compute power to accomplish this today is extremely high. For example, try to find the next valid hash for the phrase “I’m going to share this article!” using our favorite interactive hashing tool below.

I wrote some code to do the same thing, and found that it took 1,542,635,643 attempts over almost 22 minutes time to guess the correct hash with only 8-leading zeros on my Macbook pro. Because of this, people buy and operate much more powerful machines so they have the best chance to Mine a valid block.

Bitcoin Miners all around the world are guessing-and-checking the next hash as fast as possible, because whoever finds the valid hash first is rewarded with Bitcoin. This means those with the most powerful machines have the best odds at guessing the correct hash and being rewarded. When we say Bitcoin consumes more energy than the country of Argentina, we are talking about the energy of the miners competing to find the next valid hash.

Area chart showing the exponential upward trend of bitcoin energy demand beginning at 0 Gigawatts and peaking at 55 Gigawatts
https://ccaf.io/cbeci/index

Bitcoin was the first blockchain to implement this well-orchestrated chaos of mining, verifying, hashing, and transacting. While it’s impact on the environment is nothing to ignore, it truly was a revolutionary technology that should be celebrated and improved upon. If you want to learn more about Bitcoin, I highly recommend reading the (8-page) whitepaper published by Satoshi Nakamoto.

Proof-of-Stake

Proof-of-Stake (PoS) directly alleviates the environmental burden brought on by Proof-of-Work by allowing only one-node in the network to mine a new block instead of having the entire network compete to mine the next block. Where PoW gains it’s security and transaction integrity through competition between Miners, Proof-of-Stake requires that Validators put up collateral to participate in securing the network. Putting up this collateral is also known as Staking, hence Proof-of-Stake. This collateral can then be programmatically taken away, slashed, from any malicious Validators.

Another energy efficiency of PoS is it can run on less powerful computers further reducing the environmental impact and lowering the barrier to entry for new users interested in becoming validators. As the number of validators increases, so does the security of the blockchain as it becomes harder for nefarious actors to implement attacks against the network. The downside to PoS is the capital required to become a validator can prohibit people from being able to participate. For example, when Ethereum switches to PoS validators will be required to stake 32 ETH, which at the time of publishing costs roughly $40,000.

51% Attack

There are a few big fears concerning blockchain security, some are specific to Proof-of-Work and some are specific to Proof-of-Stake. That being said, the dreaded 51% Attack is a concern for both consensus mechanisms. In short, this attack is possible when a malicious entity is able to control 51% of the network. This majority gives them the ability to write whatever data they want to the blockchain. In a PoW network, this means controlling more than half of all of the computing resources. In a PoS network, this means controlling more than half of the capital in the network.

Conclusion

In this article we learned about the two most important consensus mechanisms and what they are used for. We covered who is participating in securing different blockchains and how exactly they go about doing so. In the next article, I will cover the Ethereum Blockchain and introduce Smart Contracts. The Ethereum Blockchain is the most popular-to-develop-on blockchain and it has the second highest market cap behind only Bitcoin. Ethereum is also going through an incredibly interesting transition where they will be swapping from Proof-of-Work to Proof-of-Stake, a transition that has never been done before and one we will get to watch unfold ourselves in Q4 of 2022.

Socials

Twitter: https://twitter.com/altozachmo

LinkedIn: https://www.linkedin.com/in/zachary-bloss/

ETH / BTC / DOGE / LTC / SOL — block-ops.eth

Block-Ops.xyz: https://block-ops.xyz

--

--

Zachary Bloss
CodeX
Writer for

Ethereum Developer, block-ops.xyz, block-ops.eth, MLOps Architect, ex-Staff Data Scientist