Aptos Move Tutorial: Build Your First Coin Module From Scratch

9 min read

Aptos Move tutorial coin module code on futuristic holographic screen

Key Takeaways

  • The Aptos Move Coin Module is the standard way to create and manage custom tokens on the Aptos blockchain — and it is beginner-friendly once you understand three core capabilities.
  • You need just three CLI commands to set up an Aptos Move project: aptos initaptos move init, and aptos move compile.
  • Move’s resource-based model prevents tokens from being copied or accidentally destroyed — a security advantage over older smart contract languages.
  • Chia Network farmers will find the capability-based permission system familiar: both Chialisp and Move lock critical actions behind provable, on-chain credentials.
  • Deploying to Aptos Devnet costs zero real APT — the CLI funds your test account automatically.

This aptos move tutorial walks you through the Coin Module — the beating heart of custom token creation on Aptos. In about 200 lines of Move code, you can define, mint, transfer, and burn a fully on-chain token secured by Aptos’s parallel execution engine and Move’s built-in safety rules.

What Is the Aptos Move Coin Module?

The Aptos Coin Module is a framework built into the Aptos core library at address 0x1. It gives any developer the tools to create a new token type, control its supply, and manage how it moves between accounts — all without reinventing the wheel from scratch. Think of it as a standard token recipe baked directly into the blockchain itself.

Move is the programming language that powers Aptos smart contracts. It was originally developed by a team at Meta (Facebook) for the Diem project and is now open-source. The language is “resource-oriented,” which means every token or asset is treated as a real-world physical object: it cannot be copied, and it cannot simply disappear. If you move a coin from Account A to Account B, Account A no longer has it. This sounds obvious, but it is a guarantee enforced automatically by the Move Virtual Machine — not by the programmer writing careful code.

How the Coin Module Fits Into Aptos Move

On Aptos, everything lives under an account address. When you publish a coin module, you register a new coin type by calling coin::initialize. In return, Move hands you three capability structs: a MintCapability, a BurnCapability, and a FreezeCapability. These are the actual keys to the kingdom. Without the right capability struct in hand, no code can mint or burn your coin — the Move VM will reject the transaction outright. You store these capabilities in your account’s global storage and retrieve them only when needed.

The Coin Module’s capability system is what sets Aptos Move apart from older smart contract languages: access control is enforced by the type system itself, not by runtime checks that a developer could accidentally skip.

Setting Up Your Aptos Move Tutorial Environment

Before you write a single line of Move code, you need the Aptos CLI installed. The CLI handles everything: account creation, code compilation, test execution, and deployment to the network. Installation is straightforward on macOS, Linux, and Windows. Head to the official Aptos documentation at aptos.dev and follow the guide for your operating system. Once installed, verify it worked by running aptos --version in your terminal.

Install the Aptos CLI and Create an Account

With the CLI ready, open an empty project folder and run aptos init. The CLI will ask which network you want to connect to — choose devnet. It will then generate a brand-new keypair, register an on-chain account, and fund it with test APT automatically. You do not need a credit card or a wallet browser extension for this step. Your account details are saved to a hidden .aptos/config.yaml file in your project directory. Copy your account address from the terminal output — you will use it throughout the tutorial.

Create Your Move Package

Next, run aptos move init --name MyCoin. This creates a standard project layout with two important locations: a sources/ folder where your .move files live, and a Move.toml file that defines your package name and dependencies. The Move.toml file also declares the named addresses your module uses — this is how Move maps a human-readable name like MyCoin to an actual on-chain account address when you compile.

Your GoalBest Starting PointEstimated Time
Learn Move syntax basicsHello Blockchain message module30–60 min
Create a custom tokenCoin Module (this guide)1–2 hours
Build a DeFi protocolFungible Asset standard + Coin ModuleSeveral days
Deploy an NFT collectionAptos Token Object standard1–3 days
Coming from Chia / ChialispCoin Module → Capability system comparison1–2 hours + reading

Writing Your First Coin With the Aptos Move Tutorial

Inside the sources/ folder, create a new file called moon_coin.move. The module declaration goes at the top, followed by a use statement that pulls in the Aptos framework’s managed_coin library. Using managed_coin rather than raw coin functions saves significant boilerplate for beginners because it wraps the most common operations — initialize, register, mint, burn, and transfer — into clean entry functions you can call directly from the CLI or a front-end app.

Defining the Coin Struct

Every custom coin on Aptos needs a unique type identifier. You create this by defining an empty struct with no fields. The struct name becomes the coin’s type parameter, and the module address becomes part of its global identity on-chain. The code looks like this:

module MoonCoin::moon_coin {
    use aptos_framework::managed_coin;

    struct MoonCoin {}

    fun init_module(sender: &signer) {
        managed_coin::initialize<MoonCoin>(
            sender,
            b"Moon Coin",
            b"MOON",
            6,
            false,
        );
    }
}

The init_module function runs exactly once — when you publish the module to the blockchain. It registers the coin type with Aptos, sets the display name (“Moon Coin”), the ticker symbol (“MOON”), the number of decimal places (6, like most stablecoins), and whether to track total supply in real-time. That last flag matters more than it looks: enabling real-time supply monitoring prevents the parallel execution engine from minting and burning simultaneously, which can slow things down at high volume.

The Four Core Capabilities

When managed_coin::initialize runs, it creates and stores three capability structs under your account: MintCapabilityBurnCapability, and FreezeCapability. A fourth operation — registering a CoinStore on a recipient account — does not require a capability, but it does require the recipient’s own signature. This is a key security design: a coin creator cannot force their token into someone else’s wallet. The recipient must first call register to opt in and create a storage slot for that coin type.

In Move, you cannot mint a single token without the MintCapability struct in hand — and that struct can only come from the original initialize call. There is no admin password, no special flag, and no workaround. The type system is the lock.

Registering, Minting, and Transferring

Add three more entry functions to your module to expose the core operations. The register function lets any user prepare their account to hold your coin. The mint function lets the module creator send new coins to an address that has already registered. The transfer function moves coins from the caller’s account to another. All three call the equivalent managed_coin or coin framework functions under the hood:

    public entry fun register(account: &signer) {
        managed_coin::register<MoonCoin>(account)
    }

    public entry fun mint(account: &signer, dst_addr: address, amount: u64) {
        managed_coin::mint<MoonCoin>(account, dst_addr, amount);
    }

    public entry fun burn(account: &signer, amount: u64) {
        managed_coin::burn<MoonCoin>(account, amount);
    }

    public entry fun transfer(from: &signer, to: address, amount: u64) {
        aptos_framework::coin::transfer<MoonCoin>(from, to, amount);
    }

Aptos Move vs. Chialisp: What Chia Farmers Will Recognize

If you have spent time farming Chia or writing Chialisp puzzles, the Move Coin Module’s capability system will feel surprisingly familiar. Both ecosystems are built around a central idea: control over an asset is proved by presenting a specific, cryptographically secured object — not by checking a simple permission flag in a database.

In Chialisp, a puzzle controls what can happen to a coin. The solver must provide a valid “solution” that satisfies the puzzle’s rules before the coin can be spent. On Aptos, the MintCapability struct plays a similar role: you must prove you hold it by passing it into the mint function. Neither system trusts the caller’s word — they demand the cryptographic proof. For a deeper look at how Chialisp structures this kind of secure, programmable logic, see our guide on Chialisp transforming blockchain smart contracts.

Resource Model vs. Coin/UTXO Model

Chia’s blockchain is UTXO-based — every coin is a discrete object with an amount and a puzzle hash. When you spend a coin in Chia, that exact coin object disappears and new coin objects are created. Move takes a similar philosophy to asset ownership: a Coin<T> struct in Move cannot be duplicated or implicitly discarded. You must explicitly transfer, merge, or burn it. The biggest structural difference is that Move stores assets in account-level global storage, while Chia tracks coins in a global unspent coin set. Both models prioritize making “losing” an asset require deliberate action — a significant safety improvement over Ethereum’s balance-mapping approach.

ConceptAptos MoveChialisp (Chia)
Asset storageGlobal storage under account addressGlobal unspent coin set (UTXO)
Permission modelCapability structs (MintCapability, etc.)Puzzle + valid solution reveal
Asset duplication riskPrevented by Move VM type systemPrevented by consensus/UTXO rules
Smart contract languageMove (Rust-inspired, bytecode verified)Chialisp (LISP-based, puzzle-solution model)
Recipient must opt inYes — must register CoinStore firstNo — coins can be sent to any puzzle hash
Parallel executionYes — Block-STM engineNo — sequential block processing

Testing and Deploying Your Aptos Move Coin Module

Once your moon_coin.move file is written, compiling it is a single command. From your project root, run:

aptos move compile --named-addresses MoonCoin=default

The --named-addresses flag maps your module’s named address placeholder to your actual devnet account. If there are no errors, you will see a success message and a compiled .mv bytecode file in your build/ folder.

Unit Testing With the #[test] Attribute

Move has unit testing built right into the language. You write test functions inside your module or in a separate test file, decorated with the #[test] attribute. Run all tests with:

aptos move test --named-addresses MoonCoin=default

Tests run in a sandboxed environment with no real network connection needed. You can simulate minting and transferring coins, then assert that balances are what you expect before a single transaction ever touches the real blockchain. This is the same test-first discipline that keeps professional Move codebases reliable.

Publishing to Devnet

When your tests pass, you are ready to go live on Devnet. Run the publish command, which compiles the package, attaches the metadata, and sends a publish transaction from your funded devnet account:

aptos move publish --named-addresses MoonCoin=default

The CLI will show a gas estimate and ask you to confirm. After confirmation, your module is live. Copy the transaction hash and paste it into the Aptos Explorer at explorer.aptoslabs.com to see your module deployed under your account address. From that point, anyone can call your module’s public entry functions directly from the explorer’s interface without any additional tooling.

“The validator software must be securely designed to prevent attack — this is one of the main reasons we selected Rust and Move to be our languages of choice for implementing protocol and smart contract logic.”— Avery Ching, Co-Founder and CEO of Aptos Labs, The Aptos Vision

A Real-World Look at the Coin Module in Action

The MoonCoin example that ships with the official Aptos documentation walks through the exact pattern described in this guide. A developer publishes the module, calls register on a recipient account, mints 100 MoonCoin to that account using the MintCapability, and then verifies the balance on Aptos Explorer — all within a single devnet session. The entire round-trip from fresh CLI install to live on-chain token takes most developers under two hours on their first attempt, which speaks to how well the Aptos tooling handles the heavy lifting.

Conclusion

The Aptos Move Coin Module is one of the most well-structured entry points into blockchain development available today. Its capability-based permission system enforces security at the type level, the CLI handles everything from account creation to deployment, and the parallels to Chia’s puzzle-solution model mean that Chia farmers already think in the right terms to pick this up quickly. Start on Devnet, get comfortable with initcompiletest, and publish, and then expand into the Fungible Asset standard when you are ready to build something more complex. The Aptos documentation at aptos.dev/build/guides/first-coin is the natural next stop once you have the basics working.

aptos move tutorial FAQs

What is an aptos move tutorial and where do I start?

An aptos move tutorial is a step-by-step guide to writing, compiling, and deploying smart contracts on the Aptos blockchain using the Move language. The best place to start is the official Aptos documentation at aptos.dev, which walks you through your first module from CLI installation to a live devnet deployment in one session.

What is the Coin Module in Aptos Move?

The Coin Module is a built-in framework at address 0x1 in the Aptos core library that lets developers create and manage custom tokens. It provides MintCapabilityBurnCapability, and FreezeCapability structs that control who can create or destroy coins without relying on runtime permission checks.

How is aptos move tutorial different from learning Solidity?

An aptos move tutorial focuses on Move’s resource-oriented model, where assets cannot be copied or lost by accident — a guarantee the Move VM enforces automatically. Solidity relies more heavily on developer discipline to avoid common vulnerabilities like reentrancy attacks, which is why Move is considered a safer starting point for financial applications.

Do I need real APT to follow this Aptos Move tutorial?

No — when you run aptos init and select Devnet, the Aptos CLI automatically funds your new account with test APT at no cost. You can compile, test, and publish modules on Devnet as many times as you need without spending any real money.

What is the difference between MintCapability and the register function in Aptos Move?

The MintCapability is held by the coin creator and allows new coins to be produced from nothing. The register function is called by any recipient who wants to hold that coin type — it creates a CoinStore storage slot in their account. Both are required for a successful mint: no capability, no new coins; no registration, no place to receive them.

aptos move tutorial Citations

  1. Aptos Documentation. “Your First Coin.” https://aptos.dev/build/guides/first-coin
  2. Aptos Documentation. “Your First Move Module.” https://aptos.dev/build/guides/first-move-module
  3. Aptos Documentation. “Aptos Coin Standard (Legacy).” https://aptos.dev/build/smart-contracts/aptos-coin
  4. Aptos Documentation. “Smart Contracts Overview.” https://aptos.dev/build/smart-contracts
  5. Aptos Documentation. “Your First Transaction.” https://aptos.dev/build/guides/first-transaction
  6. Ching, Avery. “The Aptos Vision.” Aptos Labs on Medium. https://medium.com/aptoslabs/the-aptos-vision-1028ac56676e
  7. Aptos Labs. “Move By Example — Aptos Learn.” https://learn.aptoslabs.com/en/code-examples
  8. GitHub — aptos-labs/aptos-core. “coin.move source.” https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-framework/sources/coin.move
  9. WELLDONE Studio. “APTOS Coin Deployment Tutorial.” https://docs.welldonestudio.io/tutorials/aptos-move-coin/
  10. The Block. “What Is Aptos?” https://www.theblock.co/learn/308506/what-is-aptos
  11. CoinDesk. “Aptos’ Avery Ching: Building Bridges to TradFi.” https://www.coindesk.com/consensus-hong-kong-2025-coverage/2024/12/10/aptos-avery-ching-building-bridges-to-trad-fi
  12. ChiaTribe. “Chialisp Transforming Blockchain: Unlocking Next-Gen Smart Contracts.” https://chiatribe.com/chialisp-transforming-blockchain-unlocking-next-gen-smart-contracts/