As you are probably aware, we are on the verge of an Ethereum revolution, colloquially known as ETH 2.0. This upgrade is going to bring in a lot of innovations to the popular Ethereum protocol.
We have covered two of the most significant changes - Casper and Sharding - in detail before. In this guide, let's cover another exciting innovation that is going to give the overall scalability a significant boost - Ethereum layer-2 scaling.
Numerous sources have very extensively documented Ethereum's scalability problems. Decentralized cryptocurrencies are inherently non-scalable due to their design issues. Ethereum does around 25 transactions per second, which is pretty abysmal but still marginally better than Bitcoin, which can only do seven transactions per second.
This low transaction throughput happens because of the amount of time it takes to validate and put in a transaction within the block.
The transaction validation and fulfillment process is extremely sequential in Ethereum. For example:
Now, these are just theoretical mechanics. We still haven't even considered the "gas" factor. Long story short, "gas" is a metric used to decide how much fees it would take to execute a particular transaction. These gas fees are collected by the miner, who then proceeds to add the transaction. This is where we hit our next bottleneck.
The chart above shows the average gas price since November 2019. While the average price is pretty consistent, there are some noticeable spikes in price. This is noteworthy because you need to put in a certain amount of gas within your transactions to incentivize miners to put them inside their blocks. This is why wealthier users can bloat their transactions with high gas fees and get more preference from the miners.
Hence, if you just pay the standard gas price, your transaction can take anywhere between 15 seconds to 5 mins to process a transaction.
Orphan blocks are empty blocks in the blockchain that contain no data whatsoever. Some of the best mining pools in Ethereum also end up having a 1-2% orphan block rate. These empty blocks create an extra time lag on our transactions, which reduces the probability that they will be included in a block. As a user, the worst part about this experience is that your transaction can get delayed for factors entirely outside your control.
The lack of scalability is the biggest obstacle for mainstream adoption. After all, why will people opt to transact with cryptocurrencies when they can't enjoy instant fulfillment. This also makes it highly impractical for microtransactions. Eg. Imagine that you have an agreement with your milkman wherein you pay them 25 cents for each liter of milk delivered every single day. Now, let's say that you want to make your relationship completely digital and make the payments only with cryptocurrencies. This will be a problem because the gas fees associated with each microtransaction will make it highly impractical.
There is another big issue we must consider.
The underlying Ethereum blockchain isn't well-equipped to handle high-value smart contracts. In fact, we have seen this play-out first-hand with the cryptokitties fiasco. The cryptokitties game became so popular that the underlying blockchain simply couldn't cope with demand. As such, Ethereum got bloated, and the number of pending transactions went through the roof.
So, as you can imagine, we needed to resolve the scalability issue as fast as we possibly can. The crypto community as a whole is working on two schools of techniques - layer 1 and layer 2.
One of the biggest problems that Bitcoin and Ethereum face is blockchain bloat. As more and more users enter the crypto space, the number of transactions fulfilled is only going to go up. This will bloat the blockchain, making it harder for individual nodes to download and maintain the whole chain. As such, nodes will need to invest in expensive hardware to store the extra data.
One possible solution here to increase the block size itself. However, the block size debate can get very long and drawn out, splitting up the community in the process as we have seen with the Bitcoin and Bitcoin Cash.
This is why ETH 2.0 is looking to delegate more complex operations to layer 2 protocol, keeping the base blockchain as activity-free as possible. Ethereum layer-2 scalability can be achieved with the following methods:
Raiden is similar to Bitcoin's lightning network in the sense that they are HTLC state channels as well. You can think of state channels as a two-way communication channel between users. This allows the network to conduct standard on-chain transactions, off the chain. This is especially helpful for microtransactions since it gives users a way to conduct these without having to commit each and every one of those to the blockchain
Now, this brings us to the next question…
While there are many kinds of state channels out there, the most common form happens to be hashed timelock contracts (or HTLCs). HTLC allows users to transact directly with each other before a pre-agreed deadline by submitting cryptographic proofs.
So, how does your general HTLC transaction work? Let's take a look. Imagine Alice and Charlie want to transact with each other, through their shared connection in Bob.
Raiden is an Ethereum layer-2 solution. Unlike the Lightning Network, Raiden isn't just a simple payment channel. You can transfer smart contract details, as well. As per Brainbot, the company behind Raiden, says that Raiden will be a mesh-like structure laying on top of Ethereum.
Trust us when we say this, that meme is so accurate that it is scary. Plasma is a network of blockchains built on top of the base root blockchain. To paint yourself a mental picture, think of the main chain as the root of a tree, and the plasma chains as the branches.
Image credit: Hackernoon
Following is how a normal court structure works:
Image Credit: Duke Law
So, in our typical court structure, the Supreme Court acts as the root chan, while your Criminal and Civil courts serve as the plasma chains. Each of these plasma chains has its own plasma chains. So, now think about how the whole structure works:
Plasma was formulated by Ethereum co-founder Vitalik Buterin and Lightning Network co-founder Joseph Poon. The design goals of plasma are as follows:
Now, let's look at how the whole system works. MapReduce is a very well-known programming model that allows you to process and create big data sets via a parallel, distributed algorithm. As the name suggests, there are two parts to MapReduce:
To understand how this works, let's take an example. Alice needs to submit a report on how Ethereum works. She hands the article over to Bob. Bob then assigns Charlie, David, and Eric specific tasks. Charlie needs to write on how mining works, David has to show how Ether's tokenomics works, while Eric has to come up with a future projection for Ethereum.
Finally, let's see how Map/Reduce works in the context of blockchains and plasma.
Image Credit: Trust Nodes.
Finally, let's look at one of the essential aspects of plasma chains – dispute resolution.
Let's look at the following diagram to understand how it potentially works.
To get a diagrammatic version of this incident, look at the following image:
Decentralized exchanges can benefit immensely from Plasma integration. Let's take a look how:
With layer 2 integration, ETH 2.0 will enjoy immense scalability and interoperability. As mentioned before, scalability and interoperability are the two most significant pain points in the crypto space. With Ethereum layer-2, developers have the rare opportunity to kill two birds with one stone. Plus, the sheer number of use cases and utility that Raiden and Plasma will bring in is significant, to say the least.
Do you want to know more about how Ethereum 2.0 works? Do you want to know about how the blockchain in general works? If yes, then do check out our blockchain courses. We have the absolute best resources in the world that will give you all that you need to educate you and make you extremely proficient in this space.
Get to work in a fast growing industry. Start learning blockchain together with our 20,000+ students today.
Use coupon code BLOG20 for 20% off.