Ethereum’s “The Merge” Explained

Elliott Lindsay
9 min readDec 17, 2022

--

Imagine this: Ethereum has successfully carried out its plan and the Ethereum Mainnet will now use proof of stake as its consensus mechanism. As a result, the total energy consumption has been reduced by an estimated 99.9%. Everything went without a hitch, and almost everyone is happy and agreed to this change.

Now, imagine this: What you just imagined, actually happened.

The amount of energy that crypto miners are insane. Ridiculous. It’s estimated that bitcoin miners alone use up to 150 terawatt-hours of electricity every year. More than enough to power several small countries!

Ether, run by Ethereum is one of such cryptocurrencies. It’s the second most popular one! Ethereum has hundreds of thousands, sometimes a million transactions every day! You’d think the system can handle it all without needing to use up a significant amount of energy, especially not 12.5 terawatt-hours a month! Well, you’d be right. But that’s not the problem.

The problem is the verification system.

The problem is proof of work.

Well, thanks to the Merge, proof of work is no more.

A Quick Review

A blockchain is decentralized. A shared database/ledger, owned by the people with no superior figure to control the people or blockchain, and in which nobody can remove or change anything in the blockchain. A blockchain is immutable. Once some data is added, the data cannot be changed or removed. Transactions or data are stored in blocks, forming a chain (hence the name: blockchain). Due to certain seemingly unfixable flaws in all blockchains, the system is unable to verify transactions by itself and must rely on our help.

Well, computers and mining farms.

Proof Of Work VS Proof Of Stake

Proof of work. The thing that is using up all of this energy. What is it?

(We’ll be using Bitcoin’s PoW system to explain.)

You have this old bike that you don’t need, or want, so you put up an advertisement on Kijiji. Someone called Bob replies.

“Hey, can I pay you in Bitcoin instead?”

“Of course!”

He wants to pay you in crypto: 0.01 Bitcoin for the bike. So, you meet up, give Bob the bike and he taps the “Confirm Transaction” button on his phone…

Now what?

Before Proof Of Work

Your transaction gets put into a “pile” or list of other transactions, which have not yet been added to a block. To get your transaction added to a block, a miner will look at the list of unclaimed transactions and go, “Okay, I choose you!” along with a couple of other transactions until no more can be added. The limit is 1MB of data in a single block. Meaning yes, if there is a small shortage of miners, the processing time may increase as your transaction might float in the pool for a while before a miner picks it.

Let’s say, James, a miner, has added Bob’s transaction to his block. Ok.

Now, proof of work.

The Proof Of Work System

(We will talk about proof of work and stake, not necessarily the entire security/verification system).

Before the block can be added to the blockchain, it must receive a signature. A hash. The signature is a 64-digit hexadecimal number. Hexadecimal numbers are base-16! It has the usual base-10 numbers (0–9) and the first six letters of the alphabet (A to F).

Decimal (base-10) vs Hexadecimal (base-16)

So what is a hash?

You get a hash using a hash function. The function will take in some string of data (hash input), then turns it into a different completely random string with a fixed length that in no way relates to the hash input. Aka, the 64-digit hexadecimal number. It’s impossible to reverse the process. You can’t get a hash input from a hash output. That’s the entire point of hashes. Another thing is that when the hash input is changed even if only one character is removed, or you change an ‘O’ to a ‘0’: the output is changed.

But what would James use as his hash input? Well, if you guessed the block that James has created, you’d be right! The block is converted into a form (usually, letters) that the hash function can understand and convert into a hash output!

Here’s an example of a hash:

000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

This is the signature (hash) of Bitcoin’s genesis block. The first ever block created on the bitcoin blockchain. One thing that you may notice is that there is an abnormal amount of zeroes at the beginning of the hash. Interesting, is it not?

The Problem

“Complex,” in terms of computer talk means “uses up lots of resources and time”. Hashing: it’s basically guesswork, and it really is just guesswork. You’re using the block as your hash input and getting a hash output. But it can’t just be any hash. The signature must have some zeroes at the beginning. In fact, (as of writing this article) you need 19 leading zeroes.

00000000000000000006c9f1194ce7ff75c5f265d5520878e9e9392c3c8ff203

It seems like an impossible feat. You’d have to get incredibly lucky to get a hash that starts with 19 zeroes (or more). You already only have a 1/64 chance to get one leading zero! But 19?!

Unfortunately, James’s hash input did not even have a single zero at the beginning. What now? Does James give up and try again with a new set of transactions? No! At the end of every block, miners are allowed to add a nonce to their block. A nonce is only a value. But it’s the key to getting an acceptable hash.

Remember, changing anything in the block will result in a different output. You can’t change the transactions, so miners require something else. The nonce. It doesn’t matter what it is, just as long as it can be changed.

So, James changes the nonce, also changing the hash output, and doesn’t get 19 leading zeroes. Well, that’s expected. He changes it again. And again. And again…

This takes an incredibly long time. So, to speed this up, miners will purchase tens, hundreds, of specialized computers: a mining farm. All to run this hash function keep changing the nonce, which ends up consuming all of this energy.

It’s done. James has gotten an acceptable hash. He publishes the block to the blockchain. Now everyone else can review the block if they want. They check if the transactions are valid, the hash has the right number of zeroes at the start, the hash is a 64-digit hexadecimal number, etc. It’s been verified, and the block is added to the chain.

You soon receive the 0.01 Bitcoin from Jeff, all thanks to James and the other miners who validated the block.

But at what cost?

Proof Of Stake

Becoming A Validator

The process of becoming a validator is fairly simple. First, you need to stake something. That something is 32 ETH, or CAD 55,648! Then you must be able to run 3 different software: an execution, consensus, and a validator client.

You will submit your ETH on a smart contract, and if it is discovered that you were committing fraudulent acts, some or all of that ETH can be destroyed. You will be put on a waitlist, to prevent too many validators on the network. And soon enough, your software will be activated and they can start validating and proposing blocks!

Propose And Review

Whenever a new round of validation starts, a new epoch is created. An epoch lasts 6.4 minutes and consists of 32 slots, each 12 seconds long. One block can be created per slot, by a ‘committee’ of 128 validators. A single validator is chosen to create the block (at random) and the more ETH you stake, the higher chance you are chosen. Like the lottery: the more tickets you buy, the higher your chance of winning. Then, they’ll send the block to the other nodes in the network, and the other 127 validators in the committee will vote on it. The more ETH you stake, the higher chance you are chosen. Like PoW, you will get rewarded with crypto.

(Note that if you want only want to be a validator, you won’t have to stake any ETH and you can still join the network. Only when you want to propose blocks and be rewarded, then you must stake the ETH).

Finality

Finality is achieved when a block is immutable. To achieve immutability in PoS, something called a checkpoint block is used. The first block of every epoch is a checkpoint block. Validators can vote for a pair of checkpoints that they consider to be valid or legitimate.

For the pair of checkpoints to be “upgraded” to “justified”, more than 2/3 of validators must vote in favor of the block. This now makes the epoch justified as well. If there are two justified epochs (in a row), the third last epoch (current epoch — 2) becomes finalized and it is said that all the blocks in said epoch are considered legitimate and that the epoch is now immutable.

What if a block is missed though? The system doesn’t care if an epoch isn’t finalized as it trusts that no suspicious transaction would be verified. However, if it notices that 4 epochs have passed and still none have been finalized, it will start punishing validators until another couple of epochs are finalized again.

The Merge

When you think of PoS compared to PoW, it seems there is a much more logical choice. PoS. It cut Ethereum’s energy usage by 99%, and it makes much more sense. Why do you need to run trillions of hash functions, all to get some random 64-digit hexadecimal number that needs to start with 19 zeros? Well, that’s the system that Satoshi Nakamoto came up with.

There isn’t exactly a reason to use PoW. Bitcoin and every other cryptocurrency, (after they’ve finished coding) could theoretically, switch to PoS. However, miners have already invested so much into all of their equipment and paid so much in electricity bills, all for something that’s technically not even real money. If they changed to PoS, it could cause an uproar in the community.

Then why did Ethereum change?

Simply put, they had to. Ethereum is more than just a cryptocurrency. With Ethereum, anyone can create their dApp and smart contracts. Ethereum has DeFi. You can integrate Ethereum into your enterprise. It has many many uses and many many users.

All of this means a lot of transactions coming from a lot of different places. In fact, there are more transactions on Ethereum (~1 million) daily than on Bitcoin (~300k) and on Dec 9, 2022, Ethereum hit a record of nearly 2M transactions in a single day! And that number will increase with time. More transactions, mean more blocks, more miners competing, more blocks being added, more energy usage, and more everything!

Ethereum Transaction History

As I said, the Ethereum blockchain is the foundation for all of these dApps, DeFi, and all the other cryptocurrency projects running on Ethereum’s blockchain. And now that transaction times and fees have increased greatly, Ethereum is becoming less and less viable.

Until the merge. On September 15, 2022, The Merge was executed. Proof of work is no more, and proof of stake is the new way of verifying transactions.

The Ethereum Mainnet was using proof of work. However, the Beacon Chain (a separate blockchain) which was running in parallel with the Mainnet, was using proof of stake. When Ethereum decided to merge they had a choice, keep PoW or go with PoS.

The Backlash

Some people weren’t happy with the Merge, as you can imagine. One argument was, of course, the depreciation of ETH mining farms, but there is always the option to switch to mining a different cryptocurrency. Another big thing was gas. Gas fees. A gas fee correlates to how much capacity the network has. A fee that you must pay for using up the network’s capacity. Although the system switched from PoW to PoS, that was a change of consensus mechanism. It didn’t actually increase (or decrease) the capacity of the network that much. So, not much to argue about.

But when you look at the positive side, you realize there are more pros than cons.

Which is great for everyone! Including you! (And you might not even be involved in cryptocurrency…)

--

--

No responses yet