Objects
The Sui object model is the foundation of how Sui stores and manages on-chain state. Objects have unique IDs, owners, and types. Transactions consume and produce objects, and every object change is recorded on-chain.
What is a Sui object?
On Sui, the base unit of storage is an object. Unlike account-based blockchains where state lives in a single global store keyed by address, Sui organizes state around individual objects. Each object has:
- A globally unique ID
- An owner (an address, another object, or the network itself)
- A type defined by a Move package
- A version that increments with each mutation
Move packages are also objects. When you publish a Move package to Sui, the package becomes an immutable object stored onchain. The functions and types defined in that package are then available to other transactions.
Transactions on Sui take objects as inputs and produce objects as outputs. When a transaction runs, it can read, mutate, transfer, or delete its input objects. The resulting objects become available for future transactions.
Object ownership determines how a transaction can use an object. An address-owned object can only be used by transactions signed by the owner. A shared object can be used by any transaction, but requires consensus to order concurrent access.
The following example shows a simple Move struct that defines a custom object type:
public struct TodoList has key {
id: UID,
items: vector<String>,
}
The key ability marks this struct as a Sui object. The id field of type UID gives each instance a unique on-chain identifier. When you create a value of this type and transfer it to an address, it becomes an owned object on Sui.
Types of Object Ownership
Derived Objects
Derived objects enable deterministic object addresses, Transfer-to-Object capabilities, guaranteed uniqueness, and native parallelization for building scalable composable systems on Sui.
Dynamic Fields
Dynamic fields and dynamic object fields on Sui are added and removed dynamically, affect gas only when accessed, and store heterogeneous values.
Versioning
Sui versions every onchain object by (ID, version) pair using Lamport timestamps, with objects versioned either through the fastpath or through consensus depending on their ownership type.
Owned Compared With Shared
The same trustless swap service implemented 2 ways, once with address-owned objects and a custodian and once with a shared object, to show the trade-offs between the 2 ownership models.