Layer-2 solutions in blockchain. Part 1

Dmytro Nasyrov
Pharos Production
Published in
4 min readSep 20, 2024

Layer-2 (L2) is any off-chain network, system, or technology built on top of a blockchain (commonly known as a layer one network) that helps extend the capabilities of the base layer network. Layer-2 networks can support any blockchain to implement improvements such as higher transaction throughput.

One of the main requirements for a Layer-2 network, system, or technology is that it inherits the security of the blockchain on which it is built. Transaction data must be verified and validated in some form by the underlying blockchain network rather than by a separate set of nodes. For example, sidechains are often not considered Layer-2 because they typically use their own consensus mechanisms and validators, resulting in a different set of security guarantees than the base layer network.

For blockchains that sacrifice scalability to achieve greater decentralization and security, layer 2 provides greater transaction throughput, which can lead to lower fees. The second layer can be seen as one solution to the scalability problem, providing fast and scalable execution without compromising decentralization and security.

The need for a second-level

Since the advent of blockchain technology in 2008, thousands of researchers and developers have worked to solve serious scalability issues so that blockchain can meet growing adoption. These limitations have historically resulted in high fees and slow execution times, hindering blockchain's ability to operate at an industrial scale.

Coined by Ethereum co-founder Vitalik Buterin, the blockchain scalability trilemma states that blockchain cannot scale efficiently while maintaining the security and decentralization of the underlying network. Today’s blockchain networks can achieve two of the three, but not all three simultaneously.

L2 technology is a new technology based on the premise that this scalability limitation exists because too many tasks are assigned to the blockchain. The blockchain today performs three main functions: execution, data availability, and consensus.

Execution — transaction processing and throughput. Measured by the number of computations (of which transactions are a subset) per second that the blockchain can process. Data availability — the storage requirements of transactions, state, and other data on the nodes and validators of the network. Measured in standard storage terms such as megabytes, gigabytes, etc. Consensus — the broad agreement of nodes and validators on the network state and the order of transactions. Measured in terms of decentralization and time to finality, or the time it takes for all nodes to agree on a state change.

How second-level solutions work

Note: Most Layer-2 solutions are in their early stages of implementation, and many elements of Layer-2 protocol design need to be tested or proven.

At their most basic, Layer-2 solutions typically consist of two parts: a network that processes transactions and a smart contract on the underlying blockchain that resolves any disputes and achieves consensus on the state of the Layer-2 network, attaching it to the underlying blockchain.

Layer-2 networks are where the fast execution of transactions and computations occurs. They can vary greatly in how they achieve this throughput. However, the common denominator between each Layer-2 environment is that when a situation on the underlying chain is desired to be settled, Layer-2 must provide some cryptographic and verifiable “proof” to the blockchain of the integrity of the proposed state change, either ex-ante or retroactively.

Likewise, the basic implementation of a smart contract can vary between Layer-2s’, but the basic functions of a smart contract are always to:

  1. hold and release funds transferred to L2
  2. receive some proof generated by L2, verify it, resolve disputes, and finalize transactions.

A good way to conceptualize these two dynamics is to consider two examples of existing Layer-2 implementations — payment channels and rollups.

Payment channels

A payment channel allows for the off-chain transfer of on-chain tokens between two or more users by pre-funding the channel’s liquidity.

Alice and Bob create a payment channel by locking collective funds in a smart contract and agreeing (using cryptographic signatures) on how much each can access. For example, if they both locked up $50 of funds for $100, they likely agree that they could each use $50 in the payment channel.

Once the payment channel is created, Alice and Bob can transact off-chain using signed messages without broadcasting the transactions to the main blockchain. Alice can pay Bob, and vice versa, at zero cost and with lightning-fast latency. When communicating over a two-way payment channel, Alice and Bob’s transactions are not published to the main blockchain; only when they mutually decide to close the channel are the final results broadcast to the blockchain and committed to it.

This system results in Bob and Alice only needing to pay two on-chain transactions to open and close a payment channel. As long as the payment channel is open, millions of transfers can be made at zero cost and sub-second speeds directly from one user to another—a classic example of scalability.

Feel free to drop a “Hi” at Pharos Production, where we bring software to life! 👋✨

https://pharosproduction.com

“Join our exciting journey with Ludo — the reputation system of the Web3 world! 🌍✨”

https://ludo.com

--

--

Dmytro Nasyrov
Pharos Production

We build high-load software. Pharos Production founder and CTO.