Create a Basic 'Hello World' on the Aptos Blockchain

Hari priyaHari priya
2 min read

You all know that every developer starts their coding journey by printing "Hello World".
Similarly, I plan to write a blog about doing this on the Aptos blockchain.

So let's get started and write our first Move smart contract.

If you're not familiar with Aptos yet check out this beginner guide before continuing: https://medium.com/@haripriya14022003/why-aptos-feels-like-the-future-while-others-still-feel-stuck-in-the-past-3f412b303a29

Step 1: Install the Aptos CLI

First install the Aptos Command Line Interface (CLI) which helps you interact with the Aptos blockchain.

Open your terminal and run:

Add this to your terminal: curl -fsSL "https://aptos.dev/scripts/install_cli.py" | python3

Step 2: Create a New Project Directory

Now, let's create a new directory for your project:

mkdir hello_world cd hello_world

Step 3: Configure Your Aptos Account

Before starting the Move project, you need to set up your Aptos account:

Run : aptos init

When you run aptos init, you can choose the network (Devnet, Testnet, Mainnet) generate or import a private key, and create and fund your account (if on Devnet). This sets up your local Aptos profile and configures everything according to your preferences.

If you simply press Enter without typing anything during the prompts:

It will default to Devnet.

It will generate a new account automatically for you.

After setup, copy the account address displayed.

Step -4 Initialise Your Move Project

aptos move init --name hello_world

This command creates the basic Move project structure inside the folder.

Step 5: Update Move.toml With Your Address

[addresses]
addr_ = "<REPLACE WITH YOUR COPIED ADDRESS>"

Why?
Move modules need a specific blockchain address to be associated with them.
By setting it here, your contract knows which account it belongs to.

What is Move.toml?

The Move.toml file is a configuration file written in the TOML format (Tom’s Obvious Minimal Language).

It stores important settings like:

  • Your project name and version

  • Your account address

It’s easy to read, simple to edit and helps the Aptos CLI know how to build and deploy your project.

Step 6: Write the Hello World Contract

Create a file in the sources/ folder named hello_world.move and paste this:

Step 7: Compile the Contract

Compile your Move code:

aptos move compile

Step 8: Publish to Aptos Devnet

Deploy your contract: aptos move publish

You'll see a message asking you to confirm by typing: yes!

after it is successfully deployed on Devnet

That’s It!

You just:

→ Installed Aptos CLI

→Configured your account

→Created a Move project

→Wrote and published your first smart contract!

0
Subscribe to my newsletter

Read articles from Hari priya directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Hari priya
Hari priya

I’m a Web3 developer exploring the Aptos blockchain and Move language. I write beginner friendly guides and share hands on tips to help others build smart contracts and dApps.