Key Features
Move Transaction Scripts Enable Programmable Transactions
Each Libra transaction includes a Move transaction script that encodes the logic a validator should perform on the client's behalf (for example, to move Libra from Alice's account to Bob's account).
The transaction script interacts with Move resources published in the global storage of the Libra Blockchain by calling the procedures of one or more Move modules.
A transaction script is not stored in the global state, and it cannot be invoked by other transaction scripts. It is a single-use program.
We present several examples of transaction scripts in Writing Transaction Scripts.
Move Modules Allow Composable Smart Contracts
Move modules define the rules for updating the global state of the Libra Blockchain. Modules fill the same niche as smart contracts in other blockchain systems. Modules declare resource types that can be published under user accounts. Each account in the Libra Blockchain is a container for an arbitrary number of resources and modules.
A module declares both struct types (including resources, which are a special kind of struct) and procedures.
The procedures of a Move module define the rules for creating, accessing, and destroying the types it declares.
Modules are reusable. A struct type declared in one module can use struct types declared in another module, and a procedure declared in one module can invoke public procedures declared in another module. A module can invoke procedures declared in other Move modules. Transaction scripts can invoke any public procedure of a published module.
Eventually, Libra users will be able to publish modules under their own accounts.
Move Has First Class Resources
The key feature of Move is the ability to define custom resource types. Resource types are used to encode safe digital assets with rich programmability.
Resources are ordinary values in the language. They can be stored as data structures, passed as arguments to procedures, returned from procedures, and so on.
The Move type system provides special safety guarantees for resources. Move resources can never be duplicated, reused, or discarded. A resource type can only be created or destroyed by the module that defines the type. These guarantees are enforced statically by the Move virtual machine via bytecode verification. The Move virtual machine will refuse to run code that has not passed through the bytecode verifier.
The Libra currency is implemented as a resource type named
LibraCoin.T
.LibraCoin.T
has no special status in the language; every Move resource enjoys the same protections.
Last updated
Was this helpful?