Skip to main content
This example shows how to create and manage custom coins using Sui’s coin framework.

Basic Coin Implementation

From examples/move/coin/sources/my_coin.move:

Key Concepts

One-Time Witness (OTW)

The MY_COIN struct is a one-time witness that proves this is the first (and only) time this module initializes:
Requirements:
  • Same name as module (in UPPERCASE)
  • Only has drop ability
  • Used once in init

TreasuryCap

Controls minting and burning:

CoinMetadata

Defines display properties:
  • Decimals: Number of decimal places
  • Symbol: Ticker symbol (e.g., “BTC”)
  • Name: Full name
  • Description: Optional description
  • Icon URL: Optional icon image

Fixed Supply Coin

From examples/move/coin/sources/fixed_supply.move:

Regulated Coin

With deny list capability:

Deploying Your Coin

Using Your Coin

Transfer coins

Check balance

Best Practices

1. Freeze metadata early

Make coin information immutable:

2. Secure treasury capability

Only give minting rights to trusted addresses:

3. Consider supply limits

Implement max supply checks:

4. Add proper decimals

Next Steps