Understand Move-Based Programming Basics

Move is a resource-oriented programming language designed to make smart contracts safer and more efficient. Built on Rust syntax, it brings familiar structures to developers while introducing strict rules for handling digital assets. Unlike traditional languages where data can be copied or discarded without consequence, Move treats assets as first-class resources that must be explicitly managed.

This approach solves common blockchain vulnerabilities. In many EVM-based chains, tokens are just numbers in a ledger that can be accidentally duplicated or lost. Move changes this by enforcing ownership and uniqueness at the language level. Assets cannot be copied or discarded unless the code explicitly allows it. This eliminates entire classes of bugs related to reentrancy and unauthorized transfers.

The language emphasizes explicit control over asset lifecycles. Developers define resources using structs, ensuring that each item has a single owner at any given time. This model simplifies composability because contracts can trust that assets behave predictably. When you build with Move, you are writing code that inherently understands the value and scarcity of what it handles.

Set up your move development environment

Move’s resource-oriented design prevents assets from being duplicated or lost, making it a safer choice for blockchain development than traditional languages. By treating digital assets as unique resources rather than simple values, you get built-in protections against common smart contract vulnerabilities.

To start building, you need the Move compiler and a project structure tailored for Move-enabled chains like Sui or Aptos. This setup ensures your code compiles correctly and integrates with the blockchain’s specific resource model.

move-based programming
1
Install the Move CLI

The Move Language Compiler (move-cli) is the primary tool for writing, testing, and publishing Move programs. Install it using the official installer script or your system’s package manager. This tool provides the move command, which handles project initialization, compilation, and testing.

Move-Based Programming in
2
Initialize a new Move project

Navigate to your desired directory in the terminal and run move init. This command creates a standard Move project structure, including a sources folder for your smart contract code and a tests folder for unit tests. It sets up the foundational configuration needed for the Move compiler to recognize your assets and modules.

Move-Based Programming in
3
Verify the environment

Run move check to compile your empty project. This step confirms that the compiler is correctly installed and that your project structure is valid. A successful run indicates that your environment is ready for writing resource-oriented smart contracts that leverage Move’s safety features.

Define a resource and mint it

Move treats digital assets as resources rather than simple data. This distinction prevents accidental duplication or unauthorized transfers, which are common vulnerabilities in traditional smart contracts. By enforcing ownership rules at the language level, Move ensures that assets remain secure without requiring complex external checks.

To start, define a custom resource struct. Use the struct keyword and mark it with the key and drop abilities. The key ability allows the resource to be stored in an account's object store, while drop allows it to be destroyed when no longer needed. This setup creates a unique, non-copyable asset type.

MOVE
module my_package::my_resource {
    use std::string;
    use sui::object::{Self, UID};
    use sui::transfer;

    struct MyCoin has key, drop {
        id: UID,
        value: u64
    }

    public fun mint(initial_supply: u64, ctx: &mut TxContext) {
        let coin = MyCoin {
            id: object::new(ctx),
            value: initial_supply
        };
        transfer::public_transfer(coin, tx_context::sender(ctx))
    }
}

The mint function creates a new instance of MyCoin and transfers it to the sender's account. Notice how transfer::public_transfer is used to move the resource. This function ensures that the resource is properly assigned to the recipient, maintaining the integrity of the Move type system.

By following this pattern, you establish a foundation for secure asset management. The resource struct acts as a container for your data, while the abilities define how it can be handled. This approach simplifies the development of complex financial instruments by providing built-in safety guarantees. The image below illustrates the structural relationship between the resource definition and its usage in a transaction.

Move-Based Programming in

Test contracts with the Move framework

Build Smart Contracts with Move-Based Programming works best as a clear sequence: define the constraint, compare the realistic options, test the tradeoff, and choose the path with the fewest hidden costs. That order keeps the advice usable instead of decorative. After each step, pause long enough to check whether the recommendation still fits the reader's actual situation. If it depends on perfect timing, unusual access, or a best-case budget, include a simpler fallback.

Move-Based Programming in
1
Define the constraint
Name the space, budget, timing, or skill limit that shapes the Build Smart Contracts with Move-Based Programming decision.
Move-Based Programming in
2
Compare realistic options
Use the same criteria for each option so the tradeoff is visible.
3
Choose the practical path
Pick the option that still works after cost, maintenance, and fallback needs are included.

Deploy and verify on-chain

Move’s resource model treats assets as unique, non-duplicable entities. This design prevents double-spending and ensures that ownership transfers are explicit. Deploying a module on-chain is the final step in validating that these safety guarantees hold under real conditions.

move-based programming
1
Build the module package

Run move build in your project directory. This command compiles your Move source files into bytecode and validates the module against the Move prover. If the build succeeds, the compiler has confirmed that your resource structs follow the language’s strict ownership rules.

Move-Based Programming in
2
Publish the module

Use the CLI to publish the compiled module to the testnet or mainnet. This action deploys the bytecode to the blockchain, making your functions available to other users. The transaction includes the module’s bytecode and any initialization arguments required by the constructor.

3
Verify the resource behavior

Interact with the deployed module to confirm the resource behaves as expected. Create an instance of your resource struct and transfer it to another address. Verify that the sender’s balance decreases and the recipient’s increases. This step proves that the resource cannot be copied or destroyed unintentionally.

4
Audit the transaction history

Check the block explorer for the deployment transaction. Review the events emitted by your module to ensure they match the expected state changes. Move’s event system provides a transparent trail of resource movements, which is essential for debugging and security auditing.

Common move programming: what to check next

Move is a programming language based on Rust, originally developed for Meta’s Diem project. It was designed to address the unique safety requirements of smart contracts. Unlike general-purpose languages, Move treats digital assets as first-class resources, ensuring that value cannot be copied or discarded accidentally. This resource-oriented approach provides a stronger safety guarantee for blockchain developers.

What programming language is Move based on?

Move is based on Rust. It adopts Rust’s syntactic form and borrows many of its concepts, but it removes features that are unsafe for blockchain environments. By building on Rust, Move provides a familiar foundation for systems programmers while enforcing stricter rules around memory and resource ownership. This foundation allows developers to write smart contracts that are both efficient and secure by design.

What is Move programming?

Move programming focuses on the safe management of digital assets. It uses "resource structs" to represent assets that can only be owned by one account at a time and cannot be copied or destroyed. This paradigm prevents common vulnerabilities like double-spending. Developers use Move to define how assets are transferred, accessed, and controlled within a smart contract, ensuring that the logic governing value is robust and predictable.

Is Move the same as Rust?

No, Move is not the same as Rust. While it shares Rust’s syntax and some underlying concepts, Move is a distinct language tailored for blockchain. It removes unsafe features like raw pointers and manual memory management. Instead, Move enforces a resource model that ensures assets are handled correctly. This specialization makes Move safer for smart contract development than using raw Rust, where such guarantees must be manually implemented.