Key Takeaways:
- EVM is a software engine in charge of executing and deploying smart contracts and decentralized applications using Solidity.
- EVM is a virtual computer that is run by a network of real computers. These computers put together different kinds of smart contract code into a format called Bytecode that can be read.
- Layer-2s take care of security by using Ethereum’s security protocols.
A layer-2 is a scaling solution designed to enhance a blockchain’s scalability by taking transactions off the main chain and executing them in the Layer-2s chain, then sending the transaction data back to the main chain.
This layer-2 guide will explain to you some of the most popular scaling solutions out there and hopefully answer some of your questions regarding this technology. But this is a technical topic, so let’s quickly review a few key ideas that we’ll use throughout this article.
- Layer-1: a blockchain platform wherein users can transact cryptocurrency and even create blockchain applications (also known as decentralised applications (DApps)) using the platform’s smart contracts. A layer-1 is also called the base layer, mainnet, main chain, etc.
- Layer-2: a chain built on top of the main chain. A famous example is Polygon, a layer-2 built on Ethereum’s open-source infrastructure, inheriting its security properties. Polygon is EVM-compatible (we’ll explore this topic below), letting developers move their projects from the Ethereum blockchain to Polygon and vice versa.
Note: often, people confuse sidechains with layer-2s, but this is incorrect; sidechains are separate chains that can be compatible with a specific blockchain, like Ethereum, and are connected to it via a two-way bridge. Sidechains are independent, have their own security properties, and unlike layer-2s, they can be used for anything.
What is the Ethereum Virtual Machine (EVM)?
The Ethereum Virtual Machine (EVM) is the heart of the Ethereum ecosystem. It is a software engine in charge of executing and deploying smart contracts and decentralized applications using Solidity, Ethereum’s high-level programming language.
Think of EVM as the BitTorrent of crypto, a file-sharing protocol that, to shut it down, you’d have to destroy every computer in existence. Likewise, EVM is a virtual computer maintained by a network of physical computers that compile different types of smart contract code into a readable format called Bytecode.
Some popular blockchain applications built on EVM are:
- NFT marketplaces like OpenSea,
- Crypto ledgers like MetaMask,
- Blockchain/NFT games like Axie Infinity, and
- DeFi platforms like Compound or Polygon.
Layer-2s, Layer-1s, sidechains, and other types of blockchain platforms and protocols are compatible with the Ethereum network since they are recognized by Ethereum nodes, allowing them to move projects back and forth.
Why Are Layer-2s Necessary?
A popular topic in the crypto community is the blockchain trilemma: how can a blockchain network balance decentralisation, scalability, and security harmoniously? If a network aims for decentralisation, it chooses security and sacrifices scalability; if it chooses scalability, it sacrifices security. In other words:
- Decentralization means giving people who validate and process blocks in the blockchain power. This eliminates the need for a middleman. More than half of the network’s nodes are required to process transactions, and the more nodes, the more decentralised a blockchain is.
- But the more decentralised a network is, the more time it takes to reach to an agreement because transactions would need confirmation from several validators and thus making transaction time slower. The amount of weight each bit of data contains becomes heavier as more traffic is added to the network. Further, data needs to be optimized and up to date to keep the system up and running. Ideally, network nodes would add more computing power to process transactions.
- But if nodes focus their computing power on processing transactions, there’s less computing power to enhance the network’s security. Therefore, one solution is to limit how far the network can be expanded to maintain security.
- The problem with limiting how the network spreads is clear: less decentralization and less scalability, and malicious nodes have a greater chance of taking over enough of the network, something called the 51% attack.
Some people in the crypto community might think that the inability to achieve a balance between the three core elements that would embody a perfect system is a flaw in blockchain technology. However, multiple blockchain platforms and developers are working to improve the blockchain ecosystem and solve this challenge. One solution is layer-2s.
Layer-2s take care of security by using Ethereum’s security protocols. As we previously said, they take transactions off the Ethereum main chain and execute them on their own chains. Once computed, the transaction data is sent to validators in the main chain to verify it and post it on Ethereum as a confirmed transaction.
There are multiple layer-2 solutions. One of the most famous technologies is rollups.
Exploring Ethereum Rollups
Rollups are scaling solutions that mix the best sidechains and layer-2s by creating an application capable of running smart contracts on Ethereum while using the network’s security. We have two main types of rollups: optimistic and zero-knowledge rollups.
Optimistic Rollups
Optimistic Rollups are protocols with their own set of validators who take transactions off Ethereum, execute them on the protocol’s chain, generate a proof of data, wrap transaction data in various batches to send it to Ethereum.
Optimistic Rollups have their pros and cons. An upside is that they can improve transaction throughput 10x – 100x and they’re usually cheaper than other layer-2s. However, an optimistic rollup assumes that the submitted data is correct, hence the name Optimistic. But if a validator submits a batch of unreliable data, it has to go through a “dispute resolution period” to review and correct the state of said transaction, consequently causing a system delay.
Optimism and Arbitrum
Two Optimistic Rollups dominating the market in 2022 are Optimism and Arbitrum One. Both protocols have achieved over $1 billion in market capitalization.
Note: Arbitrum One does NOT have an official token – beware of scammers.
They have their fundamental differences. For instance, Arbitrum has a multi-round fraud proof process executed on layer-1 while Optimism has a single-round fraud proof executed off-chain.
Arbitrum has its own virtual machine, the Arbitrum Virtual Machine (AVM) which supports all programming languages on EVM, while Optimism is EVM-compatible, so it only supports Solidity.
Optimistic rollups allow developers to create their own rollup chains. In the case of Arbitrum, they’re called ArbChains, which can communicate with Ethereum using a bridge. Additionally, Arbitrum gives each chain their own AVM to compute transactions and store data.
Zero Knowledge Rollups
Zero Knowledge (ZK) rollups differ from optimistic rollups in the way they generate fraud proof and compute transactions. ZK rollups are usually faster and can support up to 1000 TPS.
A ZK rollup takes transactions off Ethereum, sends them to the layer-2’s chain, execute the transactions, and unlike optimistic rollups, sends the data back to layer-1 in a whole batch.
ZK rollups do not suffer from dispute-resolution since they verify and correct all outgoing transactions. Naturally, they have their cons: ZK rollups require high computing power to maintain them and therefore are usually expensive.
Validiums
Validiums are layer-2 frameworks that work very similarly to rollups. More technically, they are EVM-compatible chains that can drastically increase throughput (up to 9,000 and more TPS) and lower gas fees.
Validium protocols use Validium proofs, which are similar to ZK proofs as they wrap up transactions in batches and submit them to Ethereum in a single transaction. Users’ funds belonging to Validium are stored in a smart contract in Ethereum, which is controlled by the protocol. This is a major downside if network operators decided to take control of off-chain data.
To withdraw funds, users must provide Merkle proofs —which are represented by a leaf or branch hash within a Merkle hash root.
State Channels
State channels are more simple: they are two-way pathway protocols attached to Ethereum and conduct transactions off-chain, then reporting the operations back to the main layer. State channels are widely used to perform any amount of crypto transactions, but they are considerably expensive and need to be periodically checked and maintained.
Closing Words: The Future of Scaling Solutions
Ethereum’s transition to proof-of-stake won’t automatically make the network faster and cheaper. This transition only means that it has implemented a new infrastructure for block production, reducing energy consumption by over 95%, and lays a pathway for further scalability upgrades otherwise not achievable with proof-of-work.
This is why Layer-2s will remain a key player for the Ethereum ecosystem. And even though 2022 has been a brutal year for crypto investors and companies, a lot of money is being poured into this technology, alongside web3 and NFT-based platforms.
Check out other Research!
Get to know more about NFT and tutorials at OmniMint. For more information on OmniMint, and details on how to join our community, please follow our Twitter, or subscribe to our Telegram channel for more updates and please feel free to submit your article.