February 21, 2023

Scaling Solutions for Ethereum – A Developer’s Guide to Ethereum L2s

Table of Contents

When speaking about scaling solutions for Ethereum, we primarily refer to layer-2 (L2) solutions designed to solve various limitations of layer-1 blockchains. In this article, we’re going to analyze these further; however, we’re also going to explore solutions specifically for Ethereum devs who want to scale their Ethereum projects. One of the most prominent scaling solutions for Ethereum developers is Moralis. This enterprise-grade Web3 API provider has enabled projects to cut their development time by an average of 87% and has saved $86.4 million in combined engineering costs!

TRUSTED BY INDUSTRY EXPERTS

Scaling Solutions for Ethereum - APIs

When using Moralis, it doesn’t matter if you want to build on top of a layer-1 blockchain or L2. With the Web3 tools from Moralis, you can take advantage of cross-chain interoperability and scalable Web3 infrastructure, and you can easily target multiple chains or switch from one chain to another. What’s more, you can do so by tweaking a single line of code. Also, you can use short code snippets (as shown below) in combination with legacy programming languages and frameworks to build a powerful and reliable Web3 backend fast and with resources to spare. Then, you can focus most of your energy on creating the best possible frontend and ensuring an incredible user experience.   

Web3 Authentication API – Request EVM Challenge

  • NodeJS:
const result = await Moralis.Auth.requestMessage(options);
  • Python:
result = auth.challenge.request_challenge_evm(options)

Web3 Authentication API – Verify EVM Challenge

  • NodeJS:
const verifiedData = Moralis.Auth.verify(options);
  • Python:
result = auth.challenge.verify_challenge_evm(options)

Moralis Streams API – Create a Stream

  • NodeJS:
const { result } = await Moralis.Streams.add(options);
  • Python:
result = streams.evm.add_streams(options)

Moving forward, we’ll first explain what scalability is and quickly cover the blockchain trilemma. Then, we’ll take a closer look at Ethereum L2s and explain why they are necessary for the Ethereum network. Finally, we’ll explore the features from Moralis that can help you scale your Ethereum projects. However, if you are eager to start BUIDLing, sign up for free with Moralis now!  

Scale Your Ethereum Project - Sign Up with Moralis

Exploring Scaling Solutions for Ethereum

To properly understand and appreciate different types of scaling solutions for Ethereum, you need to know what scalability is. It’s also important that you understand the gist of the blockchain trilemma before diving further into specifics of the “scaling solutions Ethereum” discussion.

Title - What is Scalability

What is Scalability

Scalability is the ability to scale, which can be defined in many ways. For example, when it comes to blockchain networks and Ethereum in particular, scalability refers to the network’s ability to accommodate a larger amount of transactions without negatively affecting the network’s operations. On the other hand, scalability in Web3 can also refer to dapps’ ability to accommodate a larger amount of users and the ability of its backend to fetch on-chain data fast and efficiently, no matter how large the number of users is. Ethereum L2s deal with the first example of blockchain scalability, and the scaling solutions for Ethereum higher up the Web3 tech stack, such as Moralis, deal with the second example of Web3 scalability. 

Before we dive into L2s, you should know what the blockchain trilemma, also known as the scalability trilemma, is. 

Blockchain Trilemma Graph Art

Scalability Trilemma

Before we explain the scalability trilemma, let’s take a look at the blockchain trifecta:

  • Scalability – The blockchain’s ability to handle a higher volume of transactions.
  • Security – The blockchain’s ability to secure data from various types of attacks and prevent double-spending. 
  • Decentralization – The level of decentralization of a network, ensuring there’s no central entity controlling the network. 

The scalability trilemma refers to the current limitation of blockchain networks, which have so far not been able to ensure a high level of security, decentralization, and scalability all at once. As the above image indicates, so far, blockchain projects can only focus on one out of the following three options:

  • A: Create a secure and scalable network at the cost of reduced decentralization.
  • B: Prioritize proper decentralization and scalability at the cost of reduced security.
  • C: Provide high security and proper decentralization at the cost of low scalability.

Ethereum has clearly chosen option C. However, the core community of Ethereum has been well aware of the need for scalability. After all, the former Ethereum’s proof-of-work (PoW) consensus could only handle only up to 15 transactions per second (TPS). Now, Ethereum is well on its way to implementing the required updates to increase its TPS capacity. For instance, The Merge was one of the updates focusing on that end, which switched Ethereum from PoW to a proof-of-stake (PoS) consensus mechanism. As a result, the network’s throughput has increased slightly and can currently handle up to 40 TPS. The upcoming Ethereum rollups and rollups with sharding are expected to increase the throughput to 4,000 and 100,000 TPC.

However, since Ethereum updates take a lot of time, many other independent projects set out to solve the scalability issue. These projects are known as Ethereum L2s.

L2s outlined

Layer-2 (L2) Scaling Solutions

L2 scaling solutions are platforms or networks particularly designed to solve the above-described Ethereum’s scalability limitations. They typically use Ethereum’s mechanism for security but have their own mechanisms to improve throughput. Since they handle transactions off the mainnet, L2s are also known as “off-chain scaling solutions”. The existing Ethereum L2s take several different approaches. However, these are the four main types of L2s:

  • Nested blockchain
  • State channels
  • Rollups
  • Sidechains (Note: By some definitions, sidechains are not categorized as L2s.) 

Let’s look at each of the above types of scaling solutions for Ethereum more closely.

Scaling Solutions for Ethereum Graph Sequence

Scaling Solutions Ethereum: Nested Blockchain

A nested blockchain is a type of L2 blockchain architecture in which one blockchain is contained within another. This design is thought of as a “parent-child” relationship, where the “parent” blockchain is the main or outer blockchain, and the “child” blockchain is nested within it as a secondary or inner blockchain. In this setup, the inner blockchain is responsible for handling certain transactions or data, and its blocks are linked to the blocks of the outer blockchain, thereby creating a hierarchical structure.

Nested blockchains can be useful in cases where a particular type of transaction or data requires more specialized processing or security measures than the main blockchain can provide. By nesting one blockchain within another, L2 solutions address these specialized needs without compromising the security and efficiency of the main blockchain.

The two leading examples of nested blockchains are OMG Plasma and Gluon Network.

Note: The phrase “plasma chains” is another term for nested blockchains.

Scaling Solutions Ethereum: State Channels

State channels are another “scaling solutions Ethereum” type. State channels enable two parties to conduct transactions without requiring the main blockchain (Ethereum) to validate each transaction. These channels function as multi-signature smart contracts that only execute when authorized by the involved parties.

In simpler terms, state channels are like private, temporary communication channels established between two parties for a specific purpose. This allows them to conduct multiple transactions without the need to record each transaction on the main blockchain, which can be time-consuming and costly. By moving transactions off-chain, state channels allow for faster, more efficient, and cost-effective transactions while maintaining the security and trustlessness of the underlying blockchain technology. With state channels, users can enjoy near-instant transactions and significantly reduced transaction fees. This makes blockchain technology more accessible and practical for a wider range of applications.

The leading “scaling solutions Ethereum” L2s that use state channels are Raiden Network, Connext Network, and Celer Network.

Illustrative Image - How Scaling Solutions for Ethereum Work

Scaling Solutions Ethereum: Rollups

Rollups are scaling solutions for Ethereum that enable faster and more cost-effective transactions by processing them off-chain. In rollups, transaction data is aggregated into a bundle and sent to the main Ethereum chain. There, a smart contract executes and records the bundle as a single transaction. This bundling process reduces the number of transactions the Ethereum network needs to process, making it much faster and more efficient.

Rollups come in two forms: optimistic rollups and zk-rollups. Optimistic rollups use fraud proofs to ensure the validity of off-chain transactions, while zk-rollups use zero-knowledge proofs to provide an additional layer of privacy and security.

These Ethereum L2s are extremely popular as they efficiently solve scalability issues of the Ethereum network. That way, they enable faster and cheaper transactions while retaining the security and trustlessness of the blockchain. With the adoption of rollups, Ethereum can potentially process thousands of transactions per second. This opens up new possibilities for dapps and makes Ethereum more accessible and practical for a wider range of use cases.

The leading “scaling solutions Ethereum” L2s that use optimistic rollups are Optimism, Arbitrum, Boba Network, and ImmutableX. On the other hand, zkSYNC, Loopring, dYdX, and StarkNet are the main representations of zk-rollups. 

Ethereum L2s Sequence

Scaling Solutions Ethereum: Sidechains

Sidechains are other types of scaling solutions for Ethereum. As pointed out before, some definitions don’t consider sidechains as one of Ethereum’s L2 solutions. However, like all of the above three methods, sidechains enable faster and more efficient transactions by processing them off the main chain.

A sidechain is a separate blockchain attached to the main Ethereum network. However, it operates independently from it. This means transactions that the sidechain verifies transact by its separate consensus mechanism. The latter must be faster and less expensive than on the mainnet for the sidechain to make sense. In addition, this introduces potential security risks – users need to trust the consensus mechanism and security of the sidechain. After all, transactions on a sidechain may not be as secure or decentralized as those on the main Ethereum network.

Aside from using sidechains to offload specific types of transactions from the Ethereum network, they can also be used to develop new features or functionalities that are not yet available on the mainnet. This allows for greater experimentation and innovation in the blockchain space.

The most popular Ethereum sidechains are Polygon, Skale, xDAI, and Palm.

Note: There are several other EVM-compatible chains, which are not sidechains but independent L1 networks. However, since these blockchains utilize the power of Ethereum Virtual Machine (EVM), they are compatible with the Ethereum chain and its dev tools. Thus, it can often be smart to create dapps that can connect to Ethereum and other leading EVM-compatible chains (e.g., BNB Chain, Avalanche, Fantom, Cronos, etc.).

User Acting Distressed Due to High Ethereum Gas Prices

Why are L2s Necessary for the Ethereum Network?

Have you used Ethereum during any of the previous bull markets? If so, you’ve most likely experienced the scalability issues of this leading programmable blockchain. The extremely high gas fees probably shocked you as much as they did the guy in the above image. 

If you read the above “Scalability Trilemma” section, you know that Ethereum puts decentralization and security above scalability. Plus, even though Ethereum is implementing network updates set to solve the scalability issues, the network is still capped at 40 TPS. Fortunately, scaling solutions for Ethereum in the form of L2s already offer a tangible solution. With multiple L2s already in place, Ethereum can take the next step toward mass adoption. 

So, the main reason why L2s are necessary for Ethereum is the network’s inability to process on-chain transactions fast and at an affordable price even when there’s a great increase in the number of network users and their activities. 

Moralis - Ultimate Scaling Solution for Ethereum Developers

Scale Your Ethereum Project – Scaling Solutions for Ethereum Developers

You already know at this point that there’s more to “scaling solutions Ethereum” than just L2s. Using reliable shortcuts that help you skip repetitive tasks is very powerful. However, it is important to use tested, reputable blockchain-related backend solutions that can scale with your expanding needs. Moralis has a proven track record of fetching parsed on-chain data for some of the leading Web3 wallets, portfolio dapps, and other successful Web3 projects. It does so with the fastest Web3 APIs, including the Web3 Data API, Web3 Authentication API, and Web3 Streams API. All these enterprise blockchain solutions support Ethereum, all the leading EVM-compatible chains, as well as some non-EVM-compatible chains, such as Solana and Aptos. 

Cross-Chain Scaling Solutions Ethereum Outlined

With this Web3 API set, Moralis makes Web3 development as straightforward as it gets. It allows you to copy code snippets from the Moralis API endpoint reference pages and paste them into your backend scripts. So, whether you use NodeJS, Python, Go, or any other popular legacy programming language, you can implement Web3 technology in minutes. 

Using the Web3 Data API, you can query tokens, balances, transactions, and much more. Here are some popular examples:

  • Get NFTs by wallet:
const response = await Moralis.EvmApi.nft.getWalletNFTs({
    address,
    chain,
});
  • Get ERC-20 token price:
const response = await Moralis.EvmApi.token.getTokenPrice({
    address,
    chain,
});
  • Get native transactions by wallet:
const response = await Moralis.EvmApi.transaction.getWalletTransactions({
    address,
    chain,
});

With the Web3 Authentication API, you can implement Web3 login solutions and easily onboard users to your dapps. Also, with the Moralis Streams API, you can listen to any smart contract or wallet address in real-time. This superior Notify API alternative makes Web3 libraries obsolete in many ways. 

While Moralis offers different plans, a free account gives you access to all tools from Moralis. This means you can start building killer dapps without any additional cost.  

Scaling Solutions for Ethereum – A Developer’s Guide to Ethereum L2s – Summary

In today’s article, you had an opportunity to learn all you need to know about scaling solutions for Ethereum. As such, you now know that on the network level, Ethereum L2s are already offering some promising solutions regarding the scalability trilemma. When it comes to creating dapps that can scale to your needs, Moralis and its scalable Web3 APIs is the go-to choice.

If you wish to explore other blockchain development topics, visit the Moralis blog. However, if you are ready to get your hands dirty and build your first scalable dapp, dive into the Moralis docs. Now, if you need some dapp ideas, watch our video tutorials that await you on the Moralis Web3 YouTube channel.  

Moralis Money
Stay ahead of the markets with real-time, on-chain data insights. Inform your trades with true market alpha!
Moralis Money
Related Articles
February 27, 2024

How to Get the Net Worth of Any ERC20 Wallet via API 

October 17, 2023

How to Get an ERC-20 Token Address

December 5, 2023

Full Guide: What is Web3 as a Service?

January 27, 2023

Chainlink Testnet Faucet – How to Get Testnet LINK from a Chainlink Faucet

November 24, 2022

Web3 Python – Python Web3 Development Made Easy

January 1, 2023

Web3 Programming – How to Learn Web3 Programming

August 16, 2022

NodeJS SDK for Web3 – Exploring Moralis’ NodeJS SDK

November 21, 2023

Gnosis Chain Deep Dive – Why Build on Gnosis Chain?