Skip to main content
TLDR:
  • Aptos uses the Move language and “published” modules in place of traditional smart contracts.
  • This tutorial shows you how to set up an Aptos node, initialize a Move project, and publish a simple module that stores a string on-chain.
  • You’ll run through the basics of module creation, compilation, testing, and then sending transactions to set and retrieve data.
  • Use the Aptos CLI for everything from local testing to publishing, and wrap up by querying the on-chain data with Aptos’ REST API.

Main article

Aptos uses its own terminology for widely-known Web3 entities. Smart contracts are called Modules and are written in the Move language. Modules are also not deployed but published on the Aptos chain. The objective of this tutorial is to familiarize you with the Aptos network, the Move language and modules written in it. In the end of this tutorial, you will be able to publish, test, and interact with Move modules in Aptos. Specifically, in this tutorial, you will:
  • Initialize an Aptos project using the Aptos CLI.
  • Publish a module on the Aptos testnet.
  • Interact with the module to save a message.
  • Use the Aptos REST API to retrieve the message.

Prerequisites

Overview

To get from zero to publishing your string via the module to Aptos testnet, do the following:
  1. With Chainstack, create a .
  2. With Chainstack, join Aptos testnet.
  3. With Chainstack, access your Aptos node credentials.
  4. Set up your Martian wallet to work through the Chainstack Aptos node.
  5. Fund your account through the Aptos testnet faucet.
  6. Install the Aptos CLI.
  7. Create a Move project.
  8. Create and configure your Aptos project.
  9. Create a module in the Move language.
  10. Compile and test the Move module.
  11. Publish the Move module.
  12. Save and retrieve a message on the Aptos chain.

Step-by-step

Create a public chain project

See Create a project.

Join the Aptos testnet

See Join a public network.

Get node access and credentials

See View node access and credentials.

Set up Martian wallet

See Aptos tooling: Martian wallet.

Fund your account

Your account needs to pay fees in testnet APT to publish the module and interact with it. Fund your account with the Aptos testnet faucet.

Install the Aptos CLI

You need the Aptos CLI to interact with your Move module. Set up the Aptos CLI.

Create a Move project

  1. In your project directory, create a Move project:
    where save-message — name of the package. This creates a sources directory and a Move.toml file.
  2. Open your Move.toml file and edit it to add [addresses] and [dev-addresses], where:
    • dev = "_" — your default Aptos account.
    • dev = "0xC0FFEE" — an alternative Aptos account for tests.
    Example:
    Note that packages have one-time names. If you want to re-publish the package, you must change its name.

Create and configure an Aptos project

  1. In your project directory, run aptos init > custom. This will start a configuration process, during which you need to set up your Chainstack endpoint and Martian wallet private key. Adding the private key will retrieve your Aptos public address automatically.
  2. Add your Aptos node endpoint deployed with Chainstack.
  3. At the faucet URL request, type skip since you have already funded your account on the previous step.
  4. Paste your Martian wallet private key to finish configuring your project. The key is used to send transactions and retrieve your public address. Example of a successful result:
    As a result, you get a .aptos directory with a config.yaml file inside it. In config.yaml, you will find your project setup.

Create a Move module

In your Move project directory, navigate to the sources directory. Create your Move module file message.move which allows you to call the set_message function and save a string on-chain:

Compile and test the Move module

  1. To compile your Move module, run:
  2. After the module compiled, run a build-in test which checks if the set_message and get_message functions work:

Publish the Move module

  1. Publish your compiled and tested Move module by running:
  2. Type yes to confirm publishing the transaction on the Aptos chain. The module will publish and the terminal will return the module information. You can use the transaction hash to retrieve transaction details. To do so, run:
    where YOUR_CHAINSTACK_ENDPOINT is your Aptos node endpoint you used earlier.

Save and retrieve a message on the Aptos chain

  1. To save a message on the Aptos chain, run:
    where:
    • run — a Move command to call functions
    • function-id — a function to call
    • args — arguments of the function
  2. Type yes to confirm publishing the transaction on the Aptos chain.
  3. Retrieve the published message via the REST API by running:
    where YOUR_CHAINSTACK_ENDPOINT is your Aptos node endpoint you used earlier.
Successful response example:

Conclusion

This tutorial guided you through the basics of creating, publishing, and testing a simple module that saves a string on the Aptos chain.

About the author

Davide Zambiasi

Davide Zambiasi Developer Advocate @ Chainstack
BUIDLs on EVM, The Graph protocol, and Starknet
Helping people understand Web3 and blockchain development
Last modified on April 13, 2026