Demystifying Layer-2 and Sidechains: What’s the Difference?

Krinza Momin
Ankr
Published in
9 min readJul 6, 2022

--

Are Sidechains a Viable Layer-2 Scaling Solution?

CryptoKitties and the Rise of L2 Solutions

Throwing it back to late 2017 — CryptoKitties was dubbed the first “cryptocollectible,” and attracted mass hysteria around the trading of virtual cats on the Ethereum blockchain. ETH was exploding with usage, and the chain was becoming bogged down with ever-expanding demand. Although CryptoKitties surely offered a glimpse into mainstream adoption, the game was enough to bring the Ethereum network down to its knees. As traffic increased, transactions became more expensive and execution too slow to facilitate a user-friendly experience. The craze turned into a congestion crisis.

Fast-forward to 2022, with hundreds of applications being launched and thousands of users joining every day, Ethereum is still severely limited by its capacity to process transactions. In an ideal case, a blockchain would be able to handle an infinite number of transactions per second (TPS), also referred to as throughput. But, Ethereum doesn’t have unlimited network capacity. Instead, its transaction throughput is limited to about 15 transactions per second, leading gas prices to skyrocket and making the network often too congested due to high demand. This is when the dilemma became clear: Widespread adoption requires scalable blockchains.

Blockchain Trilemma: The Three Fighting Factors

Blockchain’s main problem is scalability, and the main culprit is decentralization, its core principle. What makes decentralization difficult is that every transaction has to be broadcasted and persisted across the whole network on a global scale. For reference, a domain name (or DNS) on traditional web2 solutions can take up to 24–48 hours to populate globally. To add to its list of challenges, a strong security layer is significantly important but also a detriment to efficiency. The good news is that, so far, blockchain systems have succeeded in executing decentralization and security, but scalability is still the biggest problem the tech has faced — until now.

Achieving a network that features internet-scale transactional throughput over a widely decentralized network — all while holding onto strong security is the holy grail of blockchain technology. Any attempts in trying to scale up performance “on-chain” have led to a trade-off with either security or decentralization, or both — also coined as the “Blockchain Trilemma”.

This is exactly where “off-chain” solutions like sidechain and layer 2 come into play. But before digging into the difference between these two, let’s take a quick rundown on what layer 2 and sidechains are.

What is Layer 2?

Layer 2 chains are essentially a secondary framework built on top of Layer 1 blockchains that can process transactions at a much higher capacity. This is achieved by processing transactions off of the Ethereum Mainnet (or another Layer 1) while still maintaining the same security measures and decentralization as the base layer. In a broader sense, Layer 2 doesn’t require anything to change in Layer 1. It works independently of Layer 1 but is still part of the entire network.

How does it work?

A bridge is established between layers 1 and 2, and a summary of the L2 transaction gets uploaded to the main chain (L1) periodically to cast a permanent record after the transactions are confirmed. Part of it has to do with unloading the transactional weight of a blockchain to the secondary protocol (L2).

Layer 2 then conducts the majority of the network’s processing and reports back to the main blockchain to complete its findings. Now, because most of the processing load is shared with the L2 architecture, the base layer blockchain becomes less crowded — and eventually less congested.

How does Layer-2 help with Scalability?

Imagine standing in a line at a store, but there’s only one counter. Layer 2 is like having a second counter with an extra staff to handle customers from the first line. As the large portion of transactions that go through Layer 1 gets shifted to Layer 2, it results in a shorter wait time, higher transactions per second, and smoothens the traffic flow in Layer 1. Hence, scalability.

Some Layer 2 scaling solutions include channels, plasma, and rollups.

1. Channels

State channels are a very broad and simple way to think about blockchain interactions which could occur on the blockchain, but instead get conducted off of the blockchain, without significantly increasing the risk of any participant. — Jeff Coleman, 2015

A State channel is a protocol between set participants where users can transact “x” number of times with one another ‘off-chain,’ yet it only submits two on-chain transactions to the Ethereum network. This greatly minimizes their use of on-chain operations and provides extremely high transaction throughput.

2. Plasma

Plasma is a framework that allows the creation of “child” blockchains that uses the main Ethereum chain as an anchor of trust. It operates as a blockchain tree, and child chains are hierarchically organized. The main chain and child chain connect via a root contract that records the current state and conveys the rules for the child chains. Because child chains offload the traffic and bandwidth congestion from the Ethereum mainnet, they offer higher throughput and lower the cost per transaction.

Sadly, this solution is filled with challenges such as lack of computational support, delayed withdrawals, and the need to periodically watch over the network. That’s why alternative solutions such as rollups are widely used.

3. Rollups

A rollup bundles or take multiple Ethereum transactions and “rolls them up” into a single piece of data off-chain. It generates a cryptographic proof aka SNARK (succinct non-interactive argument of knowledge) before submitting them all to the main chain. This increases transaction speed and reduces the cost per transaction.

What are Sidechains?

A sidechain (as its name suggests) is a separate blockchain with its own set of rules, security, and consensus mechanism. It can operate independently with its own governance rules and vision but in link with the parent blockchain or mainnet — via a two-way peg.

The two-way peg itself is an interesting concept that allows digital assets to be transferred back and forth between the parent blockchain and the new sidechain. What’s interesting about it is the fact that the “transfer” of an asset never occurs. Instead, the digital assets are locked on the parent blockchain while the same amount is unlocked in the sidechain and released on either end of the two blockchains once the transaction is validated via a smart contract.

This, in a way, puts “validators” in a position of operation with an assumption that they are acting honestly. Otherwise, corrupt transfers could be made, or authentic transfers could be stopped.

Innovation over Scalability through Sidechains

Sidechains can increase scale but do not imply scalability. Sidechains are no better at providing scalability than increasing block size. What sidechains bring is the ability to experiment. To be able to build networks that run on different — and possibly better-scaling — technology. — Pieter Wuille, Reddit

This rings true as a sidechain is defined by its custom set of rules and is free to experiment with transaction designs, new trust, economic models, etc. This also means that there’s a great potential for sidechains to optimize and expand the scope for applications that require innovation, heavy computation, and high speeds —this kind of sidechain innovation is found now in Application-Specific Sidechains (or app chains).

With all the room for experimentation, sidechains can act as a playground to figure out which trade-off might produce the optimal performance, based on the needs of the individual application.

PS: “CryptoKitties” would have greatly benefited from an optimized high-speed sidechain, really.

While we have been beating our heads against the wall for scalability, there’s another bottleneck preventing the mass adoption of blockchain technology that sidechains can solve — “Interoperability.” Interoperability is what gives a fundamental value proposition to the sidechains. It enables cross-chain communication by allowing users to interact with each other simultaneously across multiple blockchains.

Anyway, now that we have got a gist of what layer 2 and sidechains are, let’s explore what makes them different from each other.

Sidechain VS Layer-2

The key difference between sidechains and Layer-2 solutions can be found by looking into their security mechanisms. Here is a pointer:

  • Layer-2 generally relies on the security of the mainchain (L1)
  • Sidechains have their own security model

In other words, a Layer-2 solution benefits from the security of Layer 1, whereas, a sidechain has to handle that part on its own. It’s the security mechanism that makes these two different from each other.

I’ll also take this opportunity to restate that “Sidechains are not Layer-2”.

If you are still confused, ask this question when differentiating, “Who controls the export of funds?” If it’s not controlled and protected by Layer 1 itself, then it’s a sidechain. Otherwise, it’s a Layer-2 solution.

Merge Ahead!

With the “Merge” (or Eth 2.0) ahead, the conversations have picked up a new dialogue of whether or not Ethereum’s transition to proof-of-stake will make Layer-2 solutions irrelevant. Due to the fact that mainstream adoption is still a long way off, with only 4% of the population owning crypto, it’s safe to say that Ethereum will still require Layer-2 chains. But this isn’t a racing certainty.

Notwithstanding, there seems to be overwhelming support for the future of Layer-2s and sidechains for interoperability, as it’s believed that scaling is a long-term problem and improvements to Ethereum’s usability will come from its ecosystem, not from updates to the Ethereum network itself. Anyway, the merge is a key push in that direction, changing consensus mechanisms to more effective Proof-of-Stake and a less energy-intensive model. Indeed, exciting times are ahead, and all eyes are on the gas price!

--

--