Rob Behnke
July 22nd, 2024
Smart contract platforms like Ethereum and Solana are designed to allow developers to write programs to run on top of the blockchain. These platforms have their own virtual machines (VMs) where the code is executed, and the smart contracts and calls to them are recorded as transactions on the blockchain’s digital ledger.
To write smart contracts, developers need a programming language compatible with their blockchain’s VM. Some blockchains, like Ethereum, created their own programming languages (Solidity, Vyper, etc.). Others, like EOSIO, used existing programming languages, such as Java or Web Assembly (WASM).
Move is a programming language developed by Meta for the Libra/Diem stablecoin. While many blockchains adopted existing languages, others defined custom languages. The goal of Move was to create a language that was more secure than alternatives and was tailored to the use case of supporting a blockchain.
Initially, Move was designed to support the Libra stablecoin, which was intended to enable integrated payments within Meta’s apps (WhatsApp and Facebook Messenger) and to link fiat currencies and crypto.
However, regulatory pressure forced Meta to rebrand Libra to Diem. The stablecoin’s issues didn’t end with the forced rebrand. Eventually, the project was sold off, and the Diem blockchain died.
However, the Move programming language survived the death of its intended blockchain. Since then, it has been adopted by other blockchains, including Aptos and Sui.
The Move programming language was designed as a highly secure programming language.
Some of the key features of Move include:
Resource-Oriented Programming: Many widely used programming languages are object-oriented. Move is different in that it is a resource-oriented programming language that includes a built-in type or first-class resource for digital assets. These assets have integrated access controls, providing additional security.
Strong, Static Typing: Move is a statically and strongly typed programming language, meaning that variable types are determined at compilation, not runtime. This means that there are fewer opportunities for type confusion, which can introduce vulnerabilities in contract code.
Formal Verification: Move offers built-in support for formal verification of code correctness. This provides confidence that the code is correct and free of errors.
Limited Mutability: Values can only be changed in Move via references, and there can only be a single mutable reference to a value at any given time. This helps to protect against vulnerabilities that can exist if the same value can be changed by multiple different pieces of code in parallel.
Parallel Transaction Support: Most blockchains only support executing transactions sequentially to avoid potential conflicts. Move’s resource-centric model enables parallelization since it is easy to determine if two transactions interact with the same resource.
Programming languages have different combinations of features that enable them to do their jobs and can make them stand out from other languages.
Some of the key components of the Move programming language include the following:
Bytecode: In most cases, smart contract code isn’t written to the blockchain as source code. Instead, it’s compiled into bytecode. Move compiles code into bytecode, which is executed within the Move Virtual Machine.
Resources: Move is a resource-oriented programming language with explicit support for digital assets and smart contract state. Resources can be transferred between accounts or destroyed and have a limited lifetime, preventing potential resource leaks.
Modules: Move is a modular programming language, and Move programs are organized into modules that share resources and common functionality. Move modules are designed to ensure that external code can’t interfere with and break the internal functionality of a module.
Scripts: Scripts are code that can be run outside of a formal module. They are used to perform simple operations that don’t require the overhead of a module.
The Move programming language was originally designed for Diem, a failed stablecoin platform. However, the language has been adopted by other blockchains since due to the numerous benefits that Move provides, including:
Improved Security: Move was inspired by Rust and was intentionally designed to enhance the security of smart contracts. Its resource-oriented design, modularity, and support for formal verification all make it easier to identify, prevent, and correct potential vulnerabilities and errors.
Strong Typing: Move’s strong typing is a key part of its security model but is also useful for developers. Explicitly specifying the variable type when it is declared helps to prevent errors due to type confusion.
Digital Asset Resources: Move has resource types specifically for digital assets. This makes it ideally suited for smart contract development, unlike other more general-use programming languages.
Formal Verification: Move code is designed to allow formal verification of its correctness. Its modularity contributes to this since each module can be independently verified without the risk that external code may undermine the results.
Flexibility: Every Move transaction includes a transaction script that allows the transaction to be customized. This enables Move to be used for various purposes with digital assets.
Improved Scalability: Move’s resource-oriented design offers significant scalability benefits. If transactions use independent sets of resources, they can be performed in parallel, enhancing efficiency and scalability.
Resource Efficiency: Move is designed to use compact bytecode, reducing storage requirements. As a result, it can be used on more resource-constrained devices than other, less efficient languages.
Rust-Like Syntax: Move was designed to look like Rust, a widely used programming language. This makes it easier for new developers to adopt and start writing programs in the Move language.
Move was explicitly designed with smart contract security in mind. It emulates the Rust programming language — which is known for its security — and incorporates concepts such as modularity and support for formal verification to enhance this security.
However, Move programs can still contain errors and vulnerabilities. Additionally, the ability to perform formal verification provides no real benefit if developers don’t actually do so.
Like any smart contract programming language, programs written in Move should undergo a full security audit before being deployed to the blockchain. For help with securing your Move programs against potential attacks, get in touch with Halborn.