With the continuous fermentation of the Bitcoin scaling narrative, a large number of Bitcoin Layer 2 projects have emerged recently. However, unlike Ethereum Layer 2 networks, BTC Layer 2 is gradually evolving into a vague marketing label as it follows a technology-oriented blockchain scaling route.
Bitcoin’s base layer adopts a simple UTXO model with limited block space. However, it faces the problem of decentralized cross-chain capabilities.
When it comes to Layer 2, most people would think of various Ethereum Layer 2 projects, such as Arbitrum, Zksync, Optimism, StarkWare, etc. Some would even say that Layer 2 concepts originated from the Bitcoin Lightning Network and were later applied and developed by Vitalik on Ethereum. These are all facts, but it depends on different perspectives.
The concept of Layer 2 is not unique to Bitcoin or Ethereum but rather a major direction of scaling technology in blockchain. 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 continuous fermentation of Bitcoin scaling narrative, a variety of BTC Layer 2 projects have emerged. Layer 2 is gradually shifting from a technology-oriented blockchain scaling route to a vague marketing label.
This article will provide a simple technical analysis of projects labeled with BTC Layer 2. It should be noted that in this market dominated by popularity, the influence of technology on the market is often secondary. Also, due to the limitations of the author, some technical perspectives may differ from the outside world. Welcome to discuss.
Can’t avoid the old topic: the difference between Layer 2 and sidechains?
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 includes various different solutions.
Currently, the most common Layer 2 technologies fall into two categories: state channels and rollups.
State channels refer to establishing a channel between two or more parties on the mainnet and conducting multiple transactions within the channel. Transactions only need to be broadcasted on the mainnet when the channel is opened or closed.
Bitcoin’s Lightning Network adopts this approach. In simple terms, the Lightning Network’s channel can be understood as a multi-signature address. After Bob and Alice deposit BTC into this channel (address) on the mainnet, they can carry out daily transactions through the Lightning Network.
These daily transactions do not occur on the mainnet, thus saving expensive gas fees. When the two parties decide that they will no longer 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 between the two parties outside the mainnet.
At this moment, the mainnet’s security consensus will intervene to settle and release funds for Bob and Alice. Therefore, the transactions that occur on the Lightning Network possess the same level of security as the Bitcoin mainnet. However, this solution has not yet implemented smart contracts.
Further reading:
Seven Years of Grinding “Bitcoin Lightning Network”: An Analysis of Challenges and Future
Rollups may be more familiar to everyone. Optimistic Rollups and Zero-Knowledge Rollups on Ethereum are Layer 2 expansion suite solutions aimed at moving complex execution and state storage processes to Layer 2 to increase throughput.
Simply put, the mainnet will verify the proofs submitted by Layer 2 to ensure the authenticity of Layer 2’s ledger (this verification process is particularly important).
In this way, the mainnet can “instantly” monitor the L2 ledger. When L2 funds are transferred back to the mainnet, the security consensus of the ETH mainnet will intervene. The mainnet’s Layer 2 withdrawal contract can verify whether the withdrawal is possible based solely on data generated by the mainnet consensus without relying on third-party information sources.
By reaching this point, many readers may realize that the essence of traditional Layer 2 is a cross-chain bridge with the same security as the mainnet. With this awareness, we can better distinguish sidechains.
Sidechains refer to establishing an independent blockchain network (such as BSC) outside of the mainnet. The mainnet’s consensus cannot verify the legitimacy of cross-chain behavior on the sidechain.
The cross-chain bridge to the sidechain locks assets on the mainnet and reflects them onto the sidechain. The assets reflected on the sidechain can then be used for transactions and transfers. When the sidechain returns to the mainnet, the mainnet’s cross-chain bridge contract will only verify the authenticity of the withdrawal message sent by the sidechain and will not verify the sidechain’s ledger.
In other words, if a malicious signature is performed by the cross-chain bridge project or if the sidechain directly creates a false ledger, the funds on the mainnet will be at risk of loss.
It is evident that observing whether the mainnet can verify a ledger outside of the mainnet is crucial in determining whether a chain is a Layer 2 solution, according to the traditional definition.
With this understanding, it is not difficult to explain why Ethereum, which was launched later than Bitcoin, can achieve a breakthrough and take the lead in implementing Layer 2.
Further reading:
Ethereum Layer 2 | Why are DeFi projects migrating to sidechain Polygon, which has seen a 100-fold increase this year?
The technical challenges of BTC Layer 2 — Verification
To understand the technical challenges of BTC Layer 2, we must first understand the BTC Taproot upgrade that creates possibilities for BTC Layer 2.
Taproot was first proposed by Gregory Maxwell, a Bitcoin Core contributor, in 2018. Taproot is an improvement to the Bitcoin protocol that aims to enhance the privacy and efficiency of Bitcoin transactions.
The core idea of Taproot is to make transactions under various conditions appear as ordinary single-key transactions, thereby reducing the occupation and leakage of on-chain data and making complex transactions (multisig, timelocks) execute like single Bitcoin transactions.
The Taproot upgrade introduces two important technologies to enable future BTC Layer 2 possibilities.
1) MAST (Merklized Abstract Syntax Tree)
2) Schnorr signatures
MAST involves decomposing complex script instructions into multiple sub-scripts and organizing them into a Merkle tree structure. Only when certain sub-scripts’ conditions are met, the hash value and content of that sub-script need to be revealed. This saves space, improves flexibility, and increases privacy.
Schnorr signatures are a type of digital signature algorithm that allows multiple signers to merge into a single signer and generate a single signature. This simplifies multisig transactions, reduces costs, improves security, and increases privacy.
MAST (Merklized Abstract Syntax Tree)
The significance of MAST lies in creating a secure cross-chain bridge that has the same security as the mainnet for BTC Layer 2 based on Taproot.Before the upgrade, in order to achieve complex script conditions, we could only use P2SH addresses and had to generate redemption scripts with the same hash value and include them in transactions.
For complex conditions in P2SH, the transaction size would become extremely large. In P2SH addresses, BTC must generate redemption scripts with the same hash value and include them in transactions. If the spending conditions specified in the script are too many, the transaction size will become extremely large.
MAST can effectively solve the above problems and provide possibilities for the development of BTC Layer 2.
MAST is a mechanism that combines Merkle trees and abstract syntax trees. It is similar to P2SH, where payments are made to scripts with specified hash values, but MAST pays to scripts with specified Merkle root hash values.
MAST assembles a large set of conditions into a hash tree, which is called a Merkle tree. In this tree, each node is a hash value calculated from its child nodes.
The root of the tree is a hash value representing the set of all conditions. This way, only this root hash needs to be included in the transaction, instead of listing all conditions, reducing the size of the transaction.
First, hash calculations are performed on all scripts (conditions); then the calculated hash values are combined with adjacent hash values for hash calculations, generating a new set of hash values. This process of pairwise hash calculations continues until the final 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, a unlocking script that meets the condition corresponding to a certain path on the Merkle tree needs to be constructed.
The network only needs to verify whether the condition corresponding to this script belongs to the original set of conditions on the Merkle tree, that is, whether this condition exists on the Merkle tree.
Once the network confirms that this script (and its corresponding condition) belongs to the Merkle root, it knows that this script meets the requirements for locking bitcoins, and then continues to verify this unlocking script. This way, we do not need to include the complete script in the transaction, thereby reducing the size of the Bitcoin transaction.
It should be noted that although MAST greatly reduces the space occupied by transaction scripts and provides possibilities for complex on-chain operations, the logic that can be implemented by this structure is relatively limited. Therefore, some claims that “MAST can achieve 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 simply copy the technical architecture of ETH Layer 2. To ensure the security of cross-chain bridges, alternative approaches are needed.
If Schnorr signatures are combined with MAST, it can provide a new approach for cross-chain bridges from the BTC mainnet to Layer 2, and this technology is the mainstream technical solution for current BTC Layer 2 projects.
Schnorr Signatures
Schnorr signatures are a digital signature scheme proposed by Claus Schnorr, known for its simplicity and efficiency. Its advantage lies in the 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 require 20 bytes of storage space, resulting in a total of 240 bytes to store these 12 signatures.
Schnorr signatures 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 that can be used to accommodate more transaction script information.
Schnorr signatures provide privacy protection for all n-of-n multi-signature contracts. The most typical application is the Lightning Network payment channel, as it is essentially a 2-of-2 multi-signature contract.
As for the general m-of-n (m < n) multi-signatures, taking a 2-of-3 multi-signature as an example, it is equivalent to A and B unlocking or B and C unlocking or A and C unlocking in three cases. This can be seen as a multi-condition script, where each condition is a 2-of-2 multi-signature, so it can also be defined using aggregated public keys instead of explicit multi-signatures.
This is the basis for cross-chain technologies adopted by current projects such as STX and BEVM: achieving cross-chain by controlling BTC addresses through hundreds of Layer 2 nodes.
In conclusion, the BTC Layer 2 solution cannot simply replicate the design of Ethereum Layer 2 due to 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 the unique properties of Bitcoin.
The Bitcoin base layer adopts a simple UTXO model and has limited block space.
As mentioned earlier, even with the existence of MAST, the BTC mainnet cannot implement overly complex OP/ZKP verification logic.
This means that unlike Ethereum Rollup, Bitcoin Layer 2 solutions cannot regularly submit on-chain accountability records for verification. Storing data on the Bitcoin blockchain can only be used as availability checkpoints and cannot be actually verified.
This is a concern in the market. For BTC believers, without BTC consensus participation in verification, the narrative of BTC Layer 2 is lost. For long-time ETH users, the security is weaker than the ETH Rollup technical solution, which is not very attractive.
Decentralized cross-chain capabilities
This is a crucial definition of Layer 2. It is difficult to achieve a cross-chain bridge on the BTC mainnet that is secure and equivalent to the mainnet consensus. Currently, 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 Taproot upgrade of Bitcoin in 2021 and Schnorr signatures brings hope for decentralized cross-chain Bitcoin Layer 2 and is a major breakthrough in the realization of BTC Layer 2.
Compared to on-chain verification in Rollups, the current direction that BTC Layer 2 development teams need to focus on is to maximize the security of cross-chain bridge signatures.
As for achieving a perfect Layer 2, only Bitcoin can upgrade the BIP layer, with miners updating the underlying code to support OP/ZKP verification and computational execution by Bitcoin miners to realize Layer 2 solutions similar to ETH Rollup. It should be noted that this requires a very long time and may never be adopted by miners.
Related Report
The first Bitcoin Oracle, Alex Labs, opens the door to BTC DeFi
The true trilemma of Bitcoin Layer 2: Lightning Network, Stacks, and Rootstock…
In-depth discussion on the differences between Layer 2 and L2 Rollup, the way forward for the Bitcoin ecosystem