Sui.

Post

Share your knowledge.

article banner.
HaGiang.
May 01, 2025
Article

Inside Sui’s Kiosk: How to Build Secure NFT Marketplaces

What is Sui’s Kiosk?

Kiosk is a native smart contract module on the Sui blockchain, designed to standardize and simplify the way NFTs are stored, managed, and traded. It acts as a programmable NFT storefront—ideal for devs who want to avoid reinventing the wheel for every NFT-related project.

Whether you’re building a marketplace, a game asset exchange, or a digital collectibles gallery, Kiosk offers you secure, customizable building blocks.

🛠️ Key Features of Kiosk

  • 📦 NFT Storage & Display: Users can deposit NFTs into Kiosk smart contracts to store, show off, or trade them
  • 🔐 Secure Ownership Transfer: All buy/sell flows are standardized and verifiable—goodbye shady swaps 👋
  • 🎛️ Fine-grained Permissions: Kiosk lets devs define exactly who can do what with each NFT.
  • 📈 Developer Extensibility: Plug in auctions, batch listings, bundles, and more.

🤔 Why Build with Kiosk?

Imagine you’re launching an NFT app. You’ll likely need a way for users to store assets safely. A way to list and buy assets.

Kiosk handles all that for you. Instead of writing all these flows from scratch (and risking bugs 🐛 or exploits), you use Kiosk’s battle-tested API.

🧪 Example App: Building with Kiosk

Let’s get into a real example. You’ll create a basic NFT module, then use the Kiosk module to deposit it, list it, and allow others to purchase it.

Step-by-Step Code Breakdown

module 0xNFT::simple_nft {
    use sui::object::{UID};
    use sui::tx_context::TxContext;

    struct SimpleNFT has key {
        id: UID,
        name: String,
        description: String,
        url: String,
    }

    public entry fun mint(
        name: String,
        description: String,
        url: String,
        ctx: &mut TxContext
    ): SimpleNFT {
        SimpleNFT {
            id: UID::new(ctx),
            name,
            description,
            url,
        }
    }
}

Commands (Sui CLI)

# Compile your package
sui move build

# Deploy to network
sui client publish --gas-budget 10000

# Mint NFT
sui client call --function mint --module simple_nft \
  --args "My NFT" "Desc" "https://example.com/img.png" --gas-budget 1000

# Initialize Kiosk
sui client call --function init_kiosk --module kiosk_example --gas-budget 1000

# Deposit NFT to Kiosk
sui client call --function deposit_nft --module kiosk_example \
  --args <NFT_ID> <KIOSK_ID> <KIOSK_OWNER_CAP_ID> --gas-budget 1000

# List for sale
sui client call --function list_nft_for_sale --module kiosk_example \
  --args <KIOSK_ID> <KIOSK_OWNER_CAP_ID> <NFT_ID> 100 --gas-budget 1000

# Purchase NFT
sui client call --function purchase_nft --module kiosk_example \
  --args <KIOSK_ID> <NFT_ID> <PAYMENT_COIN_ID> --gas-budget 1000

Kiosk is one of the most powerful primitives in the Sui ecosystem for NFT developers. It abstracts away repetitive logic and injects security and modularity into your app stack. With just a few lines of code, you’re building full NFT marketplace flows that are production-ready and battle-tested.

  • Sui
2
Share
Comments
.
0xduckmove.
May 1 2025, 02:51

Can I use Kiosk to build a peer-to-peer NFT bartering system (like trade NFTs directly without tokens)? Or is it strictly for buy/sell setups only?”

Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.

290Posts417Answers
Sui.X.Peera.

Earn Your Share of 1000 Sui

Gain Reputation Points & Get Rewards for Helping the Sui Community Grow.

Reward CampaignMay
We use cookies to ensure you get the best experience on our website.
More info