Bitcoin (BTC) is an open-source cryptocurrency system based on blockchain decentralized consensus and peer-to-peer network communication, maintained by computer networks and nodes distributed around the world. The BTC white paper was published by Satoshi Nakamoto on October 31, 2008, and the first block of the BTC consensus chain was generated on January 3, 2009. However, as the crypto community and ecosystem grow and prosper, the early BTC technology can no longer meet the user's demand for scalability of the cryptocurrency system. Directly improving the underlying protocol of BTC is complex and has great community resistance, which will increase the risk of the BTC system, lead to hard forks and community splits. A more suitable solution is BTC Layer 2, which is to build a new layer based on BTC without changing BTC, which is compatible with BTC and meets the user's demand for scalability. This article investigates BTC Layer 2, comprehensively explains the current status and problems of BTC, as well as the technical solutions and advantages and disadvantages of BTC Layer 2, and looks forward to its future.

Technical Introduction of BTC

The core of BTC is distributed ledger technology, which uses blockchain to store transaction data. The blockchain is based on a hash pointer linked list structure. Each section of the linked list is a data block, which contains the hash value of the previous block, transaction data, time data, mining parameters and protocol version information. In the BTC network, the right to write a new blockchain, that is, the right to record, is obtained by nodes through computing power competition in accordance with the Proof of Work (PoW) mechanism. After the node that obtains the right to record successfully writes a new block, it will receive a certain amount of Bitcoin tokens as a reward, so this process is also called mining.

BTC's block data structure

BTC accounting workflow image

BTC uses a transfer-based ledger solution, which only records transfer information in the blockchain without maintaining account balances. Therefore, in order to prevent double-spending attacks, nodes need to maintain a set of unspent transaction outputs (UTXO) locally, and provide the source of funds when transferring accounts so that nodes can verify the legitimacy of transactions.

UTXO diagram of a single account

BTC uses asymmetric encryption and hashing algorithms to organize accounts, protect and verify transactions. An account includes an account private key and an account public key. The account private key is a randomly generated private key, while the account public key is generated by processing the private key using elliptic curve multiplication. In addition, the account address is generated by processing the public key using a hashing algorithm. After the transaction is signed by the private key, it is broadcast to the node through a peer-to-peer network. The node verifies the transaction using the corresponding public key, and after successful verification, the transaction is packaged in a new block.

Signature and verification of BTC account private key and public key

The consensus mechanism of BTC is PoW. All nodes construct a new block header so that its hash value is less than or equal to a given target value. The node that first finds a qualified block header has the right to record the next block. By adjusting the size of the target value, the block time can be indirectly adjusted. The larger the target value, the easier it is to mine and the shorter the block time; the smaller the target value, the more difficult it is to mine and the longer the block time. BTC expects the block time of each block to be 10 minutes. Therefore, BTC will readjust the target value every 2016 blocks, that is, adjust the mining difficulty.

Proof Of Work Process Example

The current status and problems of BTC

BTC is the first digital currency system widely recognized by the global cryptocurrency community. Since 2013, BTC's market value has accounted for more than half of the total market value of cryptocurrencies, making it a well-deserved cryptocurrency leader.

BTC market capitalization share

For a long time, BTC has been sought after by users for its pioneering status and extremely high security. However, as the number of cryptocurrency users grows, BTC is unable to meet the growing demand for low fees, convenience, immediacy, privacy protection, asset diversity and application diversity in cryptocurrency systems. In the long run, the proportion of BTC's market value to the total market value of cryptocurrencies is slowly declining. Compared with Ethereum's prosperous ecology, Solana's low fees and high TPS (Transactions Per Second) and other public chains with their own advantages, BTC seems to have no other core competitiveness except for popularity and security, and faces the following problems:

- Slow transaction speed, long confirmation time, and inconvenience: The capacity of each BTC block is 1M, and the data of each transaction is about 250B, so each block contains a maximum of 4,000 transactions. According to the expected block time of 10 minutes, the TPS of BTC is only about 7. Transactions on BTC need to wait for 6 blocks for reliable confirmation, which results in a final confirmation time of about 1 hour. In addition, transfers on BTC can only transfer all balances at once, and the change needs to be declared to be transferred back to your own address, otherwise it will be given as a reward to the miners. This cannot meet the user's demand for convenient and instant transactions.

- High transaction fees: When users use BTC for transactions, they need to pay fees to attract miners to package transactions. The higher the fee, the faster the transaction is confirmed. When transactions are congested, the fees become extra expensive, reaching more than $60 in 2021. From May 14, 2020 to May 15, 2023, the average transaction fee for Bitcoin was $4.66. This fee cost has prevented many users from using BTC.

- No support for smart contract programming: BTC does not support the direct construction of complex applications, and can only start from the protocol layer. However, the cost of developing applications from the protocol layer is much higher than the cost of developing through standardized smart contracts. This limits the development of BTC's diverse applications and assets.

BTC Fees

Improving BTC’s resistance and Layer 2 solutions

Technical difficulty: The problems encountered by BTC come from the fact that the old technical solutions cannot meet the current needs. Even if fine-tuning is done directly on BTC, the problems cannot be completely solved, but new problems will arise. If BTC is expanded, each block is increased from 1M to 100M, and TPS is increased to 700, it will lead to the generation of nearly 5T of new ledger data each year, raising the threshold for running nodes, affecting the degree of decentralization of the system, and increasing system risks. Even if the problem of ledger data size is not considered, according to the median Internet bandwidth of 13 Mbps and the size of each transaction in the block of 250 B, the TPS limit of BTC is 13Mbps/8Mb/250 B 6815, which cannot compete with public chains such as Polkadot and Solana that can support tens of thousands or even hundreds of thousands of TPS. Bitcoin Cash (BCH) expands the block size of BTC and increases the block size of BTC. However, BCH's client errors are frequent, and the operating cost of the full node is increased, bringing centralization risks. In 2019, in order to fight against attackers who exploited BCH code vulnerabilities, the BCH mining pool launched a 51% attack to modify transaction data.

Community resistance: Between security and scalability, the BTC community prioritizes security. BTC core developers are cautious about technical risks, so they are very conservative when it comes to suggestions to directly expand BTC. The simplest expansion is to increase the size of each BTC block. Since 2015, the proposal to increase the BTC block capacity has been supported by many users, miners, and developers. By increasing the block capacity, users can get faster transaction speeds, and miners can charge more transaction fees. However, some developers, led by Wladimir van der Laan, the general manager of the BTC developer team, disagree with this expansion method and support solutions such as Segregated Witness and Lightning Network. The debate over block expansion led to a split in the BTC community. After BTC introduced the isolation upgrade technology, some people rejected this technical upgrade, causing a BTC hard fork in August 2017, which led to the emergence of BCH. After the hard fork, BCH raised the block size limit to 8M, and later to 32M, with an average TPS of around 120. In addition, in 2018, the BCH community split again due to disagreements on the technology upgrade route, and hard forked into BSV (Bitcoin Satoshi Vision). This fork caused the total computing power of the BCH network to plummet, and it has not yet reached the computing power level before the fork. The block size limit of BSV has been raised to 4G, but due to the lack of miners and users, it is far less secure than BTC.

BTC’s fork history

BCH total network computing power history

Layer2 solution: In fact, directly changing BTC is very complex and has great community resistance. A solution that is more accepted by the community is to build a new layer based on BTC, which is compatible with and does not affect the BTC system while solving the above problems. BTC has extremely high security. Using BTC as the core layer, relying on BTC block data and using BTC script programs, developers can build a BTC-compatible system on the upper layer of BTC, execute a large number of transactions outside BTC, and only write the final status data into BTC. This type of solution is called BTC Layer 2.

BTC Layer 2 goals and development history

BTC Layer2 refers to the second-layer expansion technology of Bitcoin (BTC). This type of technology aims to increase Bitcoin's transaction speed, reduce transaction fees, and increase scalability to solve a series of problems facing BTC.

Layer2 development goals:

Improve transaction speed: Layer2 attempts to increase the transaction speed of Bitcoin by optimizing transaction processing methods, batch processing transactions off-chain, and using the latest technology to synchronize and verify each transaction off-chain, thereby expanding the application and promotion of Bitcoin worldwide.

Reduce transaction costs: Layer2 processes transactions in batches off the BTC chain and only writes the final state after the transaction is completed into BTC. The intermediate transactions and states between the final state and the initial state are stored off the chain and not synchronized on BTC, which reduces transaction fees and reduces the burden on the underlying blockchain of Bitcoin.

Increased scalability: The introduction of Layer 2 technology aims to alleviate the scalability issues of Bitcoin’s underlying blockchain, making it more capable of coping with future growth in transaction volume.

In recent years, Layer2 has been one of the most important investment themes in the crypto industry, but in most scenarios it specifically refers to Ethereum’s Layer2 scaling plan. However, BTC’s scaling plan was much earlier than Ethereum’s scaling proposal. Even Ethereum was created after Vitalik Buterin’s BTC improvement proposal was rejected.

In 2012, the concept of Pegged Sidechains was first proposed, which was derived from Two-way Peg, which enables assets to be seamlessly transferred between two chains. This proposal laid the foundation for subsequent sidechain technology.

In 2014, Blockstream was founded and began researching and developing sidechain technology to improve the scalability of Bitcoin.

In 2015, the Lightning Network white paper was released, with Tadge Dryja and Joseph Poon as the authors. The Lightning Network is a solution to separate small transactions from the main chain. By creating a two-way payment channel, there is no need to record intermediate transactions on the blockchain, only the final status needs to be recorded on BTC.

Since BTC's design is relatively simple and does not have flexible scalability, early BTC Layer2 solutions were difficult to truly embed into Bitcoin and therefore did not cause much response.

It was not until 2017 that the SegWit (Segregated Witness) upgrade was activated, which solved the transaction plasticity problem in the Bitcoin blockchain and made the development of Layer2 technology possible.

Since 2018, developers have gradually begun to deploy Lightning Network nodes and have gained a certain amount of users and support. According to statistics from the bitcoinvisuals website, as of June 4, 2023, the number of Lightning Network nodes has exceeded 18,000, accommodating more than 70,000 payment channels, and the network capacity exceeds 5,000 bitcoins, with a value of more than 100 million US dollars.

Recently, the emergence of the BRC-20 token standard has further enriched the Bitcoin ecosystem and brought BTC Layer2 into the public eye. There are many projects building BTC Layer2, the most well-known of which is the Lightning Network.

Lightning Network

The Lightning Network was first proposed by Joseph Poon and Thaddeus Dryja in their white paper in 2015. The Lightning Network uses micro-payments channel technology to place a large number of transactions outside the Bitcoin blockchain, and only puts the key links on the chain for confirmation. The transaction process is as follows: users who need to trade open a room for offline transactions. When entering the room, users pledge currency to obtain bills, and use new bills to distribute the pledged currencies of both parties. After the transaction is completed, when leaving the room, the transaction is settled, and the user redeems the currency with the latest bill.

Technical Introduction to Lightning Network

In order to construct a secure and reliable micropayment channel, the Lightning Network uses Recoverable Sequence Maturity Contract (RSMC) and Hashed Timelock Contract (HTLC) as key technologies.

RSMC provides pledge and settlement functions, that is, a multi-signature wallet fund pool. Both parties to the transaction first deposit a portion of funds into the fund pool. Initially, the allocation plan of both parties is equal to the pre-deposited amount. Each time a transaction occurs, it is necessary to jointly confirm the fund allocation result after the transaction, and sign to invalidate the old version of the allocation plan. When either party needs to withdraw cash, the transaction result signed by both parties in his hand can be written to the blockchain network for confirmation. From this process, it can be seen that BTC transactions are only required when withdrawing cash. The party that first initiates the withdrawal arrives 1,000 blocks later than the other party. The other party can refute within this time window.

Lightning Network transaction process

HTLC establishes a transaction channel between the two parties, similar to a transaction room, sets a validity period, and automatically settles after the validity period expires. At the same time, HTLC also stipulates cross-channel transaction rules to facilitate transaction routing: in the lightning network, it costs to establish a transaction channel. There may be no existing transaction channel between any two users. At this time, the transaction channel with other people can be used as an intermediary to conduct transactions.

Payment channels and routing on the Lightning Network

However, the early Lightning Network had the following problems:

1. Each transaction requires both parties to operate: In the channel, each transaction requires signature confirmation from both parties, and unilateral transfer is not possible

2. Necessary bargaining between the two parties: If A and B are trading, and A uses the old transaction result to initiate a withdrawal, B can only submit an updated version of the transaction result as a rebuttal within 1000 blocks, otherwise A's withdrawal will take effect.

3. Channel status management: Users need to dynamically synchronize and back up the status of the channel. Otherwise, if an old status is submitted, the counterparty can initiate a fraud rebuttal, request a claim, and obtain all assets in the channel.

In fact, due to the above problems, the early Lightning Network required users to run a full-node wallet or use a fully managed wallet. Full-node wallets require users to manually manage temporary private keys and channel status, and the transaction experience is not good. Fully managed wallets, such as Chivo used in El Salvador, have a low threshold for use, and the custodian automatically replaces the user's operation, but the custodian has control over the user's account private key, and the security is worrying. With the continuous development of the Lightning Network by developers, the above problems are gradually being solved, and more functional Lightning Networks and supporting facilities have been developed, such as OmniBOLT and the OBAndroid Lightning Network Wallet developed by its team.

OmniBOLT Omni means complete and all, and BOTL is the abbreviation of Basis of Lightning Technology. Based on BTC and Omni Layer, OmniBOLT proposes a complete set of Lightning Network protocols. While expanding the function of Lightning Network to pay BTC, it can also issue and trade diversified assets based on Omni Layer, and support the automated market maker mechanism (AMM: Automated market makers), allowing users to use the payment channel's capital pool as liquidity on the Lightning Network to build and use decentralized exchanges. OmniBOTL has a grand vision, but at present, the technology is complex, involving multiple protocols and systems, and there may be risks of vulnerabilities. It takes more time to verify its security.

OmniBOLT Protocol Architecture

OBAndroid is a fully functional Lightning Network full-node mobile wallet. In this wallet, users have control over private keys while being able to automatically monitor transactions, quickly synchronize full-node data, and support cloud and local backup channel status. In addition, OBAndroid also supports Omnilayer assets to be traded through OmniBOTL. OBAndroid makes the Lightning Network transaction experience acceptable to users and lowers the threshold for using the Lightning Network.

OBAndroid Full Node Wallet

Other BTC Layer 2 Projects

In addition to the Lightning Network, there are other BTC Layer 2 projects under development:

Syscoin was developed by the SYSLab team by forking the BTC source code, aiming to use the security of BTC to be compatible with the Ethereum ecosystem. Currently, the SYSLab team has launched NEVM (Network-Enhanced Virtual Machine), a virtual machine built using the security of BTC's PoW, which is compatible with Ethereum smart contracts. In addition, the SYSLab team also plans to launch projects such as ZK and Optimistic Rollup, and Validium with on-chain data proof (Proof of Data). There is little information about the Syscoin project, and it is difficult to evaluate its pros and cons from a technical perspective, but its source code library is frequently updated and is still under stable development.

Syscoin Roadmap

RGB (Really Good for Bitcoin) is a BTC smart contract system integrated with the Lightning Network. It was proposed by Giacomo Zucco and Peter Todd in 2016. RGB uses BTC to maintain anti-censorship and counter double-spending attacks. In RGB, all token transactions and verifications are handled off-chain, and only the party receiving the payment needs to perform client verification. The client verifies the source of the payer's funds in BTC, and after confirming that it is a valid transaction, it directly modifies the UTXO of both parties to the transaction without writing the transaction data into the blockchain, which has the characteristics of privacy protection. In addition, the client can directly introduce the functions of smart contracts to make rule judgments on transactions, and because there is no need for global state consensus, the data of smart contracts does not need to be on-chain, and privacy characteristics can also be guaranteed. The RGB community has developed a Turing-complete smart contract virtual machine AluVM (algorithmic logic unit VM), which has very good scalability, security and privacy protection.

Comparison of transactions on RGB and BTC
Comparison of AluVM with other programming paradigms

BTC Layer2 Summary and Outlook

Although Bitcoin is the world's earliest, most secure, most well-known and highest-valued blockchain network, its ecological development has been continuously deepening. For example, the channel capacity of its largest second-layer network, the Lightning Network, continues to grow, the Taproot upgrade improves the efficiency and privacy of Bitcoin, and the Taro protocol introduces stablecoin payments and on-chain native NFTs to the Lightning Network. However, compared with the number of Bitcoins on the Ethereum chain, the Bitcoin capacity of the Lightning Network is relatively low, and due to the full node data synchronization and channel status management, the use threshold of the Lightning Network is high, and the user scale is not as large as Ethereum, but this situation may indicate huge growth potential. With the further development of the Lightning Network-related ecology, the OmniBOLT improved version of the Lightning Network protocol and the continuous development of the OBAndroid wallet that lowers the threshold for use will eventually make the Lightning Network have good security, scalability and ease of use, and be accepted by users, which may allow BTC's market value to rise to a higher level.

At the same time, we also need to pay attention to the development of other Layer 2 projects, such as the RGB solution with natural privacy protection and Syscoin, which is compatible with the Ethereum ecosystem. These projects are not as famous as the Lightning Network, but they can also solve the problems faced by BTC and have advantages that other solutions cannot match. However, compared with Ethereum's second-layer expansion projects, these projects are not well-known, have received less investment, and do not have the support of the BTC core development team like the Lightning Network. Their expansion of BTC will most likely be later than the expansion of Ethereum, such as Syscoin's Rollup solution. In terms of the Layer 2 ecosystem, it seems that the Ethereum ecosystem has a better virtuous cycle and is more favored by investors.

In the future, we may see the Bitcoin ecosystem expand faster. As the Lightning Network infrastructure improves and attracts more attention, projects based on the Lightning Network, such as OmniBOLT and RGB, will benefit from it, gain a better development foundation, more users, and even more investment. Ethereum-compatible BTC Layer 2 projects such as Syscoin will also benefit from the rapidly developing Ethereum Layer 2 ecosystem and accelerate the progress of their roadmaps. In addition, the discussion on BTC expansion solutions has never stopped: John Light's Bitcoin-based zk-rollups Layer 2 network proposed in 2022 may bring more functions, higher scalability, and better privacy to Bitcoin while maintaining its decentralized nature; Block, a company led by former Twitter CEO Jack Dorsey, is promoting liquidity improvements on the Lightning Network, which may mean that the Bitcoin ecosystem will open up a new track in addition to payment, DeFi, NFT and other fields, covering more users.