Skip to main content
Move is a safe and expressive programming language designed specifically for blockchains. Originally created at Facebook for the Diem project, Sui has adapted and extended Move with unique features for its object-centric architecture.

Why Move?

Move was designed from the ground up to address common security issues in smart contracts:

Resource Safety

Assets cannot be copied or accidentally destroyed

Type Safety

Strong typing prevents many classes of bugs

Formal Verification

Code can be mathematically proven correct

Modular Design

Reusable modules and clear dependencies

Move on Sui

Sui extends Move with object-centric features:

Objects vs Resources

While traditional Move uses “resources”, Sui uses “objects” with unique IDs:
Every Sui object must have id: UID as its first field. The UID type ensures global uniqueness.

Basic Syntax

Module Structure

Primitive Types

Move supports several primitive types:

Variables and Mutability

References

Move uses explicit references:

Immutable Reference

&T - Read-only access to value

Mutable Reference

&mut T - Can modify the value
You cannot have mutable and immutable references to the same value simultaneously. This prevents data races.

Control Flow

Conditionals

Loops

Functions

Function Visibility

Function Parameters and Return Values

Structs

Defining Structs

Creating and Using Structs

Generics

Move supports generic programming:

Common Patterns

The Witness Pattern

A witness is a struct that proves you own the module it’s defined in. The init function receives an instance of the witness exactly once, at module publication. This ensures certain operations (like creating a currency) can only happen once.

Capability Pattern

Error Handling

Testing

Best Practices

Move Modules

Learn about module organization

Move Functions

Deep dive into functions

Move Abilities

Understand type abilities