Why Move?
Move was designed with blockchain-specific requirements in mind:- Resource safety: Assets are modeled as resources that cannot be copied or implicitly discarded
- Type safety: Strong static typing catches errors at compile time
- Formal verification: The language is designed to be formally verifiable
- Flexibility: Generic programming and ability to define custom types
- Performance: Compiles to efficient bytecode executed by the Move VM
Move’s resource-oriented programming model makes it natural to represent digital assets like tokens, NFTs, and other valuables that should never be duplicated or accidentally destroyed.
Key language features
Module system
Move code is organized into modules that can be published to the blockchain:- Belongs to a specific address/package
- Can import other modules with
usestatements - Defines structs, functions, and constants
- Controls visibility with
public,public(package), or private access
Abilities
Move types have abilities that control what operations can be performed:copy: Value can be copieddrop: Value can be dropped/discardedstore: Value can be stored in global storagekey: Value can be used as a top-level object (IOTA extension)
The
key ability is a IOTA extension to Move. Any struct with key must have id: UID as its first field, making it a top-level object in IOTA’s storage.Generics
Move supports generic programming with type parameters:References
Move uses references for safe, temporary access to values:- Immutable references (
&T): Allow reading but not modifying - Mutable references (
&mut T): Allow both reading and modifying
- No dangling references
- Only one mutable reference OR multiple immutable references exist at a time
- References don’t outlive the values they point to
IOTA-specific extensions
Object model
IOTA extends Move with an object-centric model. Objects are structs with thekey ability:
- Owned: Controlled by a single address
- Shared: Accessible to anyone (with consensus)
- Immutable: Frozen and cannot be modified
Transaction context
Every entry function receives a&mut TxContext parameter providing transaction metadata:
- Sender address
- Transaction digest
- Epoch number
- Fresh UIDs for creating objects
Transfer operations
IOTA provides built-in functions for transferring objects:Move VM and bytecode
Move source code compiles to Move bytecode, which is executed by the Move VM:- Compilation:
.movesource files →.mvbytecode modules - Verification: Bytecode verifier checks safety properties
- Publishing: Bytecode is published to IOTA as a package object
- Execution: Move VM interprets bytecode during transaction execution
Standard library
Move includes a comprehensive standard library:Core types
vector: Dynamic arraysoption: Optional valuesstring: UTF-8 stringsascii: ASCII strings
Utilities
bcs: Binary Canonical Serializationhash: Cryptographic hashingaddress: Address manipulation
Example: Using vectors
Entry functions
Entry functions are the entry points callable from transactions:- Marked with
entrykeyword - Parameters must be primitive types, objects, or vectors
- Last parameter must be
&mut TxContext - Cannot return values
Programmable transaction blocks
Unlike other blockchains, IOTA allows calling multiple Move functions in a single transaction:- Complex multi-step operations atomically
- Reduced transaction costs
- Better composability between protocols
Programmable transaction blocks are a powerful feature that enables DeFi and other complex applications to execute multiple operations with guaranteed atomicity.
Gas costs and metering
The Move VM meters execution to prevent infinite loops and ensure fair resource usage:- Instruction costs: Each bytecode instruction has a gas cost
- Storage costs: Reading and writing objects incurs storage gas
- Type operations: Instantiating generics has associated costs
Best practices
Resource safety
Error handling
Minimize storage
Related topics
Objects and ownership
Learn about IOTA’s object model and ownership types
Transactions
Understand how to construct and execute transactions
Gas and fees
Learn about gas computation and fee structure
Architecture
Overview of IOTA’s system architecture