Author: Biteye core contributor Fishery Isla

Editor: Crush, core contributor of Biteye

Community: @BiteyeCN

*The full text is about 4000 words, and the estimated reading time is 8 minutes

When talking about Layer 2, most people will think of Ethereum's second-layer projects, such as Arbitrum, Zksync, Optimism, StarkWare, etc. Some people also say that the concept of Layer 2 originated from Bitcoin's Lightning Network, and was later applied to Ethereum by Vtalik. These are all facts, but from different perspectives.

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

Layer 2 refers to a set of off-chain solutions built on top of the mainnet that aims to increase transaction throughput without sacrificing decentralization or security (pay attention!!).

As the BTC expansion narrative continues to ferment, a variety of BTC Layer 2 projects have emerged. Layer 2 has gradually changed from a technology-oriented blockchain expansion route to 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 popularity, 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 the outside world. Welcome to join the group discussion.

The full text does not constitute any investment advice.

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 implementations.

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

A state channel refers to establishing a channel between two or more parties on the mainnet, and then conducting multiple transactions within the channel. Transactions need to be broadcast on the mainnet only when the channel is opened or closed.

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 deposit BTC into this channel (address) respectively on the main network, the two parties conduct daily transactions through the Lightning Network.

These daily transactions are not on the main network, thus saving expensive Gas. One day, when both parties believe that they will no longer conduct transactions, they can initiate a withdrawal command to the main network. The signature of this command can prove to the BTC main network the authenticity of a series of transaction ledgers between the two parties outside the main network.

At this point, the main network's security consensus will intervene to settle and release funds for Bob and Alice, so transactions on the Lightning Network will have the security level of the BTC main network. Currently, there is no precedent for implementing smart contracts with this solution.

Everyone may be more familiar with Rollup. Optimistic Rollups and Zero-Knowledge Rollups on Ethereum are both Ethereum's Layer 2 expansion solutions, which aim to move complex execution and state storage processes to Layer 2 to increase 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 the L2 funds cross back to the main network, the security consensus of the ETH main network will intervene. The Layer 2 loan contract of the main network can verify whether the loan can be issued based solely on the data generated by the main network consensus without relying on third-party information sources.

After reading this, I believe many readers can 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 identify side chains well.

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

The cross-chain bridge to the sidechain locks the assets on the mainnet and maps them to the sidechain. The assets mapped on the sidechain can then realize functions such as transaction transfers. When the sidechain returns to the mainnet, the cross-chain bridge contract of the mainnet will only verify the authenticity of the loan message issued by the sidechain cross-chain, but will not verify the sidechain's ledger.

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

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

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

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 by Bitcoin Core contributor Gregory Maxwell in 2018. Taproot is an improvement to the Bitcoin protocol that was originally intended to improve the privacy and efficiency of Bitcoin transactions.

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

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

1) MAST (Merklized Abstract Syntax Tree);

2) Schnorr signature;

MAST is a structure that breaks down a complex script into multiple sub-scripts and organizes them into a Merkle tree. The hash value and content of a sub-script only need to be disclosed when the conditions of a sub-script are met. This can save space, improve flexibility, and increase privacy.

Schnorr signature is a digital signature algorithm that can merge multiple signers into one signer and generate a single signature. This can simplify multi-signature transactions, reduce costs, improve security, and increase privacy.

The significance of MAST is that before the Taproot upgrade, if we want to implement complex script conditions, we can only do so by using a P2SH address, and we must generate a redemption script with the same hash value and include it in the transaction.

For complex conditions of P2SH, the transaction size will become extremely large. For the BTC in the P2SH address, you must generate a redemption script with the same hash value and include it in the transaction. If there are too many spending conditions specified in the script, the transaction size 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 the Merkle tree and the abstract syntax tree. It is similar to P2SH, which is to pay for the script with a specified hash value, but the difference is that MAST pays for the hash value of the specified Merkle root.

MAST assembles a large set of conditions into a hash tree, also known as a Merkle tree, in which each node is the hash value calculated by its child nodes.

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, without listing all the conditions, which reduces the transaction size.

First, hash all scripts (conditions) separately; then combine the calculated hash values ​​with adjacent hash values ​​to generate a new set of hash values. Repeat this process of two-by-two hash calculations 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 on 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 path on the Merkle tree.

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

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

It should be noted that although MAST greatly reduces the space occupied by transaction scripts and provides the possibility for complex on-chain operations, the logic that can be implemented by the syntax tree structure is relatively limited. Therefore, some claims that "MAST can implement functions similar to smart contracts on Bitcoin" are inaccurate.

Currently, the BTC mainnet 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. If you want to ensure the security of the cross-chain bridge, you need to find another way.

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

Schnorr signature is a digital signature scheme proposed by Claus Schnorr, which 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 take up 20 bytes of storage space, so a total of 240 bytes are required to store these 12 signatures.

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

Schnorr signatures can 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

Taking 2-3 multi-signature as an example, it is equivalent to three situations: A and B unlock, B and C unlock, or A and C unlock. This can be regarded as a multi-conditional script, each condition is a 2-2 multi-signature, so it can also be defined by aggregated public key instead of explicit multi-signature.

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

Based on the previous comparison, it is clear that the 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.

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

This means that unlike Ethereum Rollup, Bitcoin’s second-layer solution cannot regularly submit on-chain liability records for verification. Storing data on the Bitcoin blockchain can only serve as a availability checkpoint, but cannot be actually verified.

This is currently a concern for 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, technical solutions that are less secure than ETH Rollup will not be very attractive.

This is a crucial Layer 2 definition. It is very difficult to achieve a cross-chain bridge with security equivalent to the main network consensus on the BTC main network. Currently, 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 a major breakthrough in the realization of BTC Layer 2.

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

As for achieving a perfect Layer 2, only when Bitcoin can upgrade the BIP layer and miners update the underlying code to support OP/ZKP verification and Bitcoin miners' computational execution can a second-layer solution similar to ETH Rollup be achieved. It should be noted 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, producing forward-looking investment research content and tools through a community and AI-driven approach to help community members explore the Web3 rabbit hole.

WeChat group: add assistant @Biteye01 to join the group

Twitter:@BiteyeCN

Discord:Discord.gg/ME582FXR4F

*Disclaimer: The content of this article is for learning and communication only, does not constitute any investment advice, and does not represent the position of Biteye. If you like our articles, please follow us!