https://aptos.dev/img/meta/og-aptos-docs-default.png

This is the first chapter of the tutorial on building an end-to-end dapp on Aptos. If you haven’t done it, review that introduction, and ensure your environment meets the prerequisites listed there.

Now that you are all set up and at your terminal:

  1. cd into the my-first-dapp root directory, and create a new move directory.

  2. cd into the new move directory and run: aptos move init --name my_todo_list That command creates a sources/ directory and Move.toml file inside the move directory.

  3. Your new move directory should now resemble:

    https://aptos.dev/assets/images/build-e2e-dapp-img-1-86b39b407558b3e7c15af4e438f825c5.png

What is a Move.toml file?​

A Move.toml file is a manifest file that contains metadata such as name, version, and dependencies for the package.

Take a look at the new Move.toml file. You should see your package information and an AptosFramework dependency. Note that the name property is the same --name attribute we passed to the aptos move init command before. The AptosFramework dependency points to the aptos-core/aptos-move/framework/aptos-framework GitHub repo main branch.

Why sources directory?​

The sources directory holds a collection of .move modules files. And later when we want to compile the package using the CLI, the compiler will look for that sources directory and its Move.toml file.

Create a Move module​

An account is needed to publish a Move module. So first we need to create an account. Once we have the account's private key, we can create a module under its account address and publish the module using that account.

  1. In our move directory, run aptos init --network devnet. Press enter when prompted.

    This creates for us a .aptos directory with a config.yaml file that holds our profile information. In the config.yaml file, we now have our profiles list that holds a default profile. If you open that file, you will see content resembling:

    profiles:  default:    private_key: "0xee8f387ef0b4bb0018c4b91d1c0f71776a9b85935b4c6ec2823d6c0022fbf5cb"    public_key: "0xc6c07218d79a806380ca67761905063ec7a78d41f79619f4562462a0f8b6be11"    account: cbddf398841353776903dbab2fdaefc54f181d07e114ae818b1a67af28d1b018    rest_url: "<https://api.devnet.aptoslabs.com>"    faucet_url: "<https://faucet.devnet.aptoslabs.com>"
    

    From now on, whenever we run a CLI command in this move directory, it will run with that default profile. We use the devnet network flag so eventually when we publish our package it will get published to the devnet network.

    tip

    You just created a new account on the Aptos (dev) network! Yay! You can see it by going to the Aptos Explorer Devnet network view, pasting the account address value from your configuration file into the search field, and clicking on the dropdown option!

As mentioned, our sources directory holds our .move module files; so let’s add our first Move file.

  1. Open the Move.toml file.

  2. Add the following code to that Move file, substituting your actual default profile account address from .aptos/config.yaml:

    [addresses]todolist_addr=''

If the default profile account address is cbddf398841353776903dbab2fdaefc54f181d07e114ae818b1a67af28d1b018, your Move.toml file should look like:

[addresses]todolist_addr='cbddf398841353776903dbab2fdaefc54f181d07e114ae818b1a67af28d1b018'
  1. Create a new todolist.move file within the sources directory and add the following to that file:

    module todolist_addr::todolist {}