Rooch v0.1 Release, Completing "Sprouting" Milestone

Rooch v0.1 Release, This is part of "Sprouting" Milestone.

The objective of the "Sprouting" milestone is to release the first preview version of the Rooch Container, providing essential developer tools for developers to build applications on the Rooch platform.

Key Features of Rooch v0.1

This version primarily provides the following key features:

Rooch Command Line Tool

The Rooch Command Line Tool allows users to start the Rooch Container, create, compile, and deploy Move projects, and query the state, transactions, and execution results of application contracts. It supports the complete development cycle and requirements of an application. For a list of supported commands and parameters, please refer to the Rooch Command Line Tool documentation.

MoveOS

MoveOS is a wrapper for MoveVM that provides a standardized state tree and state proofs. It encapsulates transaction validation and execution processes for MoveVM. In the future, MoveOS can be used in other scenarios that require support for the Move execution environment.

Move Standard Library and Framework

Rooch includes three Move standard libraries: MoveStdlib, MoveosStdlib, and RoochFramework. MoveStdlib is the standard library for the Move language, MoveosStdlib is the standard library for MoveOS, and RoochFramework is the application framework for Rooch.

  1. MoveStdlib is located at address 0x1 and directly reuses the standard Move language library.
  2. MoveosStdlib is located at address 0x2 and extends MoveStdlib. It provides state storage abstraction and encapsulates data structures such as Table, TypeTable, Object, ObjectStorage, AccountStorage, and more.
  3. RoochFramework is located at address 0x3 and includes modules for Rooch accounts, transaction validation, multi-chain address mapping, and more.

This address allocation solution for foundational libraries in Rooch avoids naming conflicts and facilitates extensibility. It also allows ecosystem projects to directly integrate frameworks into Rooch, such as DAO, DeFi, Gaming, Social, etc. In the next phase, Rooch will publish plans for collaborative framework development, so stay tuned.

Move Storage Abstraction

Rooch extends Move by introducing storage abstraction. It provides two modes of state storage: ObjectStorage and AccountStorage. Rooch deprecates the global storage instructions in Move and replaces them with corresponding functions in AccountStorage. The mapping table below shows the correlation between the two.

Move Global Storage InstructionFunction in AccountStorage
move_to<T:key>(&signer,T)context::move_resource_to<T:key>(&mut StorageContext,&signer,T)
move_from<T:key>(address)context::move_resource_from<T:key>(&mut StorageContext,address)
borrow_global<T:key>(address)context::borrow_resource<T:key>(&mut StorageContext,address)
borrow_global_mut<T:key>(address)context::borrow_mut_resource<T:key>(&mut StorageContext,address)

The introduction of these changes serves two main purposes:

  1. Defining state storage through contracts and unifying ObjectStorage and AccountStorage with a low-level Key-Value interface. This opens up possibilities for future extension in state storage, such as providing dedicated storage spaces for applications.
  2. Resolving the referencing challenge in Move. Developers previously faced difficulties in returning references borrowed through the borrow_global<T> instruction within their own methods, as these references were created out of thin air and could not be returned as function results. By borrowing through the StorageContext, this issue is solved, as the reference's lifetime becomes tied to the StorageContext's lifetime.

To ensure the security of state storage, and to enforce type safety rules similar to Move's global state instructions, Rooch introduces the #[private_generics(T)] annotation. This annotation can be added to function and indicates that the generic parameter T must be defined in the current contract of the caller, adhering to the constraints of Move's global storage instructions.

For more detailed design on storage abstraction, please refer to the Storage Abstraction documentation.

Rooch JSON RPC

Applications can submit transactions and query the state of application contracts using JSON RPC in Rooch.

Rooch provides a state query API rooch_getStates based on a unified access path, which returns the BCS serialized result of Move states. Additionally, Rooch offers the rooch_getAnnotatedStates API, which returns Move states in a JSON structure, making it convenient for programming languages that do not support BCS directly.

This version includes a demonstration version of the Ethereum RPC Proxy, allowing users to interact with Rooch Container using MetaMask.

For the currently supported API in Rooch, please refer to the Rooch JSON RPC documentation.

Sequencer and Proposer Prototype Implementation

In this version, the Sequencer and Proposer are represented by a prototype implementation. The purpose is to illustrate the transaction execution flow and the instant confirmation feature in Rooch. For more information on the transaction execution flow in Rooch, please refer to the Transaction Flow documentation.

Examples

In this version, there are several simple example projects provided, including:

  1. counter (opens in a new tab): A simple counter that has preliminary integration with MetaMask for interaction.
  2. basic_object (opens in a new tab): A basic example showcasing the use of Object.
  3. complex_struct (opens in a new tab): Demonstrates the output results in JSON RPC for complex struct structures.
  4. event (opens in a new tab): Demonstrates the usage of Event.
  5. entry_function_arguments (opens in a new tab): Showcases the supported argument types in entry function.
  6. kv_store (opens in a new tab): A simple key-value store.
  7. blog (opens in a new tab): A simple blog application with commenting functionality.

Feel free to explore these examples to get a better understanding of how different features and functionalities can be implemented using Rooch.

Next Steps and Objectives

In the next steps, Rooch will focus on the following areas for improvement:

  1. Continuing to refine developer tools, enhancing the storage and retrieval API in Rooch, and exploring support for SQL queries to make Rooch the most efficient and user-friendly Web3 native application development framework.
  2. Implementing multi-chain settlement, allowing Rooch contracts to directly verify and process transactions from other chains. Further improving the RPC proxy interface for multi-chain support and enhancing the wallet user experience.
  3. Implementing Token/NFT standards and cross-chain asset mapping, completing the account abstraction , implementing gas fee delegation, session keys, and Web2 account login.

Based on the aforementioned features, Rooch will primarily explore practical use cases from the perspective of Rooch as a Backend Service. This allows any application wanting to integrate blockchain to use Rooch as a backend service, where developers only need to master frontend skills and Move language. Although it is currently a centralized solution, applications can eventually achieve decentralization by integrating with the Rooch mainnet.

Rooch offers several advantages over web2-based development frameworks:

  1. Built-in multi-chain support, including signature verification, block header verification, address mapping, and wallet support.
  2. Rich querying API that do not require additional developing.
  3. Support for gas-based protection against DDoS attacks.
  4. Support for instant confirmation and session keys for a user experience similar to web2.

Some specific use cases include:

  1. Web3 blogs and forums, such as Rooch can serve as an implementation of the nostr protocol.
  2. Rooch as an index service for the Bitcoin inscriptions protocol(BRC20 etc.).
  3. Rooch as a public data platform for wiki-like applications, with data updates achieved through governance.
  4. Rooch as the backend platform for the fully on-chain gaming.

These are just a few examples, and there are countless possibilities for developers to explore. We will soon launch the Rooch Brainstorming Contest, so stay tuned. By leveraging Rooch as a backend service, developers can benefit from its built-in blockchain capabilities and focus on building applications with seamless integration with the blockchain. It provides a streamlined development experience and opens up a new world of possibilities for Web3 native applications.

Conclusion

Rooch's milestones are driven by application scenarios, focusing on the experience of developers and users. The goal is to expand the boundaries of Web3 applications and explore the possibilities of mass adoption. To learn more and try Rooch, please refer to the Getting Started documentation. For more detailed information on Rooch v0.1, please refer to the Rooch v0.1 release notes (opens in a new tab). We would like to thank the over ten developers who have contributed to Rooch so far. If you want to learn more and get involved in Rooch, please join the Rooch Discord (opens in a new tab).