A closer look into how Layer 2’s work and what we can expect from future Protocols
What are Layer 2’s?
If you’re familiar with Ethereum, then you’ve probably come across the term ‘Layer 2’. But what does this mean? Essentially, Layer 2 refers to a powerful extension of Ethereum’s Layer 1 protocol, consisting of separate blockchains dubbed ‘Ethereum scaling solutions’. These innovative protocols offer the best of both worlds by enabling Ethereum to maintain its high decentralization and security standards while facilitating scalability.
In order for them to uphold these high standards, a L2 protocol regularly communicates with Ethereum by submitting batched transactions. This process does not require any major changes to Ethereum’s L1. Instead, L2s handle the transactional workload and post finalized proofs back to L1. By doing so, they alleviate the transaction and data storage load, making the base layer less congested.
When delving deeper into Layer 2 protocols, you’ll discover that many of them utilize a process known as ‘Rollups’. This method is highly advantageous, significantly reducing gas fees for users. Rollups work by grouping large batches of transactions on Ethereum’s Layer 1 and distributing the fees amongst the participating users in that specific rollup. This results in an overall reduction of fees for everyone involved due to the overall transaction being sent is smaller than the sum of the individual ones.
There are two primary types of rollups: optimistic and zero-knowledge (zk). The main difference between the two approaches pertains to how they actually post this transactional data to L1. Optimistic rollups operate under the assumption that the off-chain transactions are valid, therefore only posting the result. However, they can be challenged and verified if necessary. On the other hand, zero-knowledge rollups use validity proofs when transactions are processed off-chain. These proofs are compressed and then passed on to the Ethereum Mainnet as a means of verification.
It is worth mentioning that although these chains are interconnected, they require a bridge service to facilitate the transfer of funds. Layer 2 bridges do not depend on a group of custodians to secure the funds. Instead, the bridge must be assured of the legitimacy of the off-chain system before releasing the funds. If the bridge is not satisfied with the off-chain system, it can bypass the network altogether.
Since their inception, Layer 2 protocols have grown increasingly popular among users seeking to perform the same actions as on Ethereum, but without the high gas fees and slow transaction speeds. As a result, many new protocols are choosing to launch directly on Layer 2, while established dApps opt to migrate directly.
Within DeFi, several standout contenders have taken the space by storm, including Optimism and Arbitrum. The latter has garnered significant attention for recently outpacing Ethereum in daily volume, underscoring its potential as a highly promising Layer 2 protocol.
Arbitrum is an innovative Ethereum scaling solution that facilitates faster and more affordable transactions on the network. As an optimistic rollup, it enables validators to confirm the validity of other blocks, creating a trusted and secure system. This approach ensures that the network remains resilient against potential attack vectors, as validators have a vested interest in maintaining their honesty and integrity to avoid losing their stake.
There are two types of nodes that can take part in Arbitrum: validator nodes and full nodes. Validator nodes help observe the chain’s state, while full nodes help aggregate L1 transactions. By submitting transactions to the L1 chain, aggregators can earn ETH rewards, while validators earn transaction fees.
To ensure seamless compatibility with other Ethereum-based languages, such as Solidity and Vyper, Arbitrum adopted the Ethereum Virtual Machine (EVM) model, appropriately named the Arbitrum Virtual Machine (AVM). As a result, this enabled developers to integrate with Arbitrum without learning a whole new programming language, making it a popular choice for those seeking a user and developer-friendly solution.
Strengthening their proposition, in August 2022, Arbitrum introduced ‘Nitro’, a huge technical upgrade to their original product. This enabled them to become even more EVM-compatible and offer lower fees alongside faster transaction times. In order to achieve this, they implemented the following features:
- ‘Advanced Calldata Compression’ to reduce the amount of data posted to Layer 1.
- ‘Separate Contexts for Common Execution and Fault Proving’ to increase the performance of L1 nodes and lower gas fees further.
- ‘Ethereum L1 Gas Compatibility’, ensuring pricing and accounting for EVM operations aligned with Ethereum.
- ‘Additional L1 Interoperability’, enabling closer L1 block numbers and support for all Ethereum L1 precompiles.
- ‘Safe Retryables’ to eliminate the failure mode where a retryable ticket fails to get created.
- ‘Geth Tracing’ to provide even more debugging support.
To ensure greater reliability and sustainability for its operations, Nitro upgraded ArbOS to the Go programming language. As the name suggests, ArbOS is the EVM hypervisor that Arbitrum utilizes at Layer 2 to uphold the security and operations of the chain. This includes anything from managing network resources to producing blocks from incoming messages. The upgrade resulted in a more efficient infrastructure that was better equipped to handle its smart contracts, security, and functions. While the AVM is responsible for validating transactions between L1 and L2, the ArbOS handles all other aspects of Nitro’s operations. To further streamline its processes, Nitro also leveraged Geth to facilitate the creation of its L2 VM.
As a means to enhance their interactive fraud proofs, Nitro introduced WebAssembly (WASM) code into the ArbOS. This was achieved by compiling Go code into WASM and seamlessly integrating it into the Ethereum implementation within Geth. As a result of this, Nitro significantly improved its fraud-proof capabilities.
Overall, these features work together to create a smooth and secure transactional process between L1 and L2 protocols. Arbitrum has many more upgrades planned, and it is expected to play a significant role in driving the growth and evolution of the Ethereum ecosystem.
Similar to Arbitrum, Optimism is a Layer 2 scaling solution that leverages Optimistic rollups to create a more affordable and seamless experience for end-users accessing Ethereum dApps. According to them, it is currently more cost-effective to write a kilobyte to storage on Optimism than it is to add one byte to the call data on Ethereum, another reason to make the switch.
Optimism assumes that off-chain transactions are valid and therefore does not provide proof of validity for batches of transactions that are posted on-chain. In addition, each rollup contains state commitments that are published to Ethereum without any proof of validation. These commitments are considered pending for a challenge window of 7 days. If unchallenged, they are deemed final, and Ethereum smart contracts can safely accept withdrawal proofs. However, if challenged, a fault-proof process takes place to ensure the commitment’s validity.
To use Optimism, users submit their transactions directly to the Canonical Transaction Chain (CTC) contract, an append-only log of transactions that must be applied to the OVM state. Every transaction submitted must be written to the Ethereum Mainnet as call data, enabling Optimism to function like Ethereum. When a user submits these transactions directly to the CTC, a sequencer produces the blocks which are then automatically confirmed and executed on Optimism’s L2. These blocks are the rollups that can be compressed even further to minimize transaction size, then submitted to Ethereum Layer 1.
Optimism’s transactional process is designed to be as efficient and streamlined as possible by utilizing its own EVM, known as the Optimism Virtual Machine (OVM). The OVM is specifically engineered to closely resemble Ethereum’s programming, making it easier for developers to transition between the two.
If you want to get involved directly and make a meaningful impact on the network’s future, Optimism has its own native token called OP, which is primarily used for governance and ecosystem funding.
A Look at the Future
Coinbase recently announced its own Layer 2 scaling solution, known as ‘Base’, which is built using the open-source OP stack. They are currently in the testnet phase and aim to provide a secure, low-cost, and developer-friendly environment for anyone to use worldwide. Their ultimate goal is to onboard one billion users to the crypto space and will serve as the home for all of Coinbase’s on-chain products while also creating an ecosystem for users to build on top of.
As Base is built using the OP stack, it operates similarly to Optimism and offers all the benefits of Ethereum Layer 2s. This includes secure, fast, and affordable transactions. Additionally, Base offers the same level of Ethereum security, adding an extra layer of trust for its users.
In the near future, there are exciting developments to look forward to with Base, notably the integration of Ethereum Improvement Proposal (EIP) 4844, which will enable Layer 2’s to reduce costs significantly by 10–100x of its current prices (which are already quite low, ranging between $0.05-$0.25 per transaction).
Throughout 2023, their plan is to progress towards a Base and Optimism Mainnet starting from a Stage 0 rollup to a Stage 1 rollup, with decentralization at the forefront of their design. To achieve this, they will work together to provide:
- One (or more) fault provers for the OP stack using validators to identify and challenge faults, ultimately securing both networks.
- A security council with a decentralized quorum.
- An initial release capable of sequencing transactions for Base, Optimism Mainnet, and any OP Stack rollup.
- Stage 2 rollups
On the developer side, Base presents an excellent option for those seeking to host dApps as it offers full EVM equivalence at a significantly lower cost. Furthermore, it provides APIs for account abstraction, gasless transactions, and straightforward multichain capabilities, which is a great advantage for builders. Currently, you can get involved using the RPC testnet endpoint.
In summary, Layer 2 protocols are innovative Ethereum solutions that offer scalability while maintaining high standards of decentralization and security. They consist of separate protocols that communicate with Ethereum by submitting transactions, alleviating transaction loads, and reducing congestion. Rollups, the primary method used by Layer 2 protocols, significantly reduce gas fees for users by grouping large batches of transactions on Ethereum’s Layer 1 and distributing the fees. Optimistic and zero-knowledge rollups being the two primary types of rollups currently available. On the protocol side, Arbitrum and Optimism are amongst the most popular within DeFi that have taken the space by storm, with Coinbase’s ‘Base’ protocol looking to be a part of that elite group next. Watch this space.