current location:Home >> Blockchain knowledge >> How to Create a Token on Sui

How to Create a Token on Sui

admin Blockchain knowledge 726

Creating a token on the Sui blockchain involves writing and deploying a smart contract in the Move language. Here’s a step-by-step guide:


1. Prerequisites

  • How to Create a Token on Sui

    Set Up the Sui Development Environment

    • Install Rust.

    • Install the Sui CLI:

cargo install --locked --git https://github.com/MystenLabs/sui.git --branch devnet sui

Verify installation:

sui --version
  • Create a Sui Wallet

    • Run sui client new-address to generate a new address and save the recovery phrase.

  • Get Testnet Tokens

2. Write a Move Smart Contract

Tokens on Sui are implemented as custom Coin types in Move. Below is a minimal example:

Example: Creating MY_TOKEN

// File: my_token.move
module my_token::mycoin {
    use std::option;
    use sui::coin;
    use sui::transfer;
    use sui::tx_context::{Self, TxContext};

    // Token type name (must be uppercase)
    struct MY_COIN has drop {}

    // Initializer function (called on deployment)
    fun init(witness: MY_COIN, ctx: &mut TxContext) {
        let (treasury, metadata) = coin::create_currency(
            witness, 
            9,               // Decimals (e.g., 9 means 1e-9 smallest unit)
            b"MY_TOKEN",     // Symbol
            b"",             // Name
            b"",             // Description
            option::none(),  // Optional icon/URL
            ctx
        );
        transfer::public_freeze_object(metadata);
        transfer::public_transfer(treasury, tx_context::sender(ctx));
    }
}
  • Key Parameters:

    • 9: Token decimals (e.g., 9 allows for 1e-9 granularity).

    • "MY_TOKEN": Token symbol.

    • witness: The MY_COIN struct ensures token uniqueness.

3. Deploy the Contract

  1. Create a Project Directory:

sui move new my_token
    • Place my_token.move in the sources/ folder.

    2.Compile the Contract:

sui move build

3.Deploy to Sui Network:

sui client publish --gas-budget 100000000
  • Note the PackageID (e.g., 0x123...) in the output for future interactions.

4. Mint Tokens

Call the init function to generate the initial supply:

sui client call \
    --function init \
    --module mycoin \
    --package <PackageID> \
    --args "0x0::mycoin::MY_COIN {}" \
    --gas-budget 100000000
  • Upon success, the token metadata (name, decimals, etc.) is stored on-chain, and the treasury account receives the total supply.

5. Query and Transfer Tokens

  • Check Token Balance:

sui client gas
  • (If the token is used for gas, its balance will appear here.)

  • Transfer Tokens:

sui client transfer \
    --coin-id <CoinObjectID> \
    --to <RecipientAddress> \
    --gas-budget 100000000

6. Advanced Features (Optional)

  • Minting More Tokens: Use coin::mint if controlled by TreasuryCap.

  • Burning Tokens: Reduce supply via coin::burn.

  • Custom Metadata: Add icons/descriptions in create_currency.

Important Notes

  1. Uniqueness: Each token type (e.g., MY_COIN) is globally unique on Sui.

  2. Security: Keep the TreasuryCap object secure to control minting/burning.

  3. Testing: Always deploy to DevNet before mainnet.

For complex logic (e.g., governance), extend the Move contract. Refer to the Sui Move Docs.


Key Adjustments for U.S. Audience

  • Simplified technical jargon (e.g., "treasury" instead of non-native terms).

  • Active voice ("Call the function" vs. "The function should be called").

  • Consistent formatting (e.g., MY_COIN in code blocks).

  • Direct links to Sui’s official resources.

No Coding Required: Launch a Token on Sui in Minutes with GTokenTool

Skip the coding hassle! With GTokenTool, you can create your own token on Sui in just a few clicks—no Move programming needed. Here’s how:

How It Works

  1. Connect Your Wallet: Link your Sui wallet (e.g., Sui Wallet, OKX Wallet).

  2. Fill in Token Details:

    • Token Name: E.g., "My Token"

    • Symbol: E.g., "MYT"

    • Decimals: Typically 9 (like SUI)

    • Total Supply: Set your desired amount.

  3. Pay Gas Fees: Confirm the transaction (DevNet gas fees are minimal).

  4. Done! Your token is live on Sui.

Why Use GTokenTool?

✅ Zero Coding – No need to write Move contracts.
✅ User-Friendly – Intuitive interface for beginners.
✅ Instant Deployment – Tokens are minted in seconds.

Next Steps

  • Distribute tokens to users.

  • List on Sui DEXs (e.g., Turbos, Cetus).

Try it nowGTokenTool Official Website


Key Adjustments

  • Clarity: Simplified steps with bullet points.

  • Action-Oriented: Phrases like "Skip the hassle" and "Done!" align with U.S. marketing styles.

  • Trust Signals: Emphasized ease ("just a few clicks") and benefits (✅ checkmarks).

If you have any questions or uncertainties, please join the official Telegram group: https://t.me/GToken_EN

GTokenTool

GTokenTool is the most comprehensive one click coin issuance tool, supporting multiple public chains such as TON, SOL, BSC, etc. Function: Create tokensmarket value managementbatch airdropstoken pre-sales IDO、 Lockpledge mining, etc. Provide a visual interface that allows users to quickly create, deploy, and manage their own cryptocurrencies without writing code.

Similar recommendations