What is move-based programming

Move is a smart contract programming language built specifically for blockchain safety. Unlike traditional languages that treat accounts as mutable databases with balance fields, Move treats assets as unique resources. This fundamental shift prevents common vulnerabilities like double-spending and unauthorized transfers by enforcing strict rules at the language level.

In standard account-based models, transferring value often involves updating a balance field. This approach is prone to errors if the logic isn't perfectly sequenced, potentially allowing race conditions or overflow attacks. Move replaces this model with a resource-oriented system. Assets are not just numbers; they are distinct objects that can be moved, stored, or destroyed, but never copied or discarded silently.

Think of a Move asset like a physical key. You can hand the key to someone else, but you cannot clone it without permission, and you cannot simply throw it away without acknowledging its absence. When you transfer an asset, the original owner loses access, and the recipient gains exclusive control. This "move" semantics ensures that the total supply of any asset remains consistent and verifiable.

This design draws inspiration from Rust's ownership model but adapts it for decentralized environments. Developers familiar with Solidity or Rust will recognize the emphasis on type safety and explicit state management. However, Move goes further by making resource safety a compile-time guarantee rather than a runtime expectation. This makes it particularly suited for high-value financial applications where correctness is non-negotiable.

The language is designed to be efficient and scalable, supporting complex composability while maintaining strict security boundaries. By embedding safety into the core syntax, Move reduces the attack surface for smart contracts, allowing developers to build more complex financial instruments with greater confidence.

Why Move Replaced Account-Based Logic

Move emerged from Meta’s Libra and Diem projects, which were ultimately halted, but the language survived as a distinct solution to blockchain safety. While Ethereum and many other chains adopted existing languages like Solidity, Move was built from the ground up for resource-oriented programming. This shift addressed fundamental flaws in account-based systems where assets are merely balances in a ledger, rather than distinct entities.

In traditional account-based models, transferring value is often just updating a number in a database. Move treats assets as first-class citizens called "resources." A resource is a unique object that cannot be copied or discarded unless explicitly handled by the code. This means you cannot accidentally duplicate a token or lose it to a buggy function call. The compiler enforces these rules, ensuring that every asset has exactly one owner at any given time.

This object model changes how developers write smart contracts. Instead of managing global state variables for every user, Move uses a global object store. Transferring an asset is a literal "move" of an object from one address to another. This prevents common vulnerabilities like reentrancy attacks, where a malicious contract repeatedly calls back into itself to drain funds. By making asset ownership explicit and verifiable, Move provides a safer foundation for complex financial applications.

Core features of the move language

Move distinguishes itself from traditional smart contract languages like Solidity or Rust through a strict resource-oriented model. This architecture treats digital assets as first-class citizens with enforced lifecycle rules, ensuring that value cannot be duplicated or lost by accident. For developers, this means the language itself prevents entire classes of vulnerabilities found in EVM-based chains, such as reentrancy attacks or accidental token duplication.

Resources and Capabilities

In Move, a resource is a struct that cannot be copied or dropped. If you attempt to copy a resource, the compiler rejects the code. If you try to drop it without explicitly transferring or destroying it, the transaction fails. This guarantees that every digital asset has exactly one owner at any given time. To interact with these resources, developers use capabilities, which are objects that grant permission to access or modify specific resources without exposing the underlying data. This separation of access control from data storage is a significant engineering improvement over the public/private visibility modifiers in Solidity.

Modules and Composability

Move organizes logic into modules, which are analogous to libraries or packages in other languages. A module defines the rules for how resources can be created, transferred, and destroyed. This modular design promotes composability: developers can build complex financial primitives by combining simple, verified modules. Because each module is independently verifiable, the security of the entire system relies on the correctness of its smallest parts. This approach aligns with the principle of "move-based programming," where assets physically move between accounts rather than just updating balances in a central ledger.

Move-Based Programming in

Move vs Rust for Smart Contracts

Choosing between Move and Rust often comes down to how you want to handle digital assets. Rust offers low-level memory safety through its ownership system, giving developers fine-grained control over resources. Move takes a different approach by treating assets as first-class citizens with built-in restrictions on copying and dropping.

Asset Safety and Abstraction

In Rust, ensuring an asset isn't duplicated or lost requires careful implementation of traits like Clone and Drop. Developers must manually verify that ownership transfers are correct, which can lead to subtle bugs if not handled precisely. Move simplifies this by enforcing resource safety at the language level. A resource in Move cannot be copied or discarded implicitly; it must be explicitly moved or destroyed. This eliminates entire classes of vulnerabilities related to asset duplication.

Learning Curve and Integration

Rust has a steep learning curve due to its complex borrow checker and lifetime annotations. While powerful, this complexity can slow down development for teams new to systems programming. Move is designed to be more accessible, especially for developers familiar with high-level languages. Its module system promotes reusability, allowing developers to build on existing libraries without reinventing the wheel. For blockchain integration, Move’s abstraction reduces the cognitive load of managing state transitions, making it easier to reason about contract correctness.

Comparison Overview

FeatureMoveRust
Asset SafetyBuilt-in resource modelManual ownership/borrowing
Learning CurveModerateSteep
Copying/DroppingExplicitly restrictedControlled by traits
ReusabilityModule-basedCrate-based

Get started with move development

To begin building with Move, you need a local environment that supports the Move language and a connection to a testnet like Sui. The workflow mirrors standard Rust development, leveraging Cargo for dependency management and compilation. This setup ensures your smart contracts are type-safe and verifiable before they touch the blockchain.

1
Install the Move toolchain

Use cargo install move-analyzer to get the language server for your IDE, and install the move-cli for local compilation. These tools allow you to write and validate Move code offline, catching type errors before deployment.

Move-Based Programming in
2
Initialize a new Move project

Run move init my_package to scaffold a standard Move package structure. This creates a sources directory for your modules and a Move.toml file where you define dependencies and version constraints.

Move-Based Programming in
3
Write and compile your first module

Create a module in sources/my_module.move that defines a simple resource struct. Compile it with move build to ensure the bytecode is valid. The compiler will check for resource safety, ensuring assets cannot be duplicated or lost.

spatial computing
4
Deploy to the Sui testnet

Use the Sui CLI to publish your package to the Sui Devnet. This step verifies that your contract interacts correctly with the blockchain’s state machine, allowing you to test asset transfers and function calls in a live environment.

Move’s resource model treats assets like physical objects: they must be explicitly moved or dropped. Unlike Solidity, where tokens are just balances in a ledger, Move’s type system guarantees that a resource exists exactly once. This prevents common bugs like double-spending at the language level.

Focus on the transfer module in the Sui standard library to understand how assets are handled. These built-in functions provide safe ways to send objects between accounts, giving you a secure foundation for more complex DeFi or gaming logic.

Frequently asked questions about Move

What is Move programming?

Move is a blockchain programming language designed for safe and verifiable transaction-oriented computation. It treats digital assets as resources that cannot be copied or discarded implicitly, ensuring that value transfers are atomic and secure.

What programming language is Move based on?

Move shares conceptual roots with Rust and Solidity. Like Solidity, it is used for smart contracts, but it adds strict ownership rules similar to Rust’s borrow checker to prevent common vulnerabilities like reentrancy and integer overflows.

How does Move differ from Solidity?

In Solidity, tokens are essentially account balances that can be copied or lost if not handled carefully. Move introduces a "resource" model where assets are tied to specific owners and cannot be duplicated or destroyed unless explicitly programmed to do so, offering stronger safety guarantees.