Title: BTC Layer 2: Exploring the Technical Landscape
Author: Biteye | Core Contributor: Fishery Isla | Editor: Biteye | Core Contributor: Crush | Community: @BiteyeCN
When it comes to Layer 2, most people think of various Layer 2 projects on Ethereum, such as Arbitrum, Zksync, Optimism, and StarkWare. Some may also mention that the concept of Layer 2 originated from the Bitcoin Lightning Network and was later applied to Ethereum by Vitalik Buterin. These are all facts, but it depends on the perspective.
The concept of Layer 2 is not unique to Bitcoin or Ethereum but rather a major direction in blockchain technology for scalability.
Layer 2 refers to a set of off-chain solutions built on top of the mainnet, aiming to increase transaction throughput without sacrificing decentralization or security (emphasis on security!).
With the escalating narrative of Bitcoin scalability, a plethora of BTC Layer 2 projects have emerged. Layer 2 has gradually transformed from a technically-oriented blockchain scalability route into a vague marketing label.
This article will provide a simple technical overview of projects labeled with BTC Layer 2. It is important to note that in this market driven by hype, technical impact on the market is often secondary. Additionally, due to the limitations of the author, some technical viewpoints may differ from the outside world. Discussions are welcome in the group.
The content of this article does not constitute investment advice.
Table of Contents
Toggle
The Inescapable Topic: Difference Between Layer 2 and Sidechains?
Technical Challenges of BTC Layer 2—Validation
MAST (Merkleized Abstract Syntax Tree)
Schnorr Signature
Conclusion: Feasible Development Path for BTC Layer 2
About Us
As mentioned earlier, the purpose of Layer 2 technology is to scale the mainnet without sacrificing decentralization or security. Therefore, strictly speaking, it is not a single technical concept but encompasses various solutions and implementations.
Currently, the most common Layer 2 technologies fall into two categories: state channels and rollups.
State channels involve establishing a channel between two or multiple parties on the mainnet, where multiple transactions can take place within the channel. Transactions are only broadcasted on the mainnet when the channel is opened or closed.
Bitcoin’s Lightning Network officially adopts this approach. In simple terms, the channels in the Lightning Network can be understood as multi-signature addresses. After Bob and Alice deposit BTC into this channel (address) on the mainnet, they can conduct daily transactions through the Lightning Network.
These daily transactions do not occur on the mainnet, thus saving expensive gas fees. When the two parties no longer wish to transact, they can initiate a withdrawal command on the mainnet. The signature of this command can prove the authenticity of a series of off-chain transactions to the Bitcoin mainnet.
At this point, the mainnet’s security consensus will intervene to settle and disburse funds for Bob and Alice. Therefore, transactions that occur on the Lightning Network possess the same level of security as the Bitcoin mainnet. Currently, this approach does not support smart contracts.
Rollups, on the other hand, may be more familiar. Optimistic Rollups and Zero-Knowledge Rollups on Ethereum are Layer 2 scaling solutions aimed at moving complex execution and state storage processes to Layer 2 to increase throughput.
In simple terms, the mainnet verifies the proofs that Layer 2 regularly submits to the mainnet to ensure the authenticity of the Layer 2 ledger (this verification process is particularly important).
In this way, the mainnet can “real-time” control the L2 ledger. When funds return from Layer 2 to the mainnet, the security consensus of the Ethereum mainnet will intervene. The Layer 2 withdrawal contract on the mainnet can validate whether a withdrawal is possible based solely on data generated through the mainnet consensus, without relying on third-party information sources.
With this understanding, it becomes clear that the essence of traditional Layer 2 is a cross-chain bridge with the same security as the mainnet. This allows for the distinction between sidechains.
A sidechain refers to an independent blockchain network (e.g., BSC) established outside the mainnet, where the mainnet’s consensus cannot verify the legitimacy of cross-chain actions on the sidechain.
The cross-chain bridge to the sidechain locks and maps assets from the mainnet onto the sidechain, enabling functions such as transaction transfers. However, when the sidechain returns to the mainnet, the mainnet’s cross-chain bridge contract will only verify the authenticity of withdrawal messages from the sidechain itself and will not validate the sidechain’s ledger.
In other words, if a cross-chain bridge project acts maliciously, produces malicious signatures, or the sidechain directly creates fake ledgers, the funds on the mainnet will be at risk.
It is evident that, according to the traditional definition of Layer 2, observing whether the mainnet can verify a ledger outside the mainnet is crucial in determining whether a chain is a Layer 2 solution.
With this perspective, it is not difficult to explain why Ethereum, which was launched later than Bitcoin, was able to achieve a leapfrog by implementing Layer 2 solutions ahead of Bitcoin.
To understand the technical challenges of BTC Layer 2, one must first understand the BTC Taproot upgrade that creates possibilities for BTC Layer 2.
Taproot was initially proposed by Bitcoin Core contributor Gregory Maxwell in 2018. It is an improvement to the Bitcoin protocol aimed at enhancing transaction privacy and efficiency.
The core idea of Taproot is to make transactions under various conditions appear as ordinary single-signature transactions, thereby reducing the occupation and leakage of on-chain data and enabling complex transactions (multi-signature, time locks) to be executed like single Bitcoin transactions.
Taproot introduces two important technologies that create possibilities for future BTC Layer 2 implementations:
1) MAST (Merkleized Abstract Syntax Tree)
2) Schnorr Signature
MAST is a mechanism that decomposes complex scripts into multiple sub-scripts and organizes them into a Merkle tree structure. Only when a sub-script’s condition is met is it necessary to disclose the sub-script’s hash value and content. This saves space, improves flexibility, and enhances privacy.
Schnorr Signature is a digital signature algorithm that allows multiple signers to merge into a single signer and generate a single signature. This simplifies multi-signature transactions, reduces costs, enhances security, and increases privacy.
MAST’s significance lies in the fact that, before the Taproot upgrade, achieving complex script conditions could only be done by using P2SH addresses and generating redeem scripts with the same hash value and including them in transactions.
However, if the spending conditions specified in the script are too complex, the transaction size becomes excessively large. MAST effectively solves this problem, enabling the development of BTC Layer 2.
MAST combines the Merkle tree with abstract syntax trees. It is similar to P2SH in that payment is made to a script with a designated hash value, but MAST pays to a script with a designated Merkle root hash value.
MAST assembles a large set of conditions into a hash tree, also known as a Merkle tree. In this tree, each node’s hash value is calculated from its child nodes. The root of the tree is a hash value representing the entire set of conditions. This way, only the root hash needs to be included in the transaction, rather than listing all the conditions, reducing the transaction size.
First, each script (condition) is hashed individually. Then, the calculated hash value is combined with adjacent hash values for further hashing, generating a new set of hash values. This two-step hashing process is repeated until the final hash value is calculated. This hash value is the Merkle root.
MAST allows Bitcoin transactions to be associated with a Merkle tree, where each leaf node on the tree represents a condition for unlocking Bitcoin. To spend these locked bitcoins, one must construct an unlocking script that matches a path on the Merkle tree.
The network only needs to verify whether the script’s corresponding condition belongs to the original set of conditions on the Merkle tree. In other words, it verifies whether the condition exists on the Merkle root. Once the network confirms that the script (and its corresponding conditions) belongs to the Merkle root, it knows that the script meets the requirements for unlocking bitcoins and can proceed to verify the unlocking script. This eliminates the need to include the complete script in the transaction, reducing the size of Bitcoin transactions.
It should be noted that although MAST significantly reduces the space occupied by transaction scripts and provides possibilities for complex on-chain operations, the logic that syntax trees can achieve is relatively limited. Therefore, claims such as “MAST can achieve smart contract-like functionality on Bitcoin” are inaccurate.
Currently, the BTC mainnet does not support the implementation of ledger validation similar to Ethereum Layer 2. This means that BTC Layer 2 cannot simply replicate the technical architecture of ETH Layer 2. To ensure the security of cross-chain bridges, a different approach is required.
By combining Schnorr Signature with MAST, a new approach can be provided for BTC mainnet to Layer 2 cross-chain bridges. This combined technology is currently the mainstream technical solution in BTC Layer 2 projects.
Schnorr Signature is a digital signature scheme proposed by Claus Schnorr, known for its simplicity and efficiency. Its advantage lies in its ability to aggregate multiple signatures into a single signature, optimizing the verification and authentication process in multi-signature scenarios.
For example, in a multi-signature transaction that requires 12 signatures, each signature may occupy 20 bytes of storage, resulting in a total of 240 bytes to store the 12 signatures. However, Schnorr Signature can merge these 12 signatures into a unified Schnorr Signature that requires approximately 60 bytes of space. This saves a significant amount of storage space, which can be used to accommodate more transaction script information.
Schnorr Signature provides privacy protection for all n-n multi-signature contracts. The most typical application is in payment channels of the Lightning Network, as it is essentially a 2-2 multi-signature contract.
For general m-n (m < n) multi-signature scenarios, such as a 2-3 multi-signature, it is equivalent to A or B unlocking, B or C unlocking, or A or C unlocking. This can be seen as a multi-condition script, where each condition is a 2-2 multi-signature, and can also be defined using aggregated public keys instead of explicit multi-signatures. This is the basis for cross-chain technologies adopted by projects such as STX and BEVM: achieving cross-chain through the control of BTC addresses by hundreds of Layer 2 nodes. Based on the comparison above, it is clear that BTC Layer 2 solutions cannot simply copy the design of Ethereum Layer 2 because there are inherent differences between the two. To plan the correct path forward, BTC Layer 2 solutions should focus on the core essence of security while considering Bitcoin's unique properties. The Bitcoin base layer adopts a simple UTXO model and has limited block space. As mentioned earlier, even with MAST, the BTC mainnet cannot implement overly complex OP/ZKP verification logic. This means that, unlike Ethereum Rollups, BTC Layer 2 solutions cannot regularly submit responsibility records on-chain for verification. Storing data on the Bitcoin blockchain can only serve as availability checkpoints and cannot be used for actual verification. This is a concern in the market. BTC believers believe that without BTC consensus participation in verification, the narrative of BTC Layer 2 is lost. For ETH users, a technical solution with weaker security than ETH Rollup may not be very attractive. The issue of decentralized cross-chain capability is critical. This is the definition of Layer 2 and achieving a cross-chain bridge on the BTC mainnet that is as secure as the mainnet consensus is challenging. Traditional Bitcoin cross-chain technologies, such as hash/time locks, pegs, swaps, and multi-signatures, cannot provide sufficient trust guarantees. The combination of MAST contracts introduced in the Bitcoin Taproot upgrade in 2021 and Schnorr Signatures brings hope for decentralized Bitcoin cross-chain bridges and represents a major breakthrough in realizing BTC Layer 2. Compared to on-chain verification in Rollups, the current focus for BTC Layer 2 teams in development is to maximize the security of cross-chain bridge signatures. As for achieving a perfect Layer 2, only Bitcoin can upgrade the BIP layer, and miners need to update the underlying code to support OP/ZKP verification and computational execution by Bitcoin miners in order to achieve Layer 2 solutions similar to ETH Rollup. It is worth noting that this will take a very long time and may never be adopted by miners. Biteye is a leading Web3 research community in Asia that generates forward-thinking research content and tools through community and AI-driven methods to help community members explore the Web3 rabbit hole. WeChat Group: Add the assistant @Biteye01 to join the group Twitter: @BiteyeCN Discord: Discord.gg/ME582FXR4F L2 MAST Bitcoin