Why I’m optimistic about Ethereum Scaling

0
33

Anyone who has interacted with the Ethereum network in the last few months will know first hand that it is experiencing some serious scalability issues. Ethereum’s proof of work consensus algorithm utilises relatively slow and inefficient brute force computation and the combined effort of all network nodes can only generate one block at a time. This is why the Ethereum network can currently only reach speeds of around 16 transactions per second. Add to this, the unprecedented demand for block space caused by the current decentralised finance (DeFi) movement and you can see why the current network infrastructure is no longer fit for purpose.

Ethereum Transaction fees

Any time a user wants to transfer funds between wallets or interact with one of the many smart contracts available, the Ethereum network must reach a consensus on the validity of the transaction and add it to a block. However, before this can happen, submitted transactions have to wait in what is known as the mempool. Miners look through this mempool and choose which transactions to include in the next block. Users publishing these transactions are able to define a fee (specified in gwei, a denomination of eth) that they are willing to pay to the miner to get the transaction included in the next block. In the Ethereum network this fee is known as gas. Offering more gas in a transaction incentivises miners to select your transaction over others. In times of high network congestion this inevitably results in users bidding up the gas price in order to get their transaction confirmed quicker. This also explains why transactions with low gas can take several hours to complete.

The upcoming Ethereum 2.0 upgrade contains various updates designed to address these issues. However, it is still in development and is some way off completion. Thankfully, there are various companies implementing different scaling solutions (layer 2), which effectively run on top of the Ethereum main chain (layer 1). The common idea behind these scaling solutions is to allow transactions to occur separate from the main Ethereum chain but still leverage its security by anchoring the state there. Current solutions fall into three categories: state channels (more specifically, payment channels), plasma chains and rollups. This article attempts to provide a high level overview of what these are and what they can do for the network.

Payment Channels:

The first scaling solution I would like to discuss are payment channels.

A payment channel is basically an agreement between two participants, where the sender deposits a number of tokens in a smart contract on the Ethereum main chain. Direct peer-to-peer payments can then occur off-chain through the exchange of private messages that digitally sign a transfer of value between the two participants. Because these exchanges happen off-chain they do not require computation resources in the Ethereum network and are basically free. Once the participants have completed their business and want to withdraw the funds due to them, the smart contract examines the last signed message and settles the claim on the main chain. Any remaining tokens in the deposit, not pledged to the receiver, will be returned to the sender.

Although transactions in a payment channel are essentially free, a gas fee will need to be paid to the Ethereum miners upon the opening and closing of the channel. Furthermore, payments can occur in both directions through the use of bidirectional channels, which require both participants to deposit tokens in the Ethereum smart contract. Peer-to-peer payments can also occur between two participants who are not directly connected via a payment channel. This is achieved through the use of multi-hop transfers. One example of a project working on this kind of solution is the Raiden Network.

Payment channels are what they say they are. They are great at facilitating fast, cheap peer-to-peer micro payments between two participants. Unfortunately they do not support smart contracts and as these are responsible for the majority of the network demand today, payment channels will not provide the scaling required.

Plasma Chains:

A Plasma chain (aka a child chain) is basically an Ethereum-compatible, independent blockchain, which is accessed via smart contracts (known as bridges). An example of a project implementing this approach is the OMG network. In theory, there can be an unlimited number of plasma chains running parallel to the Ethereum main chain and each of them can operate independently and serve different needs. Furthermore, additional plasma chains can be built on top of these chains, resulting in a tree type structure.

Plasma chains operate using their own consensus mechanisms, supported by their own network of validator nodes. Transactions within the network are extremely fast and cheap, as consensus computation occurs outside the Ethereum network. All transaction data is stored in the plasma chain and periodically batched and published to the main chain in the form of a Merkle root. At this point asset owners also receive a proof of ownership. As plasma networks generally have less validators nodes than Ethereum, there is a higher degree of centralisation. As such, it is much safer to assume that a plasma validator node cannot be trusted. Thus, to withdraw an asset, a user will need to publish their proof of ownership and initiate a challenge period of between 7 and 14 days, during which the asset is locked. This period gives other network participants the opportunity to submit a conflicting proof that disproves the claim on the asset. If a plasma network validator is proven to have acted dishonestly, the transaction in question will be reverted and the validator will face a financial penalty. If no valid dispute is raised during the challenge period, the user can successfully withdraw the asset. Although this wait time is far from ideal, it does ensure that honest participants will be able to withdraw their assets, even if the validators on the network try to launch some sort of adversarial attack.

Plasma chains have a flaw however. The game theory behind why they are secure relies on the concept of an object having a logical owner. From Vitalik’s blog:

If that owner does not care about their asset, then an “invalid” outcome involving that asset may result. This is okay for many applications, but it is a deal breaker for many others (eg. Uniswap).
Vitalik Buterin

For example, systems the require the state of a user-owned object to be updated without their consent, such as increasing their account balance, will not work well on Plasma. Certain applications are able to work with this limitation by implementing “application-specific logic”. However, this does not allow the creation of a more general, open-participation system, like for example, simulating the Ethereum Virtual Machine (EVM).

Rollups

Rollups share some similarities with plasma chains. They require a separate blockchain to offload computation duties to, they interact with the Ethereum main chain via smart contracts and they periodically batch (rollup) transactions and publish them to the main chain. However, unlike plasma chains, rollups are considered a hybrid layer 2 solution. To be considered fully layer 2, all computation and all transaction data should be moved off the main chain. In contrast, rollups move all computation onto the layer 2 blockchain but keep the transaction data on the Ethereum main chain. Through a combination of off-chain computation and clever on-chain data compression, network demand and hence transaction fees on rollups can be drastically reduced.

Having data readily available on the Ethereum main chain allows the network to more easily reach a consensus on the validity of a rollups contents. This limits the damage a malicious off-chain validator node could inflict by either withholding or altering transaction data. In addition to this, on-chain data availability negates the need to map owners to assets like we see in plasma chains. This allows rollups to be much more general purpose and even makes them capable of simulating the EVM. This is game changing, as existing DeFi applications like Uniswap, Synthetix or Aave can migrate over with minimal effort.

ZK-Rollups

There are two types of rollups, zero knowledge (zk-rollups) and optimistic rollups. Zk-rollups make use of a relatively new area of cryptography called zero-knowledge proofs (ZKPs). In very basic terms, these provide mathematical proof that the underlying data is valid without actually having to reveal the specific data. ZKPs do not provide any scaling functionality but they do add a much needed element of privacy. Unfortunately in their current form, ZKPs require excessive computation making them unsuitable for use at scale, so this solution is unlikely to alleviate the immediate issues experienced by the Ethereum network. However, as ZKP technology is developed and refined over the next few years it is likely we will see zk-rollups become a fundamental part of the Ethereum infrastructure. One company that already has a working product is Loopring.

Optimistic Rollups

The second type of rollup, and potentially the most interesting layer 2 solution at the moment, is an optimistic rollup. They differ from zk-rollups in the way they deal with invalid transactions. Zk-rollups use ZKPs to ensure all transaction data is valid before it is published to the main chain. In contrast, optimistic rollups make an assumption that all data is valid until proven otherwise. In other words, they are ‘optimistic’. Like plasma chains, when a rollup is published to the main chain a challenge period is initiated and the asset is locked. If a fraud proof is submitted during this challenge period and the Ethereum network deems the challenge to be valid, the transaction in question is reverted and the validator responsible will be punished. If no challenge is made, then the assets may be withdrawn at the end of this period.

One company developing such a solution is Optimism. They plan to implement an Optimistic Virtual Machine (OVM), which for all intents and purposes, is the same as the Ethereum Virtual Machine. This means it supports any smart contracts currently running on Ethereum. This has been in development for a few years and is set to launch on the Ethereum main chain very soon with some big names backing it. A number of existing applications have already built demo versions on the Optimistic testnet. For example, Synthetix, a synthetic asset exchange on Ethereum, recorded a x143 reduction in network transaction fees and confirmation times of only 0.3 seconds. Uniswap have also developed a demo with equally impressive performance. Furthermore, Coinbase have integrated their wallet with the Optimism testnet, so as soon as the mainnet launches they will be fully compatible. Furthermore, Vitalik Buterin the creator of Ethereum, is very supportive of the project and has written about the benefits of rollups before.

To conclude, there are many projects attempting to scale Ethereum in various ways in order to capitalise on the current gas fee crisis. Payment channels work pretty well for making numerous micro payments between two users. Plasma chains also provides scaling for some applications but are not fully general purpose. Rollups are looking very promising but until zero knowledge proof technology can be implemented effectively at scale, optimistic rollups will likely take centre stage in the Ethereum layer 2 scaling narrative. The ability for existing applications to easily migrate over will likely drive its adoption and drastically enhance the user experience.

Thanks for taking the time to read this post. A lot of work and research goes into writing these articles, so if you have found value in what you have read leave me comment and let me know.

Sources:


Why I’m optimistic about Ethereum Scaling was originally published in Coinmonks on Medium, where people are continuing the conversation by highlighting and responding to this story.