• Author: Biteye Core Contributor Fishery Isla

  • Editor: Biteye core contributor Crush

  • Community: @BiteyeCN

  • The full text is about 4,000 words and the estimated reading time is 8 minutes

When talking about Layer 2, most people will think of the many second-layer projects in Ethereum, such as Arbitrum, Zksync, Optimism, StarkWare, etc. Some people will say that the concept of Layer 2 originated from the Bitcoin Lightning Network and was later applied to Ethereum by Vtalik. Carry forward the above. These are all facts, just from a different perspective.

The concept of Layer 2 is not unique to Bitcoin or Ethereum, but is a general direction of expansion technology in blockchain technology.

Layer 2 refers to a set of off-chain solutions built on top of the main network, aiming to increase transaction throughput without sacrificing decentralization or security (knock on the blackboard!!).

As the narrative of BTC expansion continues to ferment, a variety of BTC Layer 2 projects have emerged. Layer 2 has gradually transformed from a technology-oriented blockchain expansion route into a vague marketing label.

This article will do a simple technical review of this project labeled BTC Layer 2. It should be noted that in this market dominated by enthusiasm, the impact of technology on the market is often secondary. At the same time, due to the author's own limitations, some technical views may differ from those of the outside world. Everyone is welcome to join the group discussion.

The full text does not constitute any investment advice.

The old topic that cannot be avoided is the difference between Layer 2 and side chain?

As mentioned above, the purpose of Layer 2 technology is to expand the capacity of the main network without sacrificing decentralization or security. Therefore, in a narrow sense, it is not a single technical concept, but includes a variety of different solutions and accomplish.

Currently, there are two most common types of Layer 2 technologies: State Channel and Rollups.

State channel refers to establishing a channel between two or more parties on the main network, and then conducting multiple transactions in the channel. Only when the channel is opened or closed, the transaction needs to be broadcast on the main network.

This solution is officially adopted by BTC's Lightning Network. In layman's terms, the channel of the Lightning Network can be understood as a multi-signature address. After Bob and Alice respectively deposit BTC to this channel (address) on the main network, the two parties proceed through the Lightning Network. Daily transactions.

These daily transactions do not go to the main network, thus saving expensive Gas. When one day, both parties think that there will no longer be transactions, both parties can initiate a withdrawal command to the main network. The signature of this command can prove to the BTC main network that both parties are on the main network. The authenticity of a series of transaction ledgers outside the mainnet.

At this moment, the security consensus of the main network will intervene to settle and lend money to Bob and Alice, so transactions that occur on the Lightning Network will also have the security level of the BTC main network. Currently, there is no precedent for implementing smart contracts in this solution.

You may be more familiar with Rollup. Optimistic Rollups and Zero-Knowledge Rollups on Ethereum are both Layer 2 extension solutions for Ethereum, aiming to move complex execution and state storage processes to Layer 2 to improve throughput.

In layman's terms, the mainnet will verify the Proof that Layer 2 submits to the mainnet regularly to ensure the authenticity of the Layer 2 ledger (this verification process is particularly important).

In this way, the main network can control the L2 ledger in "real time". When L2 funds cross back to the main network, the security consensus of the ETH main network will intervene. The Layer 2 lending contract of the main network can be used without relying on third-party information sources. Under this situation, only the data generated by the main network consensus will be used to verify whether the loan can be issued.

After reading this, I believe many readers will realize that the essence of traditional Layer 2 is a cross-chain bridge with the same security as the main network. With this awareness, we can well identify side chains.

Side chain refers to the establishment of an independent blockchain network (such as BSC) outside the main network. The consensus of the main network cannot identify the legality of the cross-chain behavior of the side chain.

The cross-chain bridge leading to the side chain locks and maps the assets on the main network to the side chain. Then the assets mapped on the side chain can realize functions such as transaction transfers. When the side chain returns to the main network, the cross-chain of the main network The bridge contract will only verify the authenticity of the loan message itself sent by the side chain across the chain, but will not verify the side chain's ledger.

In other words, if the cross-chain bridge project party does evil, signs maliciously, or directly creates fake accounts in the side chain, the funds on the main network will be lost.

It is not difficult to see that if we follow the traditional L2 definition, we can judge whether a chain is the key to Layer 2 by observing whether the main network can verify the ledger outside the main network.

With this concept, it is not difficult to explain why ETH was launched later than BTC, but it was able to overtake it and build Layer 2 asynchronously first.

Technical Difficulties of BTC Layer 2 - Verification

To understand the technical difficulties of BTC Layer 2, you must first understand the BTC Taproot upgrade that creates possibilities for BTC Layer 2.

Taproot was first proposed in 2018 by Bitcoin Core contributor Gregory Maxwell. Taproot is an improvement to the Bitcoin protocol, originally intended to improve the privacy and efficiency of Bitcoin transactions.

The core idea of ​​Taproot is to make transactions under multiple conditions look like ordinary single-sign transactions, thereby reducing the occupation and leakage of data on the chain, and allowing complex transactions (multi-sign, time lock) to be executed like a single Bitcoin transaction.

Taproot can The Taproot upgrade introduces two important technologies to create possibilities for BTC Layer 2 in the future.

1) MAST (Merklized Abstract Syntax Tree Merkel Abstract Syntax Tree);

2) Schnorr signature;

MAST is a structure that decomposes a complex script into multiple subscripts and organizes them into a Merkle tree. Only when the conditions of a subscript are met, the hash value and content of the subscript need to be exposed. This saves space, increases flexibility, and increases privacy.

Schnorr signature is a digital signature algorithm that can merge multiple signers into one and generate a single signature. This simplifies multi-signature transactions, reduces fees, improves security, and increases privacy.

MAST (Merkle Abstract Syntax Tree)

The significance of MAST is that before the Taproot upgrade, we could only implement complex script conditions by using P2SH addresses, and a redemption script with the same hash had to be generated and included in the transaction.

For the complex conditions of P2SH, the transaction volume will become extremely large. BTC in a P2SH address, you must generate a redemption script with the same hash and include it in the transaction. If there are too many spending conditions specified in the script, the transaction volume will become extremely large.

MAST can solve the above problems very well, which is why the development of BTC Layer 2 is possible.

MAST is a mechanism that combines Merkle trees and abstract syntax trees. It is similar to P2SH, which pays a script that specifies a hash, except that MAST pays a hash that specifies the Merkle root.

MAST assembles a large set of conditions into a hash tree, also known as a Merkle tree. In this tree, each node is a hash calculated from its children.

The root of the tree is a hash value that represents the set of all conditions. In this way, only the root hash needs to be included in the transaction, instead of listing all conditions, which can reduce the size of the transaction.

First, hash calculations are performed on all scripts (conditions) respectively; then the calculated hash values ​​are combined with adjacent hash values ​​for hash calculation to generate a new set of hash values. This process of pairwise hash calculation is repeated until the last hash value is calculated.

This hash value is the Merkle root.

MAST can associate Bitcoin transactions with a Merkle tree, where each leaf node in the tree represents a condition for unlocking Bitcoin.

To spend these locked Bitcoins, you need to construct an unlocking script that meets the conditions corresponding to a certain path on the Merkle tree.

The network only needs to verify whether the condition corresponding to this script belongs to the original set of conditions of the Merkle tree, that is, to verify whether this condition exists on the Merkle tree.

Once the network confirms that the script (and corresponding conditions) belongs to the Merkle root, it knows that the script meets the requirements for locking Bitcoin, and then proceeds to verify the unlocking script. This way we don't need to include the complete script in the transaction, thus reducing the size of Bitcoin transactions.

What needs to be said is that although MAST greatly reduces the space occupied by transaction scripts and provides the possibility of complex on-chain operations, the logic that can be realized by the syntax tree structure is relatively limited. Therefore, some claims that "MAST can implement smart contract-like functions on Bitcoin." are inaccurate.

At present, the BTC main network does not support the implementation of ledger verification functions like Ethereum Layer 2, which means that BTC Layer 2 cannot completely copy the technical architecture of ETH Layer 2. To ensure the security of the cross-chain bridge, another new one is needed. Path.

If Schnorr signature and MAST are combined, it can provide a new idea for the cross-chain bridge from the BTC main network to Layer 2. This technology is also the mainstream technical solution for BTC Layer 2 projects currently on the market.

Schnorr signature

Schnorr signature is a digital signature scheme proposed by Claus Schnorr and is famous for its simplicity and efficiency. Its advantage is that it can aggregate multiple signatures into a single signature, thereby optimizing the verification and authentication process in multi-signature scenarios.

For example, in a multi-signature transaction that requires 12 signatures, each signature may require 20 bytes of storage space, so a total of 240 bytes are needed to store these 12 signatures.

Schnorr signature can merge these 12 signatures into a unified Schnorr signature, which only requires about 60 bytes of space. This saves a lot of storage space, which can be used to accommodate more transaction script information.

Schnorr signatures provide privacy protection for all n-n multi-signature contracts. Among them, the most typical application is the Lightning Network payment channel, because it is essentially a 2-2 multi-signature contract.

For the general m-n (m<n) multi-signature contract, it can be expanded to the n-n situation. We can use MAST to collapse all possible unlocking conditions into a branch structure.

Taking 2-3 multi-signature as an example, it is equivalent to three situations: A and B unlocking or B and C unlocking or A and C unlocking. This can be viewed as a multi-condition script, where each condition is a 2-2 multisig, so it can also be defined with aggregated public keys instead of explicit multisigs.

This is the basis of the cross-chain technology currently used by STX, BEVM and other projects: cross-chain is achieved by creating BTC addresses controlled by hundreds of second-layer nodes.

Summary: BTC Layer 2 feasible development path

Based on the previous comparison, it is clear that a BTC Layer 2 solution cannot simply copy the design of Ethereum’s second layer, as there are inherent differences between the two.

To chart the right path forward, BTC Layer 2 solutions should focus on the core essence of security while taking into account Bitcoin’s unique properties.

The Bitcoin base layer uses a simple UTXO model and limited block space.

As mentioned above, even with the existence of MAST, the BTC main network is still unable to implement overly complex OP/ZKP verification logic.

This is doomed. Unlike Ethereum Rollup, BTC’s second-layer solution cannot regularly submit on-chain accountability records for verification. Storing data on the Bitcoin blockchain only serves as an availability checkpoint, not actual verification.

This is currently worrying the market. For BTC believers, without the verification of BTC consensus participation, the narrative of BTC Layer 2 will be lost; for old ETH users, the security of the technical solution is weaker than that of ETH Rollup. It won't be very attractive.

Decentralized cross-chain capability issues.

This is the definition of Layer 2 that is crucial. It is very difficult to achieve a cross-chain bridge that is as secure as the mainnet consensus on the BTC mainnet. Current traditional Bitcoin cross-chain technologies, such as hash/time locks, hooks, swaps, and multi-signatures, cannot provide sufficient trust guarantees.

The combination of MAST contracts and Schnorr signatures introduced in Bitcoin’s 2021 Taproot upgrade brings hope for decentralized Bitcoin cross-chain and is the main breakthrough point for the realized BTC Layer 2.

Compared with the on-chain verification of Rollups, the main direction that the BTC Layer 2 team currently under development needs to work on is to improve the security of cross-chain bridge signatures as much as possible.

As for achieving perfect Layer 2, only if Bitcoin can upgrade the BIP layer, miners update the underlying code, support OP/ZKP verification and calculation execution of Bitcoin miners, can a second-layer solution similar to ETH Rollup be achieved. What you need to know is that this will take a very long time, or it may never be adopted by miners.

about Us

Biteye is Asia's leading Web3 research community. It produces forward-looking investment research content and tools through community and AI-driven methods to help community members explore the Web3 rabbit hole.

WeChat group: add assistant @Biteye01 to join the group

Twitter:@BiteyeCN

Discord:Discord.gg/ME582FXR4F

This article takes an in-depth look at Bitcoin’s second-layer concept: it may be possible, but it may not be adopted by miners. It first appeared on Chain News ABMedia.