Move is a new programming language developed to provide a safe and programmable foundation for the Libra Blockchain.
The Move language directory consists of five parts:
virtual machine (VM) — contains the bytecode format, a bytecode interpreter, and infrastructure for executing a block of transactions. This directory also contains the infrastructure to generate the genesis block.
bytecode verifier — contains a static analysis tool for rejecting invalid Move bytecode. The virtual machine runs the bytecode verifier on any new Move code it encounters before executing it. The compiler runs the bytecode verifier on its output and surfaces the errors to the programmer.
compiler — contains the Move intermediate representation (IR) compiler which compiles human-readable program text into Move bytecode. Warning: the IR compiler is a testing tool. It can generate invalid bytecode that will be rejected by the Move bytecode verifier. The IR syntax is a work in progress that will undergo significant changes.
standard library — contains the Move IR code for the core system modules such as
tests — contains the tests for the virtual machine, bytecode verifier, and compiler. These tests are written in Move IR and run by a testing framework that parses the expected result of running a test from special directives encoded in comments.
How the Move Language Fits Into Libra Core
Libra Core components interact with the language component through the VM. Specifically, the admission control component uses a limited, read-only subset of the VM functionality to discard invalid transactions before they are admitted to the mempool and consensus. The execution component uses the VM to execute a block of transactions.
Exploring Move IR
- You can find many small Move IR examples in the tests directory. The easiest way to experiment with Move IR is to create a new test in this directory and follow the instructions for running the tests.
- More substantial examples can be found in the standard library directory. The two notable ones are LibraAccount.mvir, which implements accounts on the Libra blockchain, and LibraCoin.mvir, which implements Libra coin.
- The four transaction scripts supported in the Libra testnet are also in the standard library directory. They are peer-to-peer transfer, account creation, minting new Libra, and key rotation. The transaction script for minting new Libra will only work for an account with proper privileges.
- The most complete documentation of the Move IR syntax is the grammar. You can also take a look at the parser for the Move IR.
- Refer to the IR compiler README for more details on writing Move IR code.
How is this folder organized?
├── README.md # This README ├── benchmarks # Benchmarks for the Move language VM and surrounding code ├── bytecode-verifier # The bytecode verifier ├── e2e-tests # Infrastructure and tests for the end-to-end flow ├── functional_tests # Testing framework for the Move language ├── compiler # The IR to Move bytecode compiler ├── stdlib # Core Move modules and transaction scripts ├── test.sh # Script for running all the language tests └── vm ├── cost-synthesis # Cost synthesis for bytecode instructions ├── src # Bytecode language definitions, serializer, and deserializer ├── tests # VM tests ├── vm-genesis # The genesis state creation, and blockchain genesis writeset └── vm-runtime # The bytecode interpreter