Arbitrum logo, from airdrops.io

Crypto Layer 2: What is it and why should you care?


For a while, I've read about various projects being "layer 2 (L2) solutions", the implication being that that's a good thing. However, I've not known what that actually means (or why they are so great, what aspects/properties they have that makes them so). I decided to investigate. Here's what I found/understand about them:

What is a Layer 2 Solution?

An existing blockchain (such as Bitcoin or Ethereum) is the base layer, Layer 1 (L1). It not only defines the core rules of how the chain/ecosystem operates, but can also validate and finalise transactions. Due to their decentralised nature, layer 1 chains require a lot of security be built in and this can lead to issues in scaling them. (This is known as the blockchain trilemma) Typically, the L1 chain has flaws/shortcomings that affect speed, scalability and fees/costs of processing transactions, or other areas of concern (such as anonymity/privacy/security).

A Layer 2 (L2) project is a framework or protocol (including a blockchain, often a sidechain) that is built on top of an existing L1 blockchain (such as Arbitrum or Optimism on Ethereum) and often mirrors the L1's functionality (or a subset thereof). The reason for doing this is to solve (some of) the problems inherent in the implementation of the L1 blockchain.

In the cases of Bitcoin and Ethereum, processing thousands of transactions per second (Tps) is not possible, or would be very expensive. This poses a problem for the long-term growth potential (scalability) of these L1 networks. Changes must be made to increase the throughput of these networks if they are to be adopted and used by many people.

An alternative is an L2 solution. These are technologies built on top of the existing blockchains and which propose solutions to solve one or more of the cost, scalability and/or anonymity problems with the L1, in a number of ways.

In the case of bitcoin, the Lightning Network is perhaps the most well-known L2. Ethereum has a number of L2 solutions, as mentioned previously. (Arbitrum, Optimism and Polygon are some of them.) Some of these will be looked at below.

What is a Sidechain?

A sidechain is an independent and compatible blockchain that runs in parallel to the main (L1) blockchain, occasionally synchronising with it at certain intervals/points (through bridges). Polygon (MATIC) is an Ethereum sidechain. The main advantages of Polygon are that it can process more transactions per second and at a lower cost per transaction than the Ethereum mainnet, although it is not quite as secure (due to having less liquidity).

It is important to be aware that they do not gain security or data from the L1 chain and are thus not considered "proper" L2s, like rollups are.

What is a Rollup?

The below content looks at rollups in terms of how they work for/on Ethereum. To the best of my knowledge, there aren't rollups for other blockchains/environments, but I could be mistaken.

A rollup is a means of providing scalability to a blockchain. It provides functionality that bundles (rolls up) transactions (computations, storage and state) and moves them off the main blockchain (mainnet) for processing elsewhere. Potentially thousands of transactions are processed in a batch and then a minimal amount of (often compressed) data (state changes and proof of correctness) is written on the mainnet. This frees up the chain for processing and storing data, potentially increasing the efficiency and throughput thereof (10-100x in some cases), as well as costs of computation.

The code for a rollup is usually contained in a smart contract (an application that runs on the EVM or similar). A contract for a rollup contains code to make it run, store blocks, make and monitor its state updates and track amounts deposited by users.

Although the main EVM runs the contracts for rollup protocols, the protocol itself runs rollups on a separate (off-chain) VM from the main EVM. It is similar to the EVM in many ways.

What is Arbitrum?

Arbitrum is a scalability rollup intended for use by developers of dApps. It provides full EVM support, thus allowing everything that the L1 EVM provides, but at a fraction of the cost and higher speed. If I understand correctly, it is possible to deploy smart contracts/dApps directly to Arbitrum, instead of the Ethereum mainnet, since Arbitrum provides its own version of the EVM (known as the Arbitrum VM, or AVM). The AVM supports Vyper, a python-like language for writing smart contracts. This could be great for developers, going forward.

Arbitrum has a thriving environment, consisting of many projects of varying types (including DAOs, decentralised exchanges, games and NFT marketplaces).

What is Immutable X?

Immutable X is a zero-knowledge (ZK) rollup for games and NFT projects/portfolios. It offers quickly launching collections/portfolios with near-zero fees. It processes batches of transactions off-chain (up to 9000 Tps).

What is Cartesi?

Cartesi (CTSI) is an interoperability layer that functions like a blockchain-based operating system (GNU/Linux). Instead of being restricted to Solidity, Cartesi allows developers to create smart contracts/dApps in other programming languages.

Why Should you Care?

Layer 2 solutions are important for scalability, by providing mechanisms (such as rollups) for reducing the workload on the L1 chains, leaving them to do the security-related work.

L2s provide a number of advantages/improvements to L1 blockchains, primarily in terms of cost and scalability (although some focus on security). Here are some of them:

  • Less data stored on chain and less computation required to be performed by the main chain, resulting in higher throughput and lower costs.
  • Minimal to no delay in moving money between L2 ZK-rollups and the mainnet (L1) due to how proofs are calculated.
  • Off-chain activity means L2s are less vulnerable to attack than the L1.
  • L2s have similar security to the L1, since data is still kept on/posted to the main chain.
  • A number of smart contracts can operate simultaneously, since they run in parallel (instead of on the main chain). This allows for scalability.
  • A number of rollups provide the same (or similar) functionality as the EVM, making it possible to run smart contracts on them.

The net result is that transaction processing gets moved off the main chain and runs in parallel, while the results of that processing are still written to the chain. The workload on the mainnet is thus relieved and does not cost as much to perform.

L2 solutions are a relatively new development in crypto. Their use can carry more risk than the L1 chains on which they operate, given that trust assumptions are made regarding the calculations of cryptographic proof for the transactions they process. Not all L2s make use of fraud proofs (the ability to prove that calculations are faulty and thus require transactions be processed again). This means that using an L2 carries higher risk than using an L1. There is a trade-off between security and cost.

As always, do your own research, including assessing and considering the risks involved when using any particular crypto service/technology.


Thumbnail image: Arbitrum logo, from airdrops.io

How do you rate this article?

20


Great White Snark
Great White Snark

I'm currently seeking fixed employment as a S/W & Web developer (C# & ASP .NET MVC, PHP 8+, Python 3), hoping to stash the farmed fiat and go full Crypto, quit the 07:30-18:00 grind. Unsigned music producer; snarky; white; balding; smashes Patriarchy.


Cryptographic Anarchy: (Mis)Adventures in Crypto
Cryptographic Anarchy: (Mis)Adventures in Crypto

The content of this blog is exclusively to do with online privacy/security, cryptography and cryptocurrency: Understanding it, investing in it, mining it (in groups/crowds), developing/programming it, the social problems it aims to solve and the various ways to make more of it (or not, as various losses and failures happen). Let's get away from banksters, Capitalists and fiat, to an unbanked anarcho-syndicalist commune. || Banner image: Blogger's own.

Send a $0.01 microtip in crypto to the author, and earn yourself as you read!

20% to author / 80% to me.
We pay the tips from our rewards pool.