logo academy

Polygon vs Arbitrum vs Optimism: May the Best Ethereum Layer 2 Win

July 4, 2022
11 min
Polygon vs Arbitrum vs Optimism: May the Best Ethereum Layer 2 Win
You will learn

    Ethereum‘s ecosystem, after the ‘DeFi Summer’ 2020, has been populated by decentralised applications (dapps) and other smart contract protocols. However, this sudden growth in services has put a strain on its network, which is congested with an immense amount of transactions. How can we achieve the necessary scalability? By using blockchain and supporting protocols: let’s find out what Layer 2s are and their characteristics. In particular, we will compare Arbitrum and Optimism and understand their differences with Polygon, a sidechain with several scalability solutions for Ethereum.

    What are Layer 2 projects?

    The scalability trilemma highlighted the relationship between three properties of blockchains: scalability, security and decentralisation. In particular, it is Vitalik Buterin who has argued that when building a network of nodes, at least one of these characteristics will be sacrificed in favour of the other two. This is the limitation that every Layer 1 blockchain developer has had to face.

    For example, Bitcoin is secure and decentralised, but not scalable. This would support the large volume of transactions congesting the network, which explains what Layer 2s are. Thus was born the Lightning Network (LN), which administers the off-chain exchanges and then sends the results to Bitcoin’s Mainnet.

    Layer 2

    Layer 2s are infrastructures, or simple protocols, built on top of an existing blockchain, called Layer 1. Layer 2s are a possible solution to the trilemma of scalability: they allow increasing transactions per second and generally the performance of a blockchain. There are different types of Layer 2, but they usually handle off-chain transactions, sending only the results of these or more compact forms of data to Layer 1.

    However, decentralised finance (DeFi) is not just about p2p exchanges: Ethereum has created the first large ecosystem of decentralised applications (Dapp), based on smart contracts and shared languages such as standard tokens. Users interact with these services precisely through the blockchain: how can they handle thousands of requests simultaneously?

    Uniswap, the decentralised exchange (DEX) and Ethereum’s main dapp, has implemented V3 of its protocol in Layer 2, specifically on Arbitrum, Optimism and Polygon.

    Ethereum, in fact, has its own Layer 2 solutions, which can be divided into four broad categories: Sidechain, Nested Blockchain (Plasma), Rollup and the aforementioned State Channel. These Layer 2 types can also be implemented simultaneously (as in Polygon), but they have different characteristics. Let us therefore discover what a sidechain is and introduce the types of Rollup, a solution adopted by Arbitrum and Optimism.

    What Polygon is: much more than just a a sidechain

    Sidechains are in fact blockchains that flank Layer 1s. They are connected to the Mainnet by bidirectional bridges, smart contracts that can transport information from the primary blockchain to the sidechain and vice versa. Sidechains, however, may have different parameters from Layer 1: differences, for example, in the consensus mechanism or block size. This means that the security may not reflect that of the primary blockchain: the independence of sidechains, according to ethereum.org, moves them away from the definition of Layer 2; however, the goal of scalability unites them.

    Polygon was born as a Sidechain under the name Matic Network: it differs from Layer 2 because it uses a consensus algorithm independent of Ethereum. In fact, Polygon uses a Proof-of-Stake mechanism to independently validate transactions, benefiting from lower fees and higher transactions per second (more than 65 thousand, compared to Ethereum’s maximum 15 tps).

    In addition, Polygon’s PoS sidechain enjoys interoperability with the Ethereum ecosystem: it interacts with the Ethereum Virtual Machine (EVM), i.e. it can support smart contracts written in Solidity, Ethereum’s programming language, as well as manage standard ERC tokens. In a nutshell, to solve the scalability problems of a dapp, it is sufficient to move the execution of its smart contracts to the Polygon sidechain.

    Polygon’s framework also provides the tools to develop other scalability solutions, which are already implemented in its network. We are talking about Layer 2 Plasma and Rollup technologies, the latter divided into Zero Knowledge-rollup and Optimistic rollup. Rollups are the scalability solution adopted by Arbitrum and Optimism, let’s find out what Rollups are and how they work.

    What are Rollups: Optimistic vs. Zero Knowledge

    Before defining the differences between Arbitrum and Optimism, let us discover the basic functioning of Rollups: transactions, executed off-chain, are grouped together and transferred to the main chain in order to be recorded immutably. The action of collecting many transactions in a single block is reflected in the name ‘Rollup’, but the latter is usually accompanied by a second specification: Optimistic or Zero-Knowledge.

    Optimistic Rollups (OR) are the fundamental layer of both Arbitrum and Optimism. In a nutshell, an ‘aggregator‘ collects transactions in a Rollup block, which is then sent to a specific Ethereum smart contract. The transactions contained in this block, however, are not verified, but simply recorded in the Layer 1, thus becoming part of the history of Ethereum. In fact, the information is assumed a priori to be valid, assuming the good behaviour of the aggregators, which is why the scalability solution is called ‘Optimistic’. However, there is always a safety measure.

    Each OR block includes a code called the ‘state root’, i.e. the ‘root’ of the structure that binds all the information it contains (Merkle Tree). This cryptographic root is similar to a hash: it is unique and summarises the data it refers to. Therefore, anyone can provide proof that a ‘state root’ is invalid, so that Rollup’s smart contract ‘reopens’ the block to allow the network to verify. This ‘Fraud Proof‘ can take place within a certain period of time, after which the block will still be finalised. An aggregator who turns out to be dishonest loses the guarantee (called a ‘bond‘) locked in the smart contract to participate in the OR,  that is awarded as a prize to those who discovered the fraud.

    This scalability solution, in short, does not have a security standard on a par with the proof-of-work and proof-of-stake consensus algorithms, but carrying out checks only when necessary saves a lot of time. Arbitrum and Optimism have, indeed, adopted this scalability measure, but there is an alternative by Rollup: the so-called Zero-Knowledge (zk).

    Rollup zk’s act like OR’s in grouping transactions, however they do not send compressed information to Layer 1, but only a proof of their validity. In short, off-chain is already verified that all transactions are valid, so that only the cryptographic code that proves this is transmitted: a SNARK (succinct non-interactive argument of knowledge) or a STARK (scalable transparent argument of knowledge).

    In essence, ZK Rollups allow instant transactions, as their validity is immediately verified on-chain through SNARKs/STARKs, while ORs sometimes entail waiting times for possible ‘fraud proof’. However, Arbitrum and Optimism preferred ORs because of their compatibility with the EVM, which guarantees absolute interoperability with Ethereum. Moreover, zk validity codes are complex to produce, so they are not suitable for dapp with low on-chain activity.

    Polygon vs Arbitrum vs Optimism

    Arbitrum vs Optimism and the differences with Polygon

    Arbitrum and Optimism are Layer 2s that exploit the scalability solution of Optimistic Rollups, however they have some differences:

    • Tokens and Governance: both Arbitrum and Optimism are compatible with ethereum tokens, but only the latter has its own governance token: OP tokens, distributed among ‘early users’ through Optimism’s airdrop in June 2022. Holders can then vote on protocol updates or incentive plans. However, 20 million OP tokens were immediately stolen by a market-making smart contract: the hacker, after selling one million tokens and transferring as many to Vitalik Buterin, returned 17 M of them.
    • Fraud Proof: checking the validity of an OR, when required, in Optimism is done in a single round. In fact, the entire block is re-processed on-chain, i.e. by Layer 1, to assess the correctness of the ‘root’ code (state root). This, although instantaneous, sometimes requires high fees. In Arbitrum, on the other hand, the block subject to Fraud Proof is first processed off-chain to identify the suspicious part, then sent individually to Layer 1 for verification. This, although more time-consuming, lowers the fees and increases transaction capacity.
    • Virtual Machine: Arbitrum has its own version of a ‘virtual machine’ (Arbitrum Virtual Machine), i.e. the component of each node that enables the execution of smart contracts. Optimism, on the other hand, is only compatible with the Ethereum Virtual Machine (EVM), it has not created its own. This means that Optimism is strictly dependent on updates in the Ethereum consensus to determine the validity of blocks. However, Arbitrum will have to ‘translate’ each smart contract from EVM to AVM.

    Having understood what layer 2 is and the differences between Arbitrum and Optimism, the most immediate comparison to be made is with Polygon. It is not just a sidechain of Ethereum with Rollup (optimistic and zero knowledge) and Plasma, but an independent blockchain that scales on the Proof-of-Stake mechanism and is more flexible to further changes to improve its performance.

    Thus, we add a piece to the mosaic of scalability: plasma chains are anchored to the Ethereum blockchain and use ‘Fraud Proof‘ to resolve validity disputes, such as Arbitrum and Optimism. However, each plasma chain is embedded in a ‘parent-child’ hierarchy: each ‘daughter’ chain lightens the load of operations of the mother to which it is subordinate, thus building a structure of blockchains grafted onto each other. Each plasma chain has its own consensus mechanism for block validation and can be dedicated to a specific use case.

    In this regard, let us recall that Polygon is autonomously Proof-of-Stake, while Arbitrum and Optimism depend on Ethereum’s consensus algorithm. In fact, Polygon’s validators lock in staking MATIC tokens to validate blocks (and receive governance powers). This leads to advantages in terms of transactions per second: while Polygon, as mentioned, supports 65 thousand tps, Optimism and Arbitrum’s ORs cannot go beyond 2000 tps, although Arbitrum claims to have a base level of 4500 tps.

    Finally, the waiting time for token withdrawal varies greatly between the 3 protocols: Arbitrum and Optimism’s Fraud Proof mechanism imposes a minimum period of 1-2 weeks, necessary to resolve potential disputes, while Polygon’s PoS chain bridge allows tokens to reach Ethereum in less than 3 hours.

    Ethereum 2.0: Layer 1 scalability

    Layer-2s are not the only possible option to improve network performance: modifying the functioning of the main blockchain, so as to solve the probability of congestion already at the Layer 1 level, is complex but beneficial. We said that the scalability trilemma hinders the definition of blockchain as simultaneously secure, decentralised and scalable. However, it is not an insurmountable boundary: innovation can be achieved even without Layer 2 support chains.

    Obviously this requires time and intensive programming efforts, but it seems that Ethereum‘s Layer 1 may finally achieve the coveted scalability on its own. Indeed, the Ethereum mainnet has been in transition since December 2020: version 2.0 promises 100,000 tps, essentially changing the consensus mechanism from proof-of-work to proof-of-stake.

    The ‘Merge’ of the Beacon Chain, the stacked version of Ethereum, and the ‘old’ Ethereum blockchain is planned for August 2022, thus giving birth to Ethereum 2.0. However, this will not be the final form: scalability will be further enhanced by sharding and zero-knowledge protocols!

    What will be the future of layer 2? Will they also flank Ethereum 2.0 or will they be superfluous?