Move101 | Why is Move a safer smart contract language?

Starcoin
5 min readSep 24, 2024

--

Move is a compilable smart contract language. The original intention of designing Move is to create a safer environment for executing transactions and writing smart contracts to solve the vulnerabilities that often occur in other blockchain platforms, and refer to some of the security designs of Rust. Compared with Solidity, Move is more suitable for the development of digital assets and has higher security, which makes up for the vulnerabilities and defects in Solidity and EVM to a certain extent.

Unlike traditional programming languages ​​used in other blockchains, Move introduces a new concept of asset processing and builds it into the type system of the language. This ensures that assets are not copied or accidentally destroyed, which is a crucial function for digital assets such as cryptocurrencies and tokens.

The security of Move language mainly consists of the following parts:

First-class resources and digital assets

Move language is a resource-oriented language, and Move’s resource model is a core of its security. Move can customize resources, and resources are programmable and secure. Developers can customize resources through programming, truly realizing unique digital assets.

Compared with the assets defined in Solidity, which are just numerical values, assets do not have unique characteristics, let alone unique characteristics, that is, they are only digitized, not digitalized.

The resources in Move contain 3 characteristics:

  1. Some numerical attributes of digital resources are represented in numerical form. For example, the number of digital currencies is represented in numerical form inside the resource, which is stored as a data structure and can be used as a parameter and return value, similar to the structure in Solidity;
  2. Unique digital assets, that is, they cannot be copied, discarded or reused, can be safely stored and transferred, and can only be created and destroyed by the module that defines the resource. This form of resource realizes the real digital asset, which is completely different from the numerical representation of digital assets in Solidity.
  3. The storage and reading of resources are bound to the account. After the resource is created, if it is not destroyed, it must be stored under a certain account, and must be used after being taken out. Therefore, only when an account is allocated can the corresponding resource be held, and then the resource can be operated.

Code safety

Type system: Move uses a strong type system to clearly define the type of each variable and operation. This type system not only makes the written code safer, but also can find potential errors at compile time. Developers cannot manipulate resources and data types at will, and any illegal operations will be captured at compile time, thus avoiding potential vulnerabilities.

Memory safety: Memory safety is a very important security feature in programming languages, especially when dealing with smart contracts. Move prevents common memory leaks, overflows, or other memory-related vulnerabilities in low-level languages ​​such as C/C++ through automatic memory management. This means that smart contracts in Move will not be at risk of crashes or asset loss due to memory problems.

Permission separation and operability

The resource definition and permissions in the Move language are separated. The default permission is that it can only be moved, and it is clear that the permissions of resources belong to the user. Compared with Solidity, where data permissions belong to the contract, this makes resources safer.

Modular design: Move adopts a modular design. Each contract logic is encapsulated in a module, and the resources and data stored and operated in the module are private. This means that external code cannot call and modify the logic or resources in the module at will. The modular design reduces the tampering of resources by accidental or malicious code, and improves the security and code reusability of contracts.

Access control: Move’s modular design allows developers to set strict access rights for specific resources and functions. Only authorized users or code can access and operate certain resources, thus preventing unauthorized access.

Formal verification mechanism

The Move language has a component called Move Prover (MVP), which supports formal verification mechanism as a static security verification tool off-chain. MVP verifies whether the program complies with a certain specification (Specification) through an automatic theorem proving solver in the field of formal verification.

This formal verification method requires a detailed understanding of the contract operation logic, and customizes the specifications required by the program logic, and then communicates it to the verifier MVP together with the program. Only after MVP passes verification can the contract code be executed in the runtime environment (VM runtime).

Concurrency and transaction safety

Concurrent execution safety: Move design includes support for concurrent execution. Since transactions in the blockchain network can be processed in parallel at the same time, Move ensures the security of resource operations when multiple transactions are executed in parallel through the type system and transaction isolation mechanism. Concurrent execution safety means that there will be no conflicts or data contention between resources when multiple transactions are processed at the same time.

Summary

Move is a secure resource-oriented static smart contract language. Its design concept and formal verification tools significantly improve the security at the language level. This enables the project to effectively avoid a variety of low-level vulnerabilities during the development process, especially language-related security risks such as reentrancy attacks, integer overflows, and variable initialization problems.

This is also an important reason why public chains such as Aptos, Sui and Starcoin choose Move as their core technology.

About Starcoin

Starcoin provides the utmost security from the origin via its enhanced PoW consensus and Secure smart contract, using the language of Move. Through layered and flexible interoperability, it optimizes the building of ecosystems such as DeFi, NFTs, Gaming, etc., with higher efficiency and convenience. This process redefines value by empowering every participant in the ecosystem to enjoy the multiplication of values.

Follow Starcoin on social media to stay up to date with all the latest developments.

Website | Twitter | Medium | Telegram | Linktr.ee

--

--

Starcoin

Starcoin is a proof-of-work blockchain that enables secure smart contracts based on Move to power services in Web 3.0