Author

Topic: A Short Guide to Scaling Ethereum – Part Two (Read 54 times)

legendary
Activity: 2618
Merit: 1505
February 24, 2022, 06:02:15 AM
#2
It was announced that zkSync 2.0 was launched in the Ethereum test network as the first EVM-compatible second-level (L2) solution based on ZK Rollup technology, which allows you to create and deploy decentralized applications in a scalable environment with low fees.

Source: https://matterlabs.medium.com/zksync-2-0-public-testnet-is-live-de870ba9632a
jr. member
Activity: 224
Merit: 1
In the first (https://numio.one/a-short-guide-to-scaling-ethereum-part-one/) of this two part series, we shared information about the data retention and computation behind some Ethereum scaling solutions. In this second piece, we are going to be breaking down how they actually work, and what it means for these solutions in production.

Types of Ethereum scaling solutions:

    1. Optimistic Rollups
    2. zkRollups
    3. Validium
    4. Plasma
    5. State Channels
    6. Sidechains

The number of scaling solutions that have been developed over the course of the last three years is absolutely incredible. The Ethereum ecosystem is thriving, and the R&D is able to back it up!

Jumping into the scaling solutions, in no particular order, we will begin with Optimistic Rollups.

Optimistic Rollups

Optimistic Rollups are quite useful when it comes to scaling, as they allow people to migrate solidity smart contracts from Ethereum directly into the OVM (Optimistic Virtual Machine), by using the EVM (Ethereum Virtual Machine). This is a scaling solution that stores data on-chain, and uses fraud proofs to compute data. The operators of the ORU (Optimistic Rollup) create Ethereum transactions of the state (assets people currently hold in the rollup, and the transactions that are occurring) and publish them publicly onto Ethereum. The best way to imagine the concept behind an optimistic rollup isn’t necessarily being “optimistic” around the data/state being pushed on-chain, we actually have to be pessimistic about it! Challenges are required to be made on Ethereum mainnet to challenge the state of the data where the challenger posts a “bond”. It will be interesting to see how this develops with increasing cost of gas on Ethereum- will amounts that require a challenge, where data disputes are currently less than the transaction cost, be challenged?

The main disadvantage, or risk, of Optimistic Rollups are the exit periods (2 weeks with PoW  [Proof-of-Work], & 1 week with PoS [Proof-of-Stake]) due to the Dispute Time Frame. This dispute time frame is a variable, and can easily be changed, but the time that is chosen weighs both the security of the rollup and user experience for exiting. Watchers can potentially censor transactions if there aren’t enough legitimate validators in the ecosystem. Scalability is generally slower compared to the other scaling solutions. Privacy solutions are not necessarily possible on Optimistic Rollups, but could be built out on top of it as a L3 (Layer-3) solution. Optimistic Rollups have recently launched onto mainnet.

Pros: Solidity smart contracts are immediately able to migrate to OVM (Optimistic Virtual Machine), & EVM is portable. Scales with Ethereum baselayer. Recently launched on mainnet.

Cons: Long withdrawal periods with fraud proofs. No support for NFTs yet.

zkRollups

A zkRollup stands for a zero-knowledge rollup, and in the most simple sense, it batches transactions onto Ethereum. Most people can understand a zkRollup as a “Validity Rollup” because we can validate all of the data inside of them. For computation, zkRollups primarily use zkSNARKs (a version of zkProofs), and can also use zkSTARKs, and the data availability is stored on-chain, also known as “on-chain data availability” (OCDA).

A great analogy to understand how a zkRollup operates is similar to riding in a train versus driving a car. A train is able to pick up a bunch of passengers (transactions) who are all going to the same location (where this data is pushed onto the Ethereum mainnet). The train stops at different locations and picks a bunch of new passengers up (new transactions into the rollup), and once the train is entirely full, it reaches its location, and all of the passengers leave (transaction gets pushed onto the Ethereum mainnet). A car on the other hand is able to fill up their tank entirely, and get to the same location, but it just costs significantly more (similar to making a mainnet transaction on Ethereum).

Onchain Data Availability means that the operators of the rollup are able to give breadcrumbs from the L2 (layer-2) about what is occurring within the smart contract directly to the Ethereum L1 (layer-1) allowing for people to easily access their money if the L2 network operators shut off or have some type of issue. zkRollups use zkSNARKs or zkSTARKs for computation (for the most part- some are using more advanced cryptographic primitives like, PLONK or other ones, like Groth16). Previously, one of the main disadvantages for zkRollups is that you were not able to port the bytecode of the EVM, which is not “necessarily” the case any longer. Now, the only main disadvantage would be that you may need to learn a new coding language to migrate or build smart contracts depending on what solution you use.

Pro: Already on mainnet. Scales with Ethereum. Private tx’s are an option in the future (SNARKs). No possibility of funds being stolen from validators going down. Fast withdrawal times.

Cons: In some solutions, a new smart contract language may be required to be learned to deploy current Ethereum contracts into the Rollup. Time to finality is currently about 20 min, but will improve over time. EVM is not currently portable (it will be over time), but solidity contracts will be portable very soon. No support with NFTs yet.

Validium

Validium is a “zkRollup style” scaling solution, where data-availability is, instead, stored off-chain, and uses zero-knowledge proofs (SNARKs or STARKs) to compile data and store it in the cloud.

Pros: High throughput. Supports smart contract functionality. Fast withdrawal periods. Can build in privacy features. Can support NFTs.

Cons: Quorum of validators are able to freeze or confiscate funds.

Plasma

Plasma received a ton of recognition back in 2017 when their whitepaper was originally created by Vitalik Buterin and Joseph Poon. It is an incredible technology that showcased how we were going to be able to increase throughput on top of Ethereum. With regards to how Plasma networks actually function, the data is stored off-chain, secured by watchers (guaranteeing liveness), and use Fraud Proofs to compute and verify data between the plasma chain and root chain. With regards to consensus of these networks, they can use a variety of consensus mechanisms (PoW, PoS, and PoA [Proof-of-Authority]). Currently, the more widely used mechanisms are PoS & PoA.

The concept of Plasma is incredibly useful for products that are structured to operate with extremely high throughput products like DEXs due to its ability for atomic swaps, and incredibly fast finality periods.

The main disadvantage or potential “risks” of Plasma are the exit periods (1-2 weeks) from disputes, mass exits, the watchers can potentially censor transactions, and EVM bytecode is not portable in any cases. The last point means, that smart contracts are not able to work with plasma chains.

Pros: Very high TPS, and cost of transactions are extremely low. Already on the mainnet. Less data needs to be stored by nodes on Ethereum. Time to finality is seconds.

Cons: Smart contracts are not functional. Long wait periods to exit (fraud proofs), & the mass exit problem. Requires a watcher.

State Channels

State channels first got their recognition a few years ago when the core developers on the Bitcoin network were creating a plan on how to more effectively scale the Bitcoin Network- this was through what is now known as the Bitcoin Lightning Network, an early form of a State Channel. Funds are opened up by submitting an onchain transaction, locked into a mutli-sig account, or some type of contract, and when you want to leave the channel, you pay a transaction, and submit the current state of the channel when moving back to Ethereum’s mainnet.

A good example to understand how state channels work is like you are going into a market with a bunch of vendors. To enter the market, it costs a fee (Ethereum transaction), and then once you are inside the market, you are free to make transactions as you please (these are all without fees). Every time you make a transaction, it changes the “state” (what the data can be observed as). You are able to make as many transactions as you would like inside the market, but if you want to leave the market (exit the state channel), it will require a fee. At this point in time, you are publishing an updated version of the state, which communicates the “state of data” inside of the state channel.

One of the biggest benefits for a state channel is how you are able to have not only instant finality, but there is little to no cost for facilitating these transactions. There isn’t necessarily a “cap” in terms of how high these solutions can scale, but in many cases it is in the hundreds of thousands tps, or potentially higher. You have to pay to create your entrance to the channel, and when you are ready to leave, your data is then submitted onto Ethereum and signed the same way a normal transaction would.

An issue with State Channels, similar to Plasma, is the requirement of a watcher (requiring someone to make sure data is available 24/7).

Pros: Instant finality, and incredibly high transactions per second (higher than any others), cost of transaction is little to none, and the withdrawal process is very efficient. Can support NFTs. Great for micropayments.

Cons: Not capital efficient, requires a separate tx to create new state channel accounts, liveness requirement (needs a watcher). Smart contracts are not possible.

Sidechains

The differentiator between the topics described above, and a “sidechain”, is that a sidechain can, by itself, operate without the need of Ethereum’s baselayer. Sidechains are used as “base layers” in of itself (similar to how Ethereum operates on its own) and can function as a scaling solution, or a bridge, outside of Ethereum. There are a variety of solutions that can be used here, which all bring their own benefits and risks. Sidechains are pretty much all more scalable and “cheaper” than Ethereum, and can even support smart contracts, as many are EVM compatible. The biggest advantage, especially in the short term, for sidechains is that they are ready, and available, right now, to be used and implemented for a variety of things.

The risk that you face with using a sidechain is you are not only reliant on the Ethereum base layer to be secure, but also the new sidechain, which may be at risk of a crypto-economic attack, or just not enough validators to keep it “secure”. The data availability for all of these networks are stored “off-chain” (as they are not on Ethereum), and all have their own forms of consensus and security (too many of them to list on this article!).

It is also extremely important when looking at using a sidechain how the bridge operates. This can create an added layer of risk/complexities that many don’t bring into consideration as many of them are centralized. In many cases, the bridges are run by the same providers as those running the nodes. Make sure to ask your bridge provider (typically the project) how it works, who runs the bridge(s), and to disclose any potential risks involved.

Pros: Very high throughput. EVM is almost always portable. Smart contract functionality can be supported. No data is required to be stored by Ethereum nodes. Already on mainnet.

Cons: More susceptible to “crypto-economic attacks” (e.g. 51% attack, as compared to Ethereum). Security is a concern since the hash power and decentralization is different than that of Ethereum (e.g. hot wallet exploits/funds getting locked). Does not scale with Ethereum baselayer.

Disclaimer: The Numio team is building our application with zkRollups (zkSNARKs), specifically using the zkSync implementation.

If there are new solutions put into development moving forward, please let us know so we can investigate and research how it works.

References:

https://z.cash/technology/zksnarks/

https://medium.com/aztec-protocol/plonk-benchmarks-2-5x-faster-than-groth16-on-mimc-9e1009f96dfe

https://hackernoon.com/difference-between-sidechains-and-state-channels-2f5dfbd10707

https://www.plasma.io/plasma.pdf

https://medium.com/matter-labs/zksync-is-live-bringing-trustless-scalable-payments-to-ethereum-9c634b3e6823

https://docs.ethhub.io/ethereum-roadmap/layer-2-scaling/zk-rollups/
Jump to: