Exploring Bitcoin Layer 2's

Exploring Bitcoin Layer 2s: A Dive into Scalability Solutions

Introduction to Bitcoin's Scalability Challenges

Bitcoin, conceived as a decentralised peer-to-peer electronic cash system, has excelled in its decentralised promise. However, its potential as an everyday peer-to-peer payment system is compromised due to inherent scalability issues. Addressing these challenges without sacrificing the core principles of decentralisation and security has led to the development of a variety of Layer 2 (L2) solutions.

Bitcoin L2 Landscape

The Lightning Network: A Leading Solution

The most prominent L2 scalability solution for Bitcoin is the Lightning Network, which enhances transaction throughput using micropayment state channels. Conceived by Joseph Poon and Thaddeus Dryja in 2016, it has undergone continuous refinement ever since.

The Lightning Network operates on the principle of off-chain transactions, thereby reducing the load on the main blockchain, which is used only for final settlement. This network is an assembly of nodes running Lightning Network software, currently accounting for 13,413 nodes and 55,016 open channels. Notably, 4,705.29 BTC (approximately $244M) are locked within the network, emphasising that these figures represent the nodes that have elected to connect to block explorers, hinting at potentially higher actual numbers.

How the Lightning Network Functions

  1. Users initiate payment channels by locking Bitcoin in smart contracts, enabling transactions independent of the main blockchain.

  2. These channels facilitate continuous transactions, remaining active until participants opt to close them.

  3. Closure involves a final transaction to the main chain, updating the smart contract and redeeming the locked Bitcoin.

To elucidate, consider payment channels akin to open bar tabs, with the blockchain as the bartender and transactions as the ordered drinks. Lightning Network transactions are off-chain, akin to a tab where the final bill represents the sole transaction recorded on the main blockchain.

Technical Insights into the Lightning Network

Utilising Hash Time-Locked Contracts (HTLC), the Lightning Network secures funds and transactions, enabling transactions across existing payment channels for a nominal fee. BOLT (Basis of Lightning Technology) is instrumental in constructing the network, encompassing:

  • Core Lightning (CLN)

  • LND (Lightning Network Daemon)

  • Eclair

  • Electrum Lightning

The network does not operate as a parachain (as defined in the Polkadot ecosystem); rather, it functions independently from Bitcoin to enhance transaction throughput.

Challenges with the Lightning Network

Several concerns arise with the Lightning Network:

  1. Channel Management and Liquidity: Users must not only open but also maintain their channels, which require sufficient funding for the transactions they facilitate.

  2. User Experience: Both sender and receiver must be connected to the network, which can be cumbersome.

  3. Counterparty Risk: There's a risk associated with counterparts potentially closing channels without fulfilling their end of the deal, potentially leading to fund losses.

  4. Security Risks: The requirement for participants to be online, hence using hot wallets, poses a security risk, as these are more susceptible to breaches.

Rootstock (RSK): Enabling Smart Contracts

Rootstock represents an L2 smart contract platform that functions as a Bitcoin sidechain, allowing the deployment of EVM-compatible smart contracts and benefitting from Bitcoin's robust security. With over 50% of Bitcoin's hashing power through merged mining, Rootstock asserts substantial security for its network.

Operational Mechanisms of Rootstock

Rootstock's sidechain architecture emerges from a two-way peg to the Bitcoin blockchain, enabling users to transfer Bitcoin and receive RBTC (Rootstock Smart Bitcoin), which interacts with smart contracts on the RSK blockchain. Essentially, this allows users to engage with decentralised applications and execute complex contracts, bolstering Bitcoin's functionality. Furthermore, the Rootstock Virtual Machine (RVM) extends compatibility with Ethereum smart contracts.

$RBTC: The Native Coin of Rootstock

$RBTC enhances Bitcoin's utility within DeFi protocols and dApps on the Rootstock network, providing a seamless transition between the main chain and the sidechain without the need for token wrapping, maintaining a 1:1 peg to Bitcoin.

Stacks: Smart Contracts on Bitcoin

Stacks introduces smart contracts to Bitcoin without altering its fundamental protocol by operating as a sidechain. Viewing Bitcoin as a foundational layer, Stacks adds programmability and smart contract functionality on top of it.

PoX Consensus Mechanism of Stacks

PoX(Proof-of-Transfer) is the consensus mechanism used by Stacks and it consistsof stacks miners sending Bitcoin to a special address on the Bitcoin blockchain exchange for STX tokens on the Stacks blockchain.

Using an analogy to understand the PoX consensus:

  1. Imagine a city where new buildings (Stacks blocks) are being     constructed by builders (miners).

  2. However, instead of paying for the construction materials and land     use in the city's currency, builders pay for materials using the currency of a neighbouring city (Bitcoin) because it is a very stable and trusted     currency.

  3. At the same time, some citizens of the city had lent their land to build those buildings ($STX stakers), so, some of the used BTC in the construction is distributed to them as a reward.

  4. Not only Stacks builders use Bitcoin as currency, they are also     obligated to send reports about the construction progress back to Bitcoin city (Stacks blocks are recorded on Bitcoin).

 

As it can be appreciated, Stacks uses Bitcoin solely for its reputation and trust worthiness without needing to alter Bitcoin's foundation.

Connection to Bitcoin

Stacks connects toBitcoin by anchoring every Stacks block into a Bitcoin block. This means that the Stack’s blockchain state is continuously recorded on the Bitcoin blockchain. This ensures that Stacks inherits Bitcoin’s security and Stacks’ record becomes immutable.

The Hype - Are Bitcoin L2s really possible?

For context, let’s explore how Ethereum rollups work:

The core principle of rollups involves performing transaction execution outside the main chain and then sending the transaction data back to the main Ethereum network. Ethereum rollups come in different types: Optimistic and ZK rollups.

 ZK Rollups

Use zero-knowledge proofs to validate the transactions in a batch by leveraging those proofs as evidence that the transactions are valid and follow the rules of the Ethereum blockchain.

For these rollups, transactions are executed off-chain, a network of nodes generates transaction data and proofs of validity which are then submitted back to the main chain in the form of call data.

ZKRollups have 3 main components:

1. Transactions

Users sign transactions, which sends them to layer-two producing blocks and batches.

2. State Commitments

These are snapshots of the current L2’s state. These snapshots are later hashed and stored in the main chain as call data.

3. Zero-Knowledge validity proofs.

Proofs that serve as cryptographic validity guarantees of transactions in a batch being valid, that they follow Ethereum’s rules, and that they won’t mess with the blockchain’s state.

The data flow in a ZK rollup goes as follows:

Users sign transactions and send them to the operator.

Transactions are collected in an off-chain pool where the rollup operator will aggregate many transactions into a single batch.

The batch is processed off-chain which involves executing the transactions and updating the state accordingly.

After processing the transactions, the operator generates a ZK proof that says the transaction batch is valid. It also generates a State Commitment which is a hash that contains the updated state of the accounts after the batch was processed.

The main chain will quickly verify the ZK proof against the state commitment to ensure transactions’ authenticity.

Once verified, the main chain smart contract updates the blockchain’s state to reflect the new state commitment.

 Optimistic Rollups

The separate under a similar concept to ZK Rollups, with the main difference that optimistic rollups assume the transactions’ validity by default until proven otherwise. In a few words, the difference between ZK and Optimistic rollups relies on the way each of them validate proofs.

Considering this context and process of Ethereum ZK rollups, are they possible in Bitcoin, or more so, why are ZK rollups not possible on Bitcoin? In short, Bitcoin’s inability to support a rollup is due to its inability of running smart contracts.

 Smart contracts play a crucial role to run a range of computations within the rollup data flow.As it can be appreciated previously, there are several points in which data must be offloaded and uploaded from the layer 2 to the main chain and vice versa. In contrast, Bitcoin doesn’t support this on-chain logic.

The second reason is Ethereum is a stateful blockchain which means transactions can depend on data not only included within a transaction. On the other hand, Bitcoin is considered a stateless blockchain, meaning blocks don’t contain a complete copy of the entire state of the network. Instead, the blockchain only records transactions and data associated to them, such as the sender, recipient, and amount of Bitcoin transferred (Bitcoin only tracks UTXOs) and this makes it more difficult to build state-based solutions.

Lastly, Bitcoin’s consensus mechanism doesn’t align well with the implementation additional transactions and computations that will only lead to block space limitations.As mentioned above, a ZK Rollup requires not just the submission of proofs but also constantly updating the blockchain’s state.

While ZK Rollups are not natively possible on Bitcoin, there are projects that still explore ways to build similar solutions on Bitcoin. Nevertheless, due to the fundamental differences previously mentioned, all Bitcoin “L2s” are in reality sidechains can provide scalability and privacy.