Словник

Move (Programming Language)

Hard

Move is a programming language initially used to build the Diem blockchain. It was created by the Diem Association, which was a tech consortium backed by Meta.

What Is Move (Programming Language)?

The Move programming language was initially used to build the Diem blockchain. It was created by the Diem Association, which was a tech consortium backed by Meta. Although the blockchain was eventually discarded, Move is still in use today.

The Move programming language is an executable bytecode language. It implements smart contracts and custom transactions. Move aims to remedy problems arising from other blockchain programming languages, like Solidity. However, the basic goals of achieving digital scarcity and control over digital assets remain the same. Particularly, it also aims to prevent double-spending and enables the holders of digital assets to maintain ownership information. 

In doing so, Move maximizes safety while maintaining a streamlined design and significantly lower gas costs than blockchains not built on Move. 

How Does the Move Programming Language Work?

Move uses linear logic, meaning resources can only be used once and never copied or implicitly discarded. This allows developers to encode custom resource types that cannot be erased or duplicated and are treated better than others. 

Move's static type system is where variables must be defined as a type (a number/word). It protects prioritized resources. Still, they can be used like regular elements and stored in data structures or supplied as values in calculations. Resources are also transparent in modules and hidden from being called up by external sources. 

Moreover, modules in Move are flexible and safe since the relationship among modules, resources and procedures is like the relationship among classes, objects and methods in object-oriented programming. 

Move can also verify all safety traits on-chain and support off-chain static verification tools. This greatly reduces complexities around on-chain verification. Its design is based on three core decisions:
  • The lack of dynamic dispatch avoids call graph construction and enables static determination of the call site. This allows Move to identify the effects of a procedure call more easily and without additional complexities. 

  • Thanks to its modularity, modules can be isolated for functional verification, and they help with abstracting data and localizing critical operations on resources. Safety is guaranteed by encapsulating the module alongside the language's type system, meaning the code outside of a module cannot violate its types. Additionally, by examining isolated modules, it will provide thorough functional verification for significant module invariants. 

  • Finally, its limited mutability allows using reference types similar to C++. References are vital to mutate each Move value, and typically the temporary values are created and destroyed within a transcription script. Similar to Rust, Move's bytecode verifier "borrow checks" to confirm at least one mutable reference.

Finally, Move rejects programs not following type safety, memory safety and resource safety. Instead, a high-level programming language with a compiler, responsible for checking the properties, can be used. The alternative is a low-level untyped assembly with safety checks.

How Is the Move Programming Language Different?

The Move programming language stands out from other blockchain programming languages in several ways:

  • It does not have limits in defining custom data types of procedures.

  • It embeds access control policies in language semantics.

  • It does away with a default type system for digital assets (unlike Bitcoin or Ethereum).
  • It allows finding single assets with representation in the programming language. Custom assets ought to be reviewed for safety properties by their developer.

This allows Move to create new assets with scarcity easily, without forcing developers to engineer it on their own. Furthermore, it allows developers to modify and customize access control, making the programming language more versatile and scalable than its rivals. 

Components of the Move Programming Language

The Move programming language features several components that form its basis. 

Types

These can be Boolean, unsigned integers (64-bit), fixed-size byte arrays and address (256-bit) data types.

Struct

Two specific types: kind and unrestricted. The former refers to resource structures and the latter to general structures.

Procedures

Methods that are either public or internal. Acyclic module dependency helps in ward off any re-entrance attacks.

Bytecode verifier

Focuses on checking for safety traits before module publication. Before programs are live on the network, they go through the verifier and pass several verification stages like:

  • Type checking

  • Stack balance checking

  • Reference checking

  • Control graph development

  • Reference linking

  • Resource checking

Bytecode Interpreter

It follows the verification and is similar to Ethereum using gas. Thus, it ensures infinite loop executions.

Move Virtual Machine

Similar to other blockchains, with blocks containing multiple transactions and each transaction executed to create a transaction effect. The effect generates the updated global state of the blockchain, with a separation between effects and state transitions.

Which Blockchains Use the Move Programming Language?

Move was used in the discarded Diem blockchain by Meta. Current blockchains building on Move include the Aptos blockchain and the Sui blockchain.