Logo vun Sui Object Model

Sui Object Model

Organisatioun
MystenLabs
sui-object-model

Deep reference for the Sui object model: ownership types, object abilities, dynamic fields, collections, versioning, transfer patterns, and derived objects. Use this skill whenever the user asks about Sui objects, object ownership (address-owned, shared, immutable, wrapped), how to transfer or share or freeze objects, dynamic fields vs dynamic object fields, Table vs Bag vs VecMap, object versioning, wrapping and unwrapping, the Receiving type, custom transfer rules, hot potato pattern, capability pattern, object deletion, Object Display, or how to model data (inventories, registries, nested items) in Sui Move. Also use when the user needs to choose between ownership types or storage patterns for their use case.

Iwwersiicht

EditeurMystenLabs
Repositoryskills
Skill-Nummsui-object-model
Stären
21
Forks
12
Matgeliwwert Fichieren
8
LizenzApache-2.0
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 8 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum MystenLabs op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Sui Object Model an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/MystenLabs/skills/tree/main/object-model
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/MystenLabs/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/object-model .claude/skills/sui-object-model
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Sui Object Model an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Sui Object Model automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Sui Object Model net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Sui Object Model

MCP tool: When available in your environment, also query the Sui documentation MCP server (https://sui.mcp.kapa.ai) for up-to-date answers. Use it for verification and for details not covered by these reference files.

Source constraint: All information in this skill is sourced exclusively from docs.sui.io and move-book.com. When extending or updating this skill, only pull from these two sources. Do not use third-party blogs, tutorials, or unofficial documentation.

Objects are the fundamental unit of storage on Sui. Every resource, asset, and piece of data onchain is an object. Unlike account-based blockchains where state lives in shared mappings inside contracts, Sui gives each piece of state its own identity, version, and owner. Transactions consume objects as inputs and produce modified versions as outputs.

This skill routes to focused reference files. Load only the ones relevant to the current task.


Reference files

ownership — Ownership Types and Versioning

Path: ownership.md Load when: asking about ownership types (address-owned, consensus-address-owned, shared, immutable, wrapped), choosing between shared and owned, parallel execution, consensus, Mysticeti, object versioning, Lamport timestamps, or frontend access to shared objects. Covers: all five ownership types with consensus implications, consensus-address-owned objects, shared object access mode optimization, frontend PTB access pattern, wrapped object behavior, Lamport timestamp versioning, owned vs consensus-assigned versioning.

transfers — Transferring and Deleting Objects

Path: transfers.md Load when: transferring objects, choosing between transfer and public_transfer, implementing custom transfer rules, using Receiving<T>, transfer-to-object, or deleting/destroying objects. Covers: eight core transfer functions (module-restricted vs public, including party_transfer variants), custom transfer rules, transfer-to-object with Receiving<T>, receive vs public_receive, object deletion/unpacking pattern, dynamic field cleanup warning.

dynamic-fields-and-collections — Dynamic Fields and Collections

Path: dynamic-fields-and-collections.md Load when: using dynamic fields, choosing between dynamic_field and dynamic_object_field, working with collections (Table, Bag, VecMap, LinkedTable), or designing storage for large datasets. Covers: dynamic field vs dynamic object field visibility, field naming, core API (add/borrow/remove/exists_), all collection types with decision table, cleanup requirements, system limits (256 KB object size, 2048 objects/txn).

patterns — Common Patterns and Derived Objects

Path: patterns.md Load when: implementing hot potato, capability, soulbound, inventory, or borrow patterns, or working with derived objects. Covers: hot potato pattern (no-ability structs), capability pattern (AdminCap/TreasuryCap), borrow pattern with sui::borrow module, soulbound objects, inventory pattern (ObjectBag), derived objects with deterministic IDs, derived objects vs dynamic fields comparison.

display — Object Display (V2)

Path: display.md Load when: setting up how objects render in wallets, explorers, or apps, working with Display templates, configuring NFT metadata, or migrating from Display V1. Covers: V2 Display<T> creation via display_registry::new_with_publisher, DisplayCap<T> for updates, set/unset/clear/share API, {field_name} template syntax with nested field access, common display properties, V1 to V2 migration.


Routing guide

TaskLoad
What is an object / object structureSKILL.md only
Abilities: key, store, copy, dropSKILL.md only
Ownership types, shared vs owned vs consensus-address-ownedownership
Parallel execution, consensusownership
Object versioning, Lamport timestampsownership
Wrapped objects and accessibilityownership
Frontend access to shared objectsownership
Transferring objects, transfer vs public_transfertransfers
Custom transfer rulestransfers + patterns
Transfer to object, Receivingtransfers
Deleting / destroying objectstransfers
Dynamic fields, dynamic object fieldsdynamic-fields-and-collections
Collections: Table, Bag, VecMap, LinkedTabledynamic-fields-and-collections
Scalability, large collection designdynamic-fields-and-collections
Hot potato patternpatterns
Capability pattern, AdminCappatterns
Borrow pattern, cap inside objectpatterns
Soulbound / non-transferable objectstransfers + patterns
Inventory for arbitrary objectspatterns + dynamic-fields-and-collections
Derived objectspatterns
Object Display, NFT renderingdisplay
Full project / code reviewall reference files

Object structure

Every Sui object contains four components:

  • Globally unique ID: A 32-byte identifier derived from the creation transaction digest plus a generation counter. The ID never changes across the object's lifetime.
  • Version number: An 8-byte integer that increments with each modification. Uses Lamport timestamps: the new version for all objects a transaction touches is 1 + max(version of all input objects).
  • Owner field: A 32-byte value designating access control (an address, another object's ID, or a sentinel for shared/immutable).
  • Transaction digest: A 32-byte hash referencing the last transaction that modified the object.

Objects can be referenced three ways: by ID alone (query current state), by versioned ID (read historical state), or by full object reference containing ID + version + digest (transaction inputs, authenticated snapshot).

Defining objects in Move

A Sui object is a Move struct with the key ability and an id: UID as the first field:

move
public struct Sword has key, store {
    id: UID,
    damage: u64,
    element: String,
}

object::new(ctx) is the only way to create a UID. You cannot call ctx.new() directly.

Move abilities and objects

AbilityWhat it controls
keyThe struct is a Sui object. Must have id: UID as first field. Required for all onchain objects.
storeThe struct can be stored inside other objects, and transferred by any module using public_transfer. Without it, only the defining module can transfer the object. Adding store permanently removes the ability to enforce custom transfer rules.
copyThe struct can be duplicated. Cannot be used on objects — UID lacks copy, so any struct with key cannot have copy. Used only on non-object structs (configs, event data, read-only values).
dropThe struct can be silently discarded at end of scope. Cannot be used on objects — UID lacks drop, so any struct with key cannot have drop. Used only on non-object structs (ephemeral receipts, events). Objects must always be explicitly unpacked to destroy.

Object ability combinations

Because UID has neither copy nor drop, objects (structs with key) can only combine key and store:

  • has key: Only the defining module can transfer, share, or freeze. Use for custom transfer rules.
  • has key, store: Any module can transfer, share, freeze, or wrap. Use for freely composable assets. Once store is granted, you cannot re-add custom transfer restrictions.

Non-object struct combinations (no key)

  • has store: Can be stored as a field inside an object. Cannot exist independently.
  • has copy, drop: A plain data struct for events, intermediate values, and configs.
  • has copy, drop, store: Can be used as dynamic field names.
  • No abilities: A hot potato. Must be consumed in the same transaction. See patterns reference file.

Rules

  • object::new(ctx) is the only way to create a UID. The id: UID field must be first.
  • Once store is added to a type, custom transfer rules are permanently disabled.
  • Once an object is shared, it cannot be converted back to address-owned.
  • Always remove all dynamic fields before deleting a parent object — orphaned fields become permanently inaccessible.
  • Accessing a nonexistent dynamic field (via borrow, borrow_mut, or remove) aborts the transaction. Use exists_ to check first.
  • Wrapping and unwrapping can happen within the same transaction — a PTB can wrap an object and later unwrap it atomically.
  • Common capabilities: AdminCap, TreasuryCap, UpgradeCap. Always mention all three when discussing the capability pattern.
  • Each Table entry is a separate storage operation — gas cost scales linearly with entries accessed per transaction.
  • Prefer immutable references (&) on shared objects to maximize parallel execution.
  • Do not use VecMap for collections larger than ~100 entries. Use Table instead.

Common mistakes

  • Adding store when you need custom transfer rules. Once granted, any module can call public_transfer and your enforcement logic is bypassed permanently.
  • Using VecMap for large collections. It has O(n) lookup and is stored inline, hitting the 256 KB object size limit quickly.
  • Confusing dynamic_field with dynamic_object_field. Use dynamic_object_field when the child must remain queryable by ID in explorers. Use dynamic_field for plain values.
  • Deleting an object without removing its dynamic fields first. Those fields become permanently inaccessible.
  • Using the legacy sui::display module for new code. Use sui::display_registry (Display V2). V1 was migrated to V2 via a system snapshot migration.
  • Forgetting to display_registry::share(display) after setting fields. The display must be shared to be discoverable.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Sui Object Model?

Deep reference for the Sui object model: ownership types, object abilities, dynamic fields, collections, versioning, transfer patterns, and derived objects. Use this skill whenever the user asks about Sui objects, object ownership (address-owned, shared, immutable, wrapped), how to transfer or share or freeze objects, dynamic fields vs dynamic object fields, Table vs Bag vs VecMap, object versioning, wrapping and unwrapping, the Receiving type, custom transfer rules, hot potato pattern, capability pattern, object deletion, Object Display, or how to model data (inventories, registries, neste...

Firwat Sui Object Model op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Sui Object Model besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Sui Object Model an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/MystenLabs/skills/tree/main/object-model an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Sui Object Model benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Sui Object Model benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Sui Object Model domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Sui Object Model gratis?

Jo. De Skill gëtt vum MystenLabs ënner der Lizenz Apache-2.0 op GitHub publizéiert. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇