Skip to content
๐ŸŽ‰ Welcome to the new Aptos Docs! Click here to submit feedback!
Create Package

Create Package


We recommend installing the Aptos CLI before beginning. If you havenโ€™t already installed the Aptos CLI, see the CLI section

aptos move init

In a new project directory, initialize a Move package by running:

aptos move init --name <PROJECT_NAME>

You should now have a Move project that looks like so:

        • Move.toml
        • Update Move.toml

          In Move.toml, fill in the following key information:

          1. name: name of your package
          2. version: package version (default is "0.0.0")
          3. addresses: Describes which address the module will be deployed to
          4. dependencies: You will likely want to use AptosFramework and other Third Party Dependencies

          Below is an example

          name = "Examples"
          version = "0.0.0"
          hello_blockchain = "_"
          git = ""
          rev = "mainnet"
          subdir = "aptos-move/framework/aptos-framework"

          Add to sources directory

          Add your code in the sources directory. Here we have a hello_blockchain.move example.

          module hello_blockchain::message {
              use std::error;
              use std::signer;
              use std::string;
              use aptos_framework::event;
              struct MessageHolder has key {
                  message: string::String,
              struct MessageChange has drop, store {
                  account: address,
                  from_message: string::String,
                  to_message: string::String,
              /// There is no message present
              const ENO_MESSAGE: u64 = 0;
              public fun get_message(addr: address): string::String acquires MessageHolder {
                  assert!(exists<MessageHolder>(addr), error::not_found(ENO_MESSAGE));
              public entry fun set_message(account: signer, message: string::String)
              acquires MessageHolder {
                  let account_addr = signer::address_of(&account);
                  if (!exists<MessageHolder>(account_addr)) {
                      move_to(&account, MessageHolder {
                  } else {
                      let old_message_holder = borrow_global_mut<MessageHolder>(account_addr);
                      let from_message = old_message_holder.message;
                      event::emit(MessageChange {
                          account: account_addr,
                          to_message: copy message,
                      old_message_holder.message = message;
              #[test(account = @0x1)]
              public entry fun sender_can_set_message(account: signer) acquires MessageHolder {
                  let addr = signer::address_of(&account);
                  set_message(account, string::utf8(b"Hello, Blockchain"));
                      get_message(addr) == string::utf8(b"Hello, Blockchain"),