Move Module

This tutorial covers building, publishing and interacting with my own Move modules.

Step 0: clone initia-tutorials

In this tutorial we will use read_write module of initia-tutorials repository.

git clone git@github.com:initia-labs/initia-tutorials.git

Step 1: Build a module

Before building a module, module owner address must be modified to your own address. Open ./initia-tutorials/move/read_write/Move.toml and modify your_address. your_address must be a hex address.

How to get HEX address

> initiad keys parse [addr]
bytes: F64D24B10B0CE93CD428DF3AB9228ADB18B93CFE
human: init
[package]
name = "read_write"
version = "0.0.0"

[dependencies]
InitiaStdlib = { git = "https://github.com/initia-labs/initiavm.git", subdir = "crates/../precompile/modules/initia_stdlib", rev = "main" }

[addresses]
std =  "0x1"
your_address = "{insert your hex address here}"

And build module with the CLI or builder.js


Step 2: Publish a module

Let's publish read_write.mv module create in the previous step.

About upgrade policy

Policy
Description

ARBITRARY

Whether unconditional code upgrade with no compatibility check is allowed. This publication mode should only be used for modules which aren't shared with user others. The developer is responsible for not breaking memory layout of any resources he already stored on chain.

COMPATIBLE

Whether a compatibility check should be performed for upgrades. The check only passes if a new module has (a) the same public functions (b) for existing resources, no layout change.

IMMUTABLE

Whether the modules in the package are immutable and cannot be upgraded.


Step 3: Interact with published module

Let's interact with the published module.

Last updated