In the third video of Encode Club’s Sui series, we review the nature of objects on Sui, and walk through the steps necessary to create a non-fungible token (NFT).

The Sui Foundation partnered with Encode Club to offer a series of six developer-focused videos. This series will range from the basics of Sui to tutorials about building smart contracts and working with objects in Sui.

Learning Highlights

Sui’s data model makes creating objects a fundamental part of coding on the network. Here we offer code snippets showing the four different object models, the components of a unique identifier, and how to create an NFT.

Object Review

Briefly summarizing what we went over in the previous session, objects in Sui are the most basic unit of storage. Objects fall into one of four categories:

Address-owned object

struct ObjectA has key { id: UID }

public entry fun create_object_owned_by_an_address(ctx: &mut TxContext) {
transfer::transfer({
ObjectA { id: object::new(ctx) }
}, tx_context::sender(ctx))
}

Object-owned object

struct ObjectB has key, store { id: UID }

public entry fun create_object_owned_by_an_object(parent: &mut ObjectA, ctx: &mut TxContext) {
let child = ObjectB { id: object::new(ctx) };
ofield::add(&mut parent.id, b"child", child);
}

Shared object

struct ObjectC has key { id: UID }

public entry fun create_shared_object(ctx: &mut TxContext) {
transfer::share_object(ObjectC { id: object::new(ctx) })
}

Immutable object

struct ObjectD has key { id: UID }

public entry fun create_immutable_object(ctx: &mut TxContext) {
transfer::freeze_object(ObjectD { id: object::new(ctx) })
}

Objects and NFTs

Technically, there are no differences between objects and NFTs on Sui. Let’s examine the Sui standard library’s definition of unique identifier (UID) from option.move using the code snippet below.

/// Globally unique IDs that define an object's ID in storage. Any Sui object, that is a struct
/// with the `key` ability, must have `id: UID` as its first field.
/// These are globally unique in the sense that no two values of type `UID` are ever equal, in
/// other words for any two values `id1: UID` and `id2: UID`, `id1` != `id2`.
/// This is a privileged type that can only be derived from a `TxContext`.
/// `UID` doesn't have the `drop` ability, so deleting a `UID` requires a call to `delete`.
struct UID has store {
id: ID,
}


Because Sui generates a globally unique ID every time a new object is created, no two objects will ever be truly fungible, even if the rest of their fields are identical.

Creating an NFT in Sui

Due to Sui’s object-centric approach, creating an NFT is relatively simple, as shown in the code snippet below.

struct NFT has key, store {
id: UID,
name: String,
description: String,
url: Url,
// ... Additional attributes for various use cases (i.e. game, social profile, etc.)
}


However, the above displays a rudimentary example. Sui’s unique programming model allows practically limitless use cases. Anyone interested in contributing ideas on NFT standards or how they could be supercharged to the next level should visit our official Sui Developers forum!

Watch the Whole Series

  1. What's Sui?
  2. Smart Contracts
  3. Creating Objects and NFTs
  4. Dynamic Fields and Collections
  5. RPG Building Basics
  6. Deploy a Game to the Blockchain
Author

Sam Blackshear

Co-Founder, CTO, Mysten Labs, Creator of Move Language

CTO of Mysten Labs and inventor of Move language. Former Principal Engineer at Meta.

Read more like this

All About Real World Assets

Tokenizing real world assets helps to bridge the gap between traditional finance and DeFi.

3min read
Sam Blackshear

FanTV Creators Reach Millions on Sui

FanTV is not just another streaming platform. Powered by Sui, it is a catalyst for change in the creator economy, quietly revolutionizing the way content is created, discovered, distributed, and monetized.

4min read
Sui Foundation

Testnet Wave 2 Recap – The Tokenomics Suinami

During Testnet Wave 2, we focused on testing and validating Sui’s tokenomic model.

11min read
Sui Foundation

USDC Now Available on Sui

Today marks a major milestone for the Sui ecosystem—native USDC is now live on Sui Mainnet . As one of the most widely used stablecoins, USDC brings stable...

2min read
Sui Foundation

DeepBook Supercharges DeFi on Sui

The launch of Sui's first native central limit order book gives builders an easy means of plugging liquidity into their apps.

3min read
Sui Foundation

Sui Basecamp 2025 Lands in Dubai with Hands-on Access to SuiPlay0X1 and Other Unveils

Join the global Sui ecosystem in Dubai May 1-2, 2025 as Mysten Co-Founder and Sui creator, Evan Cheng, Real Vision CEO, Raoul Pal, and more leading voices drop big news and unveil Sui’s roadmap.

3min read
Adeniyi Abiodun