paint-brush
What are Layer 2 Solutions on Bitcoin and How Do They Work?by@defidiver
New Story

What are Layer 2 Solutions on Bitcoin and How Do They Work?

by DeFi DiverJune 25th, 2024
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Layer 2 solutions for Bitcoin, such as state channels, rollups, and sidechains, aim to enhance scalability and performance by processing transactions off-chain. This reduces fees and increases transaction speeds, paving the way for advanced applications like DeFi and smart contracts within the Bitcoin ecosystem.
featured image - What are Layer 2 Solutions on Bitcoin and How Do They Work?
DeFi Diver HackerNoon profile picture


The state of the crypto market largely depends on Bitcoin's value. However, its blockchain scales poorly, especially given the instrument's growing popularity. The Bitcoin network can process an average of 7 transactions per second, which is not enough for its use as a payment system. In addition, the cost of transfer fees is also increasing.


Over time, the problems can only get worse. That's why projects are proposing Layer 2 (L2) solutions that can remedy the situation. Today, I want to discuss what are L2s for Bitcoin and what prospects they have.

What are Layer 2 solutions on Bitcoin?


Layer 2 (L2) solutions for Bitcoin are protocols built on top of the first cryptocurrency's blockchain. These add-ons are designed to improve the network's performance and enhance its capabilities.


L2 solutions process transactions beyond the base (first) layer, reducing the load on it and providing some benefits:

  • Increased scalability
  • Enhanced programmability
  • Significant potential to support decentralized applications (dApps)


Such technologies play a key role in solving the blockchain trilemma. They also contribute to the development and expansion of the Bitcoin ecosystem.


Many market participants primarily associate Bitcoin with a means of preserving value. L2 solutions transform Bitcoin into a much more functional cryptocurrency capable of supporting complex applications and systems.

What problems are L2 solutions solving on Bitcoin?


Bitcoin was originally conceived as a decentralized and secure payment system. However, as its popularity grew and the industry matured, the first cryptocurrency faced serious limitations in the context of scaling.


The average block creation time of 10 minutes and a throughput of 7 transactions per second (TPS) could not handle the load during peak activity periods. This resulted in higher fees and significant delays in transaction processing. The limitations of the Bitcoin Script language hindered the development of complex smart contracts and dApps. In response, the concept of Layer 2 networks for the first cryptocurrency emerged.


The use cases of the new solutions go beyond solving scalability problems. It is an opportunity to realize radically new scenarios in the Bitcoin ecosystem:


  • Advanced programming capabilities. L2 solutions enable complex smart contracts in the Bitcoin blockchain. This paves the way for the development of decentralized finance, non-fungible tokens (NFT), and other Web3 trends.


  • DeFi on Bitcoin. L2 solutions like Lightning Network and Stacks allow users to make cheap transactions without intermediaries, trade, lend and borrow, etc.


  • This solves the scaling trilemma. Bitcoin L2 solutions help provide a balance of decentralization, security, and performance. Bitcoin network prioritizes the first two aspects, while L2 solutions allow for significantly improved scalability.


As you can see, Layer 2 solutions can greatly change the Bitcoin network.

How do Bitcoin L2 solutions work?


Layer 2 Bitcoin solutions process off-chain transactions, reducing the load on the first layer. Users can conduct multiple transactions without having to write each transaction directly to the blockchain. This increases throughput and drastically reduces fees, making retail payments more practical.


The main approaches to implementing Bitcoin L2:

  • State channels. Solutions like the Lightning Network enable transactions between participants instantly and with almost no fees.
  • Rollups. Multiple transactions are combined into a single bundle that is validated in a Bitcoin blockchain.
  • Sidechains. Separate blockchains with their own consensus mechanism are linked to the Bitcoin network by a two-way peg.


Let’s start with state channels.

What are state channels in the Bitcoin blockchain?


Let's take a closer look at the basic principles of state channels.


Crypto transactions are essentially the interaction of two wallets with a blockchain consensus layer. The state of the network changes after each transaction, requiring validation before updating. As an L2 solution, the technology enables fast and cheap transactions between parties within dedicated channels. A multi-sig address is also generated to hold funds on behalf of the parties.


Changes due to asset transfers are recorded outside the main blockchain. Each new transaction overwrites the previous state. Such communication can continue for as long as desired. At the end of the session, the channel is closed. The final information with balances from the last transaction is sent to the main network as a single transaction, after which the state of the blockchain is updated.


State channels speed up transactions and save money through low fees. This is especially noticeable for a series of transfers.

An example of such a solution is the Lightning Network.

What is Lightning Network?


Lightning Network (LN) is a Layer 2 solution for the Bitcoin blockchain. It is a network of payment channels between users. Satoshi Nakamoto proposed a similar concept. In 2009, he presented a code outline to the community, which envisioned the creation of special channels between users.


In February 2015, Bitcoin developers Joseph Poon and Thaddeus Dryja started working on the LN. They published a document called The Bitcoin Lightning Network. In August 2017, the Bitcoin network activated the Segregated Witness soft fork, a necessary update to the Lightning Network implementation. The Lightning Labs team released a test version of the LN in March 2018. At that time, the network already had over 1,000 nodes running and 1,863 open channels.



The Layer 2 payment protocol conducts transactions between two parties outside the Bitcoin mainnet. The scaling network is capable of processing up to one million transactions per second, far exceeding the capabilities of the main blockchain.


Both parties take Bitcoins to a multi-sig address to open an LN channel. Participants conduct transactions within the channel using the funds on the address, and Lightning Network software is responsible for updating wallet balances. After the channel is closed, the network sends transaction data to the Bitcoin blockchain in a single transaction.


Lightning Network allows an unlimited number of transactions for the price of one, which significantly saves fees and provides high speed. Since its launch, the LN has been widely used. Many trading platforms have integrated the network, and some centralized exchanges have used it for deposits and withdrawals.



As of 16 June 2024, 13,680 LN nodes were connected by 51,880 payment channels. According to 1ML, the micropayment network's capacity is 4,998 BTC.

What are sidechains in the Bitcoin blockchain?


Sidechains offer a way to conduct transactions without burdening the mainnet. They are separate blockchains that are linked to the mainnet and have a degree of autonomy. Unlike state channels, these solutions utilize proprietary consensus algorithms and other approaches.


Independent networks can differ radically in architecture from the first layer. In the case of Bitcoin, sidechains enable smart contracts and can form the basis of complex protocols like decentralized exchanges (DEX).


Linked to the mainnet via bridges, sidechains empower the ecosystem. Thanks to special smart contracts that block a certain amount in one network and release the equivalent in another, users can transfer assets between chains.


There are different approaches to implementing sidechains, including in the context of security issues. Some use their own security system: they are independent of the underlying blockchain and are linked to it only by the ability to exchange resources. Other sidechains are more or less integrated into the security mechanisms of the main network.


Stacks and the Rootstock Infrastructure Framework (RIF) are well-known examples of such solutions for Bitcoin.

What is Rootstock (RIF)?


Rootstock Infrastructure Framework (RIF) is a sidechain that supports the Ethereum Virtual Machine. The network, which inherits the security of Bitcoin, uses the Proof-of-Work consensus algorithm. The two-way PoWPeg protocol provides interconnection with the Bitcoin network. PoWPeg protocol is responsible for the seamless transfer of assets between chains.


To transfer BTC to the Rootstock network, users lock their Bitcoins into the sidechain's smart contract and issue an equivalent amount of RBTC. These coins can be used for fast and inexpensive transactions. The consensus in Rootstock is similar to the mechanism in the Bitcoin network, which also runs on Proof-of-Work. Cryptocurrency miners can confirm blocks on both chains in parallel—this is called merged mining.


Active participants in the Rootstock network are rewarded in RBTC. An execution layer capable of handling advanced smart contracts significantly expands Bitcoin's functionality. Among the key components of RIF are:


  • RIF Wallet
  • RIF DeFi Gateways for accessing decentralized financial services
  • RIF Rollup payment solution
  • RIF Relay, which allows transaction fees to be paid with ERC-20 tokens
  • RIF Flyover, a bridge for BTC transfers


RIF serves as the ecosystem's utility token. In December 2023, Uniswap, the largest decentralized exchange, integrated the Rootstock sidechain. TVL of the Rootstock ecosystem is approaching the $200 million mark.

What is Stacks Network?


Stacks offers Bitcoin-compatible smart contracts and relies on the blockchain's security. Bitcoin's semi-autonomous sidechain runs on a unique Proof of Transfer (PoX) consensus algorithm. The latter combines Proof-of-Stake and Proof-of-Burn, linking Bitcoin miners and Stacks stakers.


Miners use BTC to gain the right to validate blocks in the sidechain, earning rewards in STX. The blockchain validates the STX stakers, and they earn rewards in BTC. Instead of directly using the Bitcoin blockchain, Stacks relies on miners on that network for validation. The bridge enables the movement crypto assetsets between networks, and SBTC is Stacks' version of BTC.



The platform supports smart contracts and DeFi applications. As of 16 June 2024, the total value locked (TVL) on Stacks is almost $130 million.

What is Liquid Network?


Liquid Network from Blockstream is the most well-known Bitcoin-based sidechain. The solution is built on the source code of the Elements project (Bitcoin's code base was used for it). However, in Liquid Network, the block creation time has been reduced from 10 minutes to 1 minute by reducing decentralization.


Liquid Network does not have a native asset. Instead, it uses a similarity to the "wrapped" token L-BTC. The latter is issued when Bitcoins are transferred from the native blockchain to the sidechain. L-BTC is backed by BTC at a 1:1 ratio.


Blockstream's sidechain has confidential transaction features.



However, a Liquid Network cannot be called a decentralized blockchain like Bitcoin. The project is managed by its government - a relatively small group of organizations distributed worldwide and independent of each other. By the way, a small volume of Tether (USDT) stablecoins exists on the Liquid Network blockchain.

What are Rollups in the Bitcoin blockchain?


Rollups are L2s built on top of the core network and act primarily as a transaction execution layer. They speed up transactions and significantly reduce fees. Rollups collect transactions into packets transmitted to the core network (L1) for final validation. A single packet can include up to 10,000 transactions.


Many rollup solutions utilize a zero-knowledge proof method. Such technologies are grouped together under the name ZK-Rollups. The Rollkit platform developed by Celestia Labs has created a modular framework to support sovereign rollups on the Bitcoin blockchain. Rollkit allows developers to create rollups with arbitrary execution environments that inherit Bitcoin's data availability guarantees and resilience to reorganization. Rollkit technology optimizes block space, reduces commissions, and allows the implementation of DeFi solutions on the Bitcoin network.


Rollkit emphasized that the project became possible thanks to the Taproot update. The path to the solution was shown by the Ordinals protocol for issuing NFTs on the Bitcoin blockchain. The latter demonstrated how arbitrary data could be published in blocks. The developers noted that there were just two functions left to implement: sending and retrieving rollups.


Rollkit supports customizable execution tiers, including EVM, CosmWasm, and Cosmos SDK. To test the integration, the project team used a local Bitcoin testnet and Ethermint to run the Ethereum Virtual Machine (EVM). Merlin Protocol is another example of a rollup project for the Bitcoin network.

What is the Merlin Protocol?


Merlin Protocol is a rollup project that is positioned as "a pioneer in adapting valuable Bitcoin assets to EVMs, overcoming the limitations of the first cryptocurrency network". Thanks to Particle Network's BTC Connect protocol, users can access the network directly through their Bitcoin wallets.


Merlin Protocol utilizes ZK-Rollups technology to achieve scalability. The finalization of "rolled-up" transactions takes place on the Bitcoin blockchain. The developers claim that this approach provides the highest level of security.


The protocol provides a good user experience and supports Web3 wallets like MetaMask. Projects created on Ethereum and other EVM networks can be ported to Merlin Protocol with virtually no changes to the source code. The network supports BRC-20 and ERC-standard tokens. The first DeFi applications are already appearing on Merlin, and TVL exceeds $1,2 billion.

What is SatoshiVM?


SatoshiVM is an EVM-compliant L2 Bitcoin solution based on ZK-Rollups technology. It provides high transaction speeds with low fees while supporting decentralization and a high level of security.


BTC is the native asset of the SatoshiVM network, which is used to pay for gas. Bitcoins moved to the second layer can be blocked in DeFi applications. They can also be leveraged with SARC20 standard "inscriptions".

What are the pitfalls of Layer 2 solutions on Bitcoin?


Sidechains and L2 solutions in the Bitcoin ecosystem use bridges to interact with the first layer. The classic operation scheme of such tools involves blocking assets in the Bitcoin blockchain and simultaneously issuing their equivalents in the second-level network.


However, this approach is inherently vulnerable and fraught with security problems—bridges built according to this scheme have repeatedly fallen victim to hacker attacks. The cumulative losses amount to billions of dollars. Despite attempts to create better bridging protocols, many L2 solutions for Bitcoin remain dependent on the potentially insecure block-and-release model.


Rollups and state channels are only completed after finalization in the core network. The speed and cost of such operations determine the efficiency of L2 solutions. Many solutions on the market have already proven their viability, but further improvements are needed.

How are L2 solutions evolving on Bitcoin?


L2 solutions will continue to evolve, expanding the functionality and improving the performance of the Bitcoin network.


Binance, the largest cryptocurrency exchange, completed the integration of the Lightning Network. Users can now deposit and withdraw Bitcoins through this Layer 2 protocol. The integration demonstrates the growing popularity of L2 solutions, which could serve as a driver for significant innovation in the ecosystem's scalability and usability.


Many potential areas of development are summarized below:

  • Technological improvements. Advances in cryptographic techniques and consensus algorithms can improve the security, reliability, and friendliness of L2 solutions in the context of user experience.


  • Widespread adoption. Increased awareness of new technologies could lead to increased adoption among ordinary market participants and organizations.


  • Integration with TradFi. L2 networks for Bitcoin can integrate more closely with traditional financial systems, paving the way for innovative products and services.


  • Focus on user experience. Developers will focus on improving the UX to attract a wider audience.


  • Collaboration and standardization. Closer cooperation between L2 projects is possible, leading to standardization and the possibility of interoperability between different solutions.


Casa co-founder and CTO Jameson Lopp, in October 2023, encouraged developers to experiment more with Bitcoin to expand and improve its ecosystem. He noted the feasibility of creating new solutions on "related but different protocols from Bitcoin" so that the first cryptocurrency's code doesn't have to be constantly modified. In particular, he noted the recent L2 solutions - drivechains, Spiderchain and BitVM. In his opinion, they allow the "unloading" of the mempool and expand the possibilities of smart contracts on Bitcoin.

Conclusion

Layer 2 solutions for Bitcoin are likely to be one of the upcoming trends. Huge assets are actually "lying idle" in holders' wallets instead of being used in decentralized protocols.


Layer 2 solutions are extremely important for developing the Bitcoin ecosystem. They address key challenges and create new opportunities for mass adoption of cryptocurrencies. With the further development of the crypto market, users will increasingly think about using Bitcoin more efficiently. The sooner developers can offer them better L2 products, the more functional the industry will become.