July 9, 2024

Bitcoin Layer2s: What Are and How They Work

Bitcoin Layer2s: What Are and How They Work

Since its inception, Bitcoin has emerged as the flagship cryptocurrency, boasting the largest market capitalisation and pioneering the entire cryptocurrency landscape. However, as Bitcoin continues to gain popularity, it encounters several inherent limitations. 

Designed to validate seven transactions per second, the Bitcoin network now faces challenges with scalability. This limitation results in higher fees and slower transaction times, rendering Bitcoin less practical for small(petty) day-to-day transactions. 

To tackle this challenge innovative Bitcoin layer-2 solutions have sprung up aiming to make the Bitcoin blockchain more scalable, efficient and less expensive some even go as far as bringing smart contracts capabilities to the Bitcoin network. 

Before we get Started  

Let's quickly highlight what layer1s and layer2 chains are: 

Layer 1 blockchains are the base layer or the parent chain where transaction validation and network consensus occur, usually through consensus mechanisms such as proof of work (PoW) or proof of stake (PoS). 

Source: Sharduem

Layer2s on the other hand are secondary networks built on top of the architecture of Layer 1 to address specific limitations of the underlying Layer 1 blockchain.

Understanding Bitcoin Layer2s  

Bitcoin Layer 2 solutions (Bitcoin L2s) are secondary protocols developed to enhance the main Bitcoin blockchain's capabilities. Their primary goals are to address scalability challenges, increase transaction speeds, and reduce fees. 

Some Bitcoin L2s also introduce smart contract functionality, broadening Bitcoin's range of potential applications. 

These solutions work by creating a separate execution layer that handles transactions off-chain, using the main blockchain solely for final settlement. 

This approach reduces congestion on the main chain and significantly improves transaction efficiency. Bitcoin Layer 2s uses Bitcoin as the gas token and relies on the parent blockchain for settlement. 

By processing transactions off the main chain and submitting them for final settlement on the main chain, they help reduce transaction fees and increase throughput whilst maintaining the core principles of security and decentralisation that are fundamental to Bitcoin, ensuring that transactions remain trustless and resistant to censorship or manipulation.

How Bitcoin L2s Solutions Work 

Among the layers of a blockchain are: 

The execution layer: is part of the application layer that hosts smart contracts and manages the computation of transactions. Once the transactions are processed, they are sent to the consensus layer.

The consensus layer: is responsible for validating blocks. It hosts miners or validators that run the consensus algorithm to validate transactions and record them on the blockchain. 

Off-chain transactions 

Bitcoin Layer 2 solutions (L2s) build an execution layer separate from the main Bitcoin blockchain to handle transactions off-chain.

This creates flexibility that allows Bitcoin Layer 2 solutions to build execution layers with innovative functionalities not possible on the Bitcoin main chain, such as supporting smart contracts.

Settlement on the Main Chain

These transactions are then submitted to the Bitcoin consensus layer for final settlement. While different Bitcoin L2 solutions may employ varying approaches to building their execution layers, the core concept and principles remain the same. 

Interoperability 

In addition to increasing transaction speed and reducing fees, Bitcoin L2s claim to benefit from the security and decentralisation of the Bitcoin blockchain by submitting transactions to the Bitcoin consensus layer for validation and final settlement.

Types of Bitcoin layer solutions  

Image credit: Xverse

  

To further understand how Bitcoin Layer2 works, let's look at the types of Bitcoin layer2 solutions.  

State Channels

These types of Bitcoin Layer 2 solutions create off-chain external channels that enable users to carry out multiple transactions (sending and receiving assets) between each other, bypassing high transaction fees. 

A multi-signature (multi-sig) address is created to hold Bitcoin on behalf of the transacting parties. This setup allows them to exchange assets, where the state change is reflected in the variation of the wallet balances. 

At the end of the transaction, the channel is closed, and the final balance is sent to the Bitcoin consensus layer for validation.  An example of a state channel is the Bitcoin Lightning network.

See: Everything You Need To Know About Multisig Wallets

Rollups 

Rollups are execution layers where users can perform numerous transactions. They achieve lower fees and faster transaction times by consolidating the data from these transactions into batches. These batches are then submitted to the Bitcoin consensus layer as single transactions. 

There are two types of Rollups: 

  • Optimistic Rollups: they batch transactions without prior validation, assuming all bundled transactions are valid unless proven otherwise. As a fail-safe, there is a 7-day challenge period during which suspicious transactions can be contested. If unchallenged within this period, the batch is accepted on the Bitcoin layer 1 chain.
  • Zero Knowledge (ZK) Rollups:  Unlike Optimistic rollups, Zero-Knowledge (ZK) rollups do not have a querying period because they perform preliminary validations on each transaction using a single cryptographic proof called a validity proof. As a result, transactions on ZK rollups are hashed into the Bitcoin main chain instantly.

Sidechains

Sidechains are semi-autonomous blockchains with their own consensus algorithms. Think of sidechains as standalone networks created as spin-offs from a parent chain, while still maintaining communication with the parent network.

Sidechains are connected to their Layer 1 chain via a two-way bridge, allowing the transfer of assets between chains. Since sidechains have their own blockchain architecture, they can support smart contracts and host decentralized applications. 

Apart from interacting with their parent chai via bridges, sidechains can also choose to integrate the security features of the main network, either as a complementary system or as the primary security facility for the sidechain. An example of a Bitcoin Layer 2 sidechain protocol is the Stacks Network. 

Challenges of Biction L2s 

Speed and Cost of Settling on Bitcoin Network: L2 solutions process transactions off-chain but must settle the final state on Bitcoin's mainchain. The speed and cost of this settlement process are significant factors affecting Layer2's efficiency.  Blockchains like Ethereum reduce this cost for its layer2 solutions with the Dencun upgrade.

Maintaining Security Without Direct Bitcoin Validation: Bitcoin L2s such as sidechains do not entirely inherit security from Bitcoin's nodes and must rely on their own independent security protocols, making it challenging to achieve Bitcoin's base layer security level.

Secure Bridging Between Bitcoin and L2 Networks: Bridging designs have security risks and user experience issues.  Since the current standard is still the same old locking of assets on the Bitcoin network and the minting of an equivalent on the sidechain. 

Vulnerabilities in cross-chain bridges have led to numerous cryptocurrency hacks and losses as hackers usually target them making them one loophole or flaw away from an exploit. 

Closing Thoughts  

Bitcoin Layer 2 solutions scale Bitcoin, reduce transaction fees, enable faster confirmation speeds, and support smart contracts. These advancements open up numerous possibilities within the Bitcoin ecosystem, potentially increasing BTC adoption as Bitcoin continues to dominate the crypto space.  

[Author’s Note: This article does not represent financial advice, everything written here is strictly for educational and informational purposes. Please do your own research before investing.

Author: Godwin Okhaifo  

Also Read: Understanding TPS: Which Blockchains Are the Fastest?