Deploying Move Modules
Overview
This tutorial will guide you through the process of building, publishing, and interacting with your own Move modules on the Initia blockchain. Specifically, we'll work with the read_write module from the initia-tutorials repository. Here's how to get started:
Tutorial
Step 1: Clone initia-tutorials
initia-tutorialsFirst, clone the initia-tutorials repository, which contains the read_write module we'll be using.
git clone git@github.com:initia-labs/initia-tutorials.gitStep 2: Build a Module
Before building the module, you need to update the module owner's address to your own address in the Move.toml configuration file located in ./initia-tutorials/move/read_write.
How to Get Your HEX Address:
Use the following command to parse your Initia address into bytes format, which is your HEX address.
> initiad keys parse [addr]example output:
bytes: F64D24B10B0CE93CD428DF3AB9228ADB18B93CFE
human: initimport { AccAddress } from '@initia/initia.js';
console.log(AccAddress.toHex('[addr]'));
// 0x7b23641ee96425a5dbe9953bdd949da7f6c5fcb0Now, modify the Move.toml file to include your HEX address:
Build the module using either CLI or builder.js:
Step 3: Publish a Module
After building your module, the next step is to publish it to the Initia blockchain.
About the upgrade policy:
COMPATIBLE
Performs a compatibility check during upgrades, ensuring no public function changes or resource layout modifications.
IMMUTABLE
Marks the modules as immutable, preventing any future upgrades.
Step 4: Interact with Your Published Module
After publishing, you can interact with your module through various Move scripts or direct calls from client applications.
Last updated