RoochBTC - Implementing Bitcoin Layer 2 with On-Chain Indexer

Industry Express
2024-01-10 11:35:57
Collection
Rooch is a modular blockchain platform designed to support full-chain applications and provide them access to assets on all other blockchains.

Author: RoochBTC

The fairness of Bitcoin inscriptions encourages the organic development of a community that believes in a decentralized future. For Rooch, our mission is to accelerate this process by providing more application scenarios for this community.

In this article, I would like to discuss all possible solutions for building more functional Bitcoin applications. Additionally, we will propose a new solution that utilizes on-chain indexers to build fully on-chain applications that integrate Bitcoin assets such as Ordinals and BRC20. We will also share some of the latest updates from Rooch regarding the Bitcoin testnet RoochBTC.

Bitcoin L2 Solutions

Although inscription technology provides a new way for Bitcoin to launch new types of crypto assets, the Bitcoin blockchain network itself has limitations in building applications based on these assets. The fundamental reason is that Bitcoin scripts do not support complex logic descriptions, making it impossible to support more complex application scenarios. Furthermore, the transaction costs on the Bitcoin network are also a significant barrier for users to directly use any applications built on the Bitcoin blockchain.

To address these two issues, we have seen some advanced Bitcoin L2 solutions proposed. Here, I roughly categorize them into three types.

Lightning Network

The Bitcoin Lightning Network is one of the earliest and most widely adopted Bitcoin L2 solutions. This solution allows users to build payment channels between two participants, enabling them to lock funds on the Bitcoin network and conduct off-chain transactions based on invoices without any restrictions.

The advantage of the Lightning Network is that it can significantly reduce transaction costs while not compromising security. The entire payment process does not rely on third-party trust. Of course, the downside is that the application scenarios are limited to payments.

RGB / BitVM

RGB and BitVM have recently been introduced to the community and have garnered widespread attention due to their potential to enable Turing-complete smart contract scenarios on Bitcoin.

The essence of these two solutions is similar to the Lightning Network; they aim to offload transaction burdens, allowing all users to verify transactions themselves. However, RGB and BitVM do not only verify simple payment transactions but also provide a platform based on virtual machines for applications to build more complex logic while ensuring that users can still verify the results of a series of complex transactions.

With the implementation and maturation of these solutions, they can essentially support all types of smart contract logic, which will bring tremendous benefits to the Bitcoin ecosystem. Additionally, the security of all transactions is guaranteed by client-side verification. Third-party involvement is unnecessary unless it compromises user experience.

However, we can still foresee their limitations in application scenarios, as they still require all participants to be online and continuously sign transactions to verify off-chain execution.

Sidechain / Rollups

In terms of scaling Bitcoin, sidechains and rollups are the most intuitive solutions. As a user, you can transfer your Bitcoin assets to another platform that can realize various application scenarios.

The million-dollar challenge here is how to securely implement asset transfers between Bitcoin and sidechains. How to lock and unlock the state of Bitcoin in a secure and decentralized manner.

The Taproot upgrade of Bitcoin enables signature aggregation, making it easy to sign transactions with multiple private keys. Many sidechain and rollup solutions leverage this feature to establish a "committee" to help users transfer assets from Bitcoin to their own chains.

The downside of this solution is that the security of users' assets will inevitably be compromised. Once users decide to transfer their assets to a sidechain, they will lose direct control over their assets and must trust the committee that locks the assets and the security of the sidechain or rollup itself.

Thus, through comparison, we can find that there is currently no perfect solution; all solutions require a trade-off between security and application scenarios.

Implementing Bitcoin L2 with On-Chain Indexers

At Rooch, we want to propose a new solution that utilizes on-chain indexers to expand the Bitcoin ecosystem.

How It Works

  • Rooch can be flexibly customized to any infrastructure; in this use case, we will use Ethereum and external DA to ensure security.
  • On top of Rooch, a Bitcoin light client is implemented using smart contracts, which has the capability to verify Bitcoin block headers.
  • All Bitcoin block headers and UTXO states are synchronized to Rooch as objects in MoveVM, where UTXOs are indexed and cross-verified by the light client and all block headers.
  • Then, the indexed Bitcoin UTXO information can be used in the smart contracts of fully on-chain applications built on Rooch.

We will also provide a contract interpreter on Rooch to allow applications to easily access different inscription information, such as Ordinals, BRC20, ARC20, etc.

It is important to note that all UTXOs are not locked on the Bitcoin network; only their state information is synchronized to Rooch. In other words, in this paradigm, no Bitcoin assets can be transferred from Bitcoin to Rooch. Only the latest Bitcoin UTXO states will be synchronized to Rooch in real-time and guaranteed to be correct.

This may seem like a strange solution for scaling Bitcoin, as the solution itself does not help change the state of Bitcoin in any way. However, we can enable many useful application scenarios. Here’s an example.

Imagine a fully on-chain game where you can view your Ordis as seeds. You can plant them. You can water them. When you take care of your Ordi and grow it into a crop, you can earn some yield tokens.

While this is a very simple game, you would still find it challenging to implement it using all the solutions we discussed above. But with Rooch's on-chain indexer, you can easily build such a game.

  • Once a user connects to the application and provides a signature, a Rooch account will be generated for the user. In this account, the user's Ordi will be available for the application contract to read.
  • With proof of ownership of the Ordi seeds, the user can call the application contract to grow it into a tree NFT, which will automatically belong to the same account.
  • The NFT can be obtained through the contract to generate profit tokens or transferred to other accounts.

In this game, the user's Ordi will never leave the Bitcoin network and will be stored in the user's Bitcoin wallet. The game's logic is entirely based on the user's ownership of the Ordi. If the Ordi is transferred to another account, the game contract can decide whether to also transfer the derived assets to that account based on the game design. For example, in the Ordi farming game, the Tree NFT should be transferred to the new account because it should follow the seed, while all profit tokens should remain in the old account because they have already been harvested from the tree.

Comparison with Existing Solutions

Now let's see what would happen if we used other solutions to build the same application:

  • Lightning Network - Not feasible. The Lightning Network does not provide a smart contract environment for implementing game mechanics.
  • P2P protocol using Offchain VM - Feasible but poor user experience. Since the game is essentially a competition among all Ordi holders to grow their assets, all participants need to sign each other's transactions to acknowledge that their "planting" and "watering" actions are valid.
  • Multi-signature-based sidechain/Rollup - Completely feasible but requires asset custody. Users must deposit their Ordi into a third-party custody wallet controlled by a multi-signature committee, which raises trust issues.

However, if we use the on-chain indexer-based solution proposed in this article, we can achieve complete game logic with a seamless user experience, without the need for asset custody throughout the game's lifecycle.

Fully On-Chain Games and More Application Scenarios

The above example demonstrates the potential of application scenarios that can be realized with Rooch's on-chain indexer. The essence of this paradigm is to anchor applications using the ownership of Bitcoin assets, allowing applications to freely design logic and derive more generic tokens from these anchored assets.

We believe that this feature of on-chain indexers makes this solution particularly suitable for building fully on-chain games or Autonomous World (AW) applications within the Bitcoin ecosystem. Unlike DeFi, AW applications typically focus on constructing complex logic designs and executing user actions to earn tokens, or using token ownership as proof of entry, rather than manipulating tokens themselves.

We also believe that more types of applications are possible, and we think games are just the first scenario that can adopt this Bitcoin scaling solution. We are eager to collaborate with the community to build a thriving Bitcoin ecosystem.

RoochBTC - The Testnet of the Rooch Network

Rooch is a modular blockchain platform designed to support fully on-chain applications and provide them access to assets on all other blockchains.

While we are not yet ready to launch the full mainnet, given the recent market demand, we have decided to soon launch the testnet RoochBTC, hoping to showcase to the community what we have been working on and provide some practical experience.

The RoochBTC network will index the complete state of the Bitcoin mainnet on-chain, along with everything needed to develop fully on-chain applications using Bitcoin assets. This includes SDKs, wallet APIs, documentation, and examples.

We will also release demo applications for Bitcoin asset holders to try out and experience the future of fully on-chain Bitcoin applications.

So, stay tuned!

ChainCatcher reminds readers to view blockchain rationally, enhance risk awareness, and be cautious of various virtual token issuances and speculations. All content on this site is solely market information or related party opinions, and does not constitute any form of investment advice. If you find sensitive information in the content, please click "Report", and we will handle it promptly.
banner
ChainCatcher Building the Web3 world with innovators