Using Aptos CLI

If you are an Aptos developer, you can deploy to our Network with some minor changes to your workflow.

Initialize your environment

Initialize your Aptos profile for your package development and add M1 as a custom network. M1 is our current blockchain that supports Aptos deployments.

aptos init --network custom --rest-url

You can now set your development environment with the following sequence of commands:

aptos move new hello_world
cd hello_world
touch sources/hello_world.move
code .

Before working on your module, make sure to update your Move.toml file:

name = 'Hello_World'
version = '1.0.0'
git = ''
rev = 'mainnet'
subdir = 'aptos-move/framework/aptos-framework'
hello = "_"

Now, inside hello_world.move you can paste the following code:

 module hello::hello_world {

    public entry fun hello_world() {
        let vect: vector<u8> = b"Hello World";
        let str: std::string::String = std::string::utf8(vect);

        std::debug::print(&str);  // [debug] "Hello World"

After building your project, you can deploy it to the M1 testnet:

aptos move publish --named-addresses hello=default

To interact with your module run:

aptos move run --assume-yes --function-id 'default::hello_world::hello_world'

Congratulations! You have just written, published, and executed your Aptos module on the Movement Network!

Make sure to take a look at our Movement CLI. Includes but not limited to the Aptos CLI.

Last updated