Move VM on Nervos Proposal
This proposal aims to port Move VM on Nervos, It includes the following parts:
- Move VM on Nervos
- A library that allow Move script to inter-operate with Nervos. including loading data from Nervos, updating data to Nervos, publishing Move Modules and running Move scripts.
- A toolkit, including Move Compiler, Move Bytecode Verifier, Simulator etc.
Our team, Ping.pub, is a startup focused on blockchain technology. We provide secure and robust validator services for many POS blockchains, such as Cosmos, IRISNET, Kusama etc. We won the ‘Uptime Leader’ prize on the Cosmos GoS hackathon, and we also developed a browser, wallet, and faucet module for Cosmos.
- Dongdong Ma - Graduated from Tsinghua University, worked as a CTO for several years in a subsidiary of Tsinghua Tongfang
- Ping Liang - Serial entrepreneur, successfully founded several Internet companies, and is also a programming enthusiast and contributor to the open source community
- Yiming Ding - Active contributor to the Vue community, a big fan of smart contract development
Project and justification
Move was invented by Facebook using as smart contract language on it’s blockchain - Libra. It is the most advanced smart contract language in the world. Move is simple, secure and powerful.
Although Nervos already has many smart contract languages and SDKs, we still strongly recommend that Nervos should have Move, because it can expand the types of smart contract languages, and it can also build a bridge that connects the Libra ecosystem to bring more developers and investors.
Our co-founder Mr. Liang Ping has been deeply involved in the development and testing of the Java VM on AIX unix / OS2 at IBM. This work experience is very helpful for porting Move VM. Since Facebook announced the Libra project, our team has been researching and learning the Move language and how Move works. Plus most developers in our team are proficient in multiple programming languages, such as C / C ++, Java, Rust, Go, Solidity. Based on the above experience, we are confident that we can complete the project of porting Move VM to Nervos
Technical specification and implementation
This is a complex and challenging project, but we want to illustrate his implementation in the simplest way
Move VM Runtime
Move VM Runtime is a key component that allows the blockchain to execute move Bytecode. It is a rust program, we only need to specify the target platform as risc-v when it is compiled. In theory, this will allows the Runtime to run on the CKB VM.
Libra uses the account model by default, while CKB uses the Cell model. In order to adapt to this change, we have to modify the built-in functions of Move.
As we add changes to built-in functions and account models, we also have to adjust Move’s official compiler and Bytecode Verifier.
Execution of Smart Contract
Each smart contract will accept some parameters and global state as input parameters. When the smart contract is executed in the Move VM, the state will not change immediately, but a “Write Sets” will be generated as output. These inputs and outputs can be mapped to the input cell and output cell.
Storage of Smart Contract
Move VM can execute two types of programs: transaction scripts and modules(Smart contract in other blockchain). We plan to embed one-time transaction scripts in TX and store reusable modules in script cells.
Dependency of Smart Contract
Usually a module needs to import other modules to implement its business logic. So when VM execute these smart contracts, there needs to be a mechanism to ensure that the dependencies required by the module and the corresponding storage cells are also preloaded.
- M1. 1 month, run Move VM on CKB VM and successfully execute a simple move script.
- M2. 1 month, Implement Move Bytecode deployment / store / load on Nervos.
- M3. 2 ~ 3 months, complete the Move VM to read the parameters and preload the dependencies from Nervos, and update the state changes produced by Move VM to Nervos.
M4. 2~3months, Move SDK & built-in functions M5. 1 month, Toolkit M6. 2 month, Best practices, Tutorials, docs.
Approximately 5 months in total.