Deploying a Module

What is Module?

Module์ด๋ž€ ๋‹ค์–‘ํ•œ ๊ตฌ์กฐ์ฒด๋ฅผ ์ •์˜ํ•˜๊ณ  ์‚ฌ์šฉํ•˜๋Š” ํ•จ์ˆ˜๋กœ ๊ตฌ์„ฑ๋œ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ž…๋‹ˆ๋‹ค. Aptos์—์„œ๋Š” ๋„คํŠธ์›Œํฌ์— Module์„ ๋ฐฐํฌํ•˜๊ณ  ์ด๋ฅผ ์ด์šฉํ•ด ์Šค๋งˆํŠธ ์ปจํŠธ๋ž™ํŠธ ๋กœ์ง์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


How to make Module?

Module์€ Move๋ผ๋Š” ์–ธ์–ด๋ฅผ ์ด์šฉํ•ด ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Aptos์—์„œ๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ํŽธ๋ฆฌํ•˜๊ฒŒ Aptos ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ๊ตฌ์ถ•ํ•  ์ˆ˜ ์žˆ๋„๋ก CLI๋ฅผ ์ง€์›ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ ํŠœํ† ๋ฆฌ์–ผ์—์„œ๋Š” Aptos CLI๋ฅผ ์ด์šฉํ•˜์—ฌ Module ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ๊ตฌ์ถ•ํ•˜๊ณ  ๊ฐ„๋‹จํ•œ Message Module์„ ์ž‘์„ฑํ•  ๊ฒƒ ์ž…๋‹ˆ๋‹ค.

๐Ÿ“˜

์ด ํŠœํ† ๋ฆฌ์–ผ์„ ํ†ตํ•ด ์•„๋ž˜ ๋‚ด์šฉ์„ ๋ฐฐ์šธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค!

  • Module ์ž‘์„ฑ ๋ฐ ๋ฐฐํฌ๋ฅผ ์œ„ํ•œ ํ™˜๊ฒฝ ์„ค์ • ๋ฐฉ๋ฒ•์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Module์— ๋Œ€ํ•œ ๊ธฐ์ดˆ์ ์ธ ๋‚ด์šฉ์„ ์ดํ•ดํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Module์„ Aptos ๋„คํŠธ์›Œํฌ์— ๋ฐฐํฌํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์ „์ฒด ํŠœํ† ๋ฆฌ์–ผ ์ฝ”๋“œ๋Š” ์•„๋ž˜ ๋งํฌ๋ฅผ ํ†ตํ•ด ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

Step 1. Initializing Move environment and Profile

Module์„ ์ž‘์„ฑ ๋ฐ ๊ด€๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

$ mkdir Message
$ cd Message

Move๋ฅผ ํŽธ๋ฆฌํ•˜๊ฒŒ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋Š” ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•˜๊ธฐ ์œ„ํ•ด ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค. (๊ฒฝ๋กœ๊ฐ€ ์ƒˆ๋กœ ๋งŒ๋“  Message ๋””๋ ‰ํ† ๋ฆฌ์™€ ์ผ์น˜ํ•˜๋Š”์ง€ ํ™•์ธํ•ด ์ฃผ์„ธ์š”.)

$ aptos move init --name <your_porject_name>

์„ฑ๊ณต์ ์œผ๋กœ init์ด ์™„๋ฃŒ๋˜๋ฉด ํ˜„์žฌ ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด์— scripts, sources, tests ๋ผ๋Š” ์ด๋ฆ„์˜ ๋””๋ ‰ํ† ๋ฆฌ์™€ Move.toml ํŒŒ์ผ์ด ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

.
โ”œโ”€โ”€ Move.toml
โ”œโ”€โ”€ scripts
โ”œโ”€โ”€ sources
โ””โ”€โ”€ tests

Move.toml ํŒŒ์ผ์—์„œ๋Š” ํ•ด๋‹น ํŒจํ‚ค์ง€์— ๋Œ€ํ•œ ์ •๋ณด๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

  1. name : ํŒจํ‚ค์ง€ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค.
  2. version : ํŒจํ‚ค์ง€์˜ ๋ฒ„์ „์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.
  3. addresses : ๋ชจ๋“ˆ์—์„œ ์ด์šฉํ•  ์ฃผ์†Œ๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.
  4. dependenciesAptosFramework : Aptos์˜ ํ”„๋ ˆ์ž„์›Œํฌ๋‚˜ Third Party Dependency๋ฅผ ๋ช…์‹œํ•ฉ๋‹ˆ๋‹ค.
[package]
name = "<your project name>"
version = "1.0.0"

[addresses]

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-core.git"
rev = "mainnet"
subdir = "aptos-move/framework/aptos-framework"


์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•˜์—ฌ ์ดˆ๊ธฐ ๊ณ„์ • ์ •๋ณด๋ฅผ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

$ aptos init --network testnet

โ€”network ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•˜์—ฌ ์‚ฌ์šฉํ•˜๊ณ ์ž ํ•˜๋Š” Aptos ๋„คํŠธ์›Œํฌ๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜ํ•œ ์ด ๋ช…๋ น์–ด๋ฅผ ํ†ตํ•ด Account๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์„ฑ๊ณต์ ์œผ๋กœ ์ƒ์„ฑ์ด ๋˜๋ฉด config.yaml ํŒŒ์ผ์„ ํฌํ•จํ•˜๊ณ  ์žˆ๋Š” .aptos ๋ผ๋Š” ๋””๋ ‰ํ† ๋ฆฌ๊ฐ€ ์ž๋™์œผ๋กœ ์ƒ์„ฑ๋˜๋ฉฐ config.yaml ํŒŒ์ผ์—๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์ด์šฉํ•  Account์— ๋Œ€ํ•œ ์ •๋ณด๊ฐ€ ์ž‘์„ฑ๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค.

// config.yaml

---
profiles:
  default:
    private_key: "your_private_key"
    public_key: "your_public_key"
    account: "your_account_address"
    rest_url: "Your_Nodit_Aptos_Endpoint"
    faucet_url: "https://faucet.testnet.aptoslabs.com"


config.yaml ํŒŒ์ผ์—์„œ account ๊ฐ’์„ ๋ณต์‚ฌํ•œ ๋’ค Move.toml ํŒŒ์ผ์˜ [addresses]์— ๋ถ™์—ฌ๋„ฃ์–ด Key ๊ฐ’์„ ์ด์šฉํ•ด ํ•ด๋‹น Account๋ฅผ move ํŒŒ์ผ์—์„œ ์ด์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

[package]
name = "<your project name>"
version = "1.0.0"

[addresses]
myAddress = "and_paste_your_account_address"

[dependencies.AptosFramework]
git = "https://github.com/aptos-labs/aptos-core.git"
rev = "mainnet"
subdir = "aptos-move/framework/aptos-framework"


ํŒจํ‚ค์ง€ ์ดˆ๊ธฐํ™” ์™„๋ฃŒ ํ›„ sources ๋””๋ ‰ํ† ๋ฆฌ ๋‚ด์— move ํŒŒ์ผ์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

$ cd ../sources
$ touch message.move

Step 2. Writing Message Module

์ „์ฒด์ ์ธ Message ์ฝ”๋“œ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค. message.move์— ์•„๋ž˜์™€ ๊ฐ™์ด ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. ๊ทธ๋ฆฌ๊ณ  Tutorial 3์—์„œ ๊ฐ ์ฝ”๋“œ๊ฐ€ ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋Š”์ง€ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

module ownerAddress::message {
  use std::signer;
  use std::string::{Self,utf8, String};
  use std::error;

  struct Message has key {
    message_counter : u64,
    message : String,
  }

  const ENO_MESSAGE: u64 = 0;

	#[view]
  public fun get_message(message_owner : address) : string::String acquires Message {
    assert!(exists<Message>(message_owner), error::not_found(ENO_MESSAGE));
    borrow_global<Message>(message_owner).message
  }

  public entry fun set_message(admin: &signer, message : String) acquires Message{
    let message_owner_address = signer::address_of(admin);
    if (exists<Message>(message_owner_address)) {
      let stored_message = borrow_global_mut<Message>(message_owner_address);
      stored_message.message = message;
    } else {
      move_to(admin, Message{
        message_counter : 1,
        message : message
      });
    }
  }

#[test(account = @ownerAddress)]
  public entry fun test_message(account: &signer) acquires Message {
    let message = utf8(b"Hello, World!");
    set_message(account, message);
    let message_owner_address = signer::address_of(account);
    let stored_message = get_message(message_owner_address);
    assert!(message == stored_message, 0);
  }
}

Step 3. Understanding Module

fungible_asset.move ํŒŒ์ผ์— ์ž‘์„ฑ๋œ ๊ฐ ์ฝ”๋“œ๊ฐ€ ์–ด๋–ค ์—ญํ• ์„ ํ•˜๋Š”์ง€ ์•Œ์•„๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค.

  • Module ์„ ์–ธ
module ownerAddress::message {}

Module์„ ๋ฐฐํฌํ•˜๋Š” ์ฃผ์†Œ์™€ Module์˜ ์ด๋ฆ„์ž…๋‹ˆ๋‹ค. {} ์•ˆ์— ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค.

ownerAddress๋Š” Move.toml์—์„œ ์„ค์ •ํ•œ [addresses] ํ•„๋“œ์˜ ownerAddress ๊ฐ’ ์ž…๋‹ˆ๋‹ค.


  • ๋ชจ๋“ˆ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ
use std::signer;
use std::string::{Self,utf8, String};
use std::error;

๋‹ค๋ฅธ ๋ชจ๋“ˆ์„ ์žฌ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” use ๋ช…๋ น์–ด๋ฅผ ์ด์šฉํ•ด Aptos์—์„œ ์ง€์›ํ•˜๋Š” Standard ๋ชจ๋“ˆ์˜ ํ•จ์ˆ˜, ๊ตฌ์กฐ์ฒด ๋“ฑ์„ importํ•ฉ๋‹ˆ๋‹ค. use <address>::<Module> ํ˜น์€ use <address>::<ModuleName>::<Resource> ํ˜•ํƒœ๋กœ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ด ์™ธ์—๋„ Aptos๋Š” ๋‹ค์–‘ํ•œ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. 0x1 ์ฃผ์†Œ์˜ Module์„ ํ™•์ธํ•ด ๋ณด์„ธ์š”!


  • Message ๊ตฌ์กฐ์ฒด ์ •์˜
  struct Message has key {
    message_counter : u64,
    message : String,
  }

์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•˜๋Š” Message ์ €์žฅํ•˜๊ธฐ ์œ„ํ•œ ๊ตฌ์กฐ์ฒด ์ž…๋‹ˆ๋‹ค. โ€œhas keyโ€๋ผ๋Š” ๊ตฌ์กฐ์ฒด์˜ ์†์„ฑ์— ์˜ํ•ด ํ•ด๋‹น ๊ตฌ์กฐ์ฒด๋ฅผ Account์˜ Resource๋กœ ํ• ๋‹นํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


  • ์—๋Ÿฌ ์ฒ˜๋ฆฌ์šฉ ์ƒ์ˆ˜
const ENO_MESSAGE: u64 = 0;

์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ์ƒ์ˆ˜ ์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ์ด์šฉํ•˜์—ฌ assert ๋ฌธ์—์„œ error::not_found(ENO_MESSAGE) ํ•จ์ˆ˜์˜ ์ธ์ž๋กœ ์ด์šฉํ•ด ์—๋Ÿฌ ์ฒ˜๋ฆฌ๋ฅผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


  • get_message ํ•จ์ˆ˜ ์ •์˜
#[view]  
public fun get_message(message_owner : address) : string::String acquires Message {
  assert!(exists<Message>(message_owner), error::not_found(ENO_MESSAGE));
  borrow_global<Message>(message_owner).message
}

Message ๊ตฌ์กฐ์ฒด์— ์ž…๋ ฅ๋˜์–ด ์žˆ๋Š” message๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋Š” get_message ํ•จ์ˆ˜๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ์ธ์ž๋กœ ๋ฐ›๋Š” message_owner์˜ ์ฃผ์†Œ์— Message ๊ตฌ์กฐ์ฒด๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ ์—๋Ÿฌ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๊ณ  Message ๊ตฌ์กฐ์ฒด๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ Message ๊ตฌ์กฐ์ฒด์˜ message๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.


  • set_message ํ•จ์ˆ˜ ์ •์˜
public entry fun set_message(admin: &signer, message : String) acquires Message{
  let message_owner_address = signer::address_of(admin);
  if (exists<Message>(message_owner_address)) {
    let stored_message = borrow_global_mut<Message>(message_owner_address);
    stored_message.message = message;
  } else {
    move_to(admin, Message{
      message_counter : 1,
      message : message
    });
  }
}

Message ๊ตฌ์กฐ์ฒด์— message๋ฅผ ์ž…๋ ฅํ•  ์ˆ˜ ์žˆ๋Š” set_message ํ•จ์ˆ˜๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ๋ชจ๋“ˆ์˜ Owner๊ฐ€ ํ˜ธ์ถœํ•˜์—ฌ message๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ์ฃผ์†Œ์— Message ๊ตฌ์กฐ์ฒด๊ฐ€ ์žˆ๋Š”์ง€ ํ™•์ธํ•˜๊ณ  Message ๊ตฌ์กฐ์ฒด๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ๊ธฐ์กด message๋ฅผ ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ message๋กœ ๋ณ€๊ฒฝํ•˜๊ณ  Message ๊ตฌ์กฐ์ฒด๊ฐ€ ์—†๋Š” ๊ฒฝ์šฐ ์‚ฌ์šฉ์ž์˜ ์ฃผ์†Œ์— ์‚ฌ์šฉ์ž๊ฐ€ ์ž…๋ ฅํ•œ message์™€ message_counter๊ฐ€ 1์ธ Message ๊ตฌ์กฐ์ฒด๋ฅผ ํ• ๋‹นํ•ฉ๋‹ˆ๋‹ค.

(set_message์˜ ๋กœ์ง ์ค‘ ์ด์ƒํ•œ ๊ฑธ ๋ฐœ๊ฒฌํ•˜์…จ๋‚˜์š”? ์ด ๋ถ€๋ถ„์€ Tutorial 6์—์„œ ๊ณ„์†๋ฉ๋‹ˆ๋‹ค!)


  • Test ์ฝ”๋“œ ์ž‘์„ฑ (Optional)
#[test(account = @ownerAddress)]
  public entry fun test_message(account: &signer) acquires Message {
    let message = utf8(b"Hello, World!");
    set_message(account, message);
    let message_owner_address = signer::address_of(account);
    let stored_message = get_message(message_owner_address);
    assert!(message == stored_message, 0);
  }
}

Module์— ์ž‘์„ฑํ•œ ํ•จ์ˆ˜๋ฅผ ์ด์šฉํ•ด Module์„ ๋ฐฐํฌํ•˜๊ธฐ ์ „ ๊ธฐ๋Šฅ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•ด๋‹น ์ฝ”๋“œ์˜ ๋กœ์ง์€ โ€œHello World!โ€๋ผ๋Š” ๋ฉ”์‹œ์ง€๋ฅผ set_message๋ฅผ ์ด์šฉํ•ด ownerAddress์— Resource๋กœ ํ• ๋‹นํ•œ ํ›„ get_message๋ฅผ ์ด์šฉํ•ด ๋ถˆ๋Ÿฌ์˜จ ๊ฐ’๊ณผ โ€œHello World!โ€๋ผ๋Š” ๊ฐ’์ด ๋™์ผํ•œ์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค.


ํ„ฐ๋ฏธ๋„์— ์•„๋ž˜์˜ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜์—ฌ ํ…Œ์ŠคํŠธ๋ฅผ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

$ aptos move test

Step 4. Deploy your Module

์ตœ์ข…์ ์œผ๋กœ ์™„์„ฑํ•œ Module์€ Aptos CLI๋ฅผ ์ด์šฉํ•ด Aptos ๋„คํŠธ์›Œํฌ์— ๋ฐฐํฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋ฐฐํฌ ๋ฐฉ๋ฒ•์€ ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

  1. Module Compile

move ํŒŒ์ผ์ด ์ž‘์„ฑ๋˜์–ด ์žˆ๋Š” ๊ฒฝ๋กœ์—์„œ Aptos CLI๋ฅผ ์ด์šฉํ•ด Module์„ ์ปดํŒŒ์ผ ํ•ฉ๋‹ˆ๋‹ค.

$ aptos move compile

์„ฑ๊ณต์ ์œผ๋กœ ์ปดํŒŒ์ผ์ด ์™„๋ฃŒ๋˜๋ฉด ๋‹ค์Œ๊ณผ ๊ฐ™์€ ์‘๋‹ต์„ ๋ฐ›์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

UPDATING GIT DEPENDENCY https://github.com/aptos-labs/aptos-core.git
INCLUDING DEPENDENCY AptosFramework
INCLUDING DEPENDENCY AptosStdlib
INCLUDING DEPENDENCY MoveStdlib
BUILDING <your Package Name>
{
  "Result": [
    "<address>::<module_name>"
  ]
}

  1. Module Deploy

Compile์ด ์™„๋ฃŒ๋œ move ํŒŒ์ผ์„ Aptos CLI๋ฅผ ์ด์šฉํ•ด Aptos ๋„คํŠธ์›Œํฌ์— ๋ฐฐํฌํ•ฉ๋‹ˆ๋‹ค. move ํŒŒ์ผ์ด ์ž‘์„ฑ๋˜์–ด ์žˆ๋Š” ๊ฒฝ๋กœ์—์„œ ์•„๋ž˜ ๋ช…๋ น์–ด๋ฅผ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

$ aptos move publish

์„ฑ๊ณต์ ์œผ๋กœ ๋ฐฐํฌ๊ฐ€ ์™„๋ฃŒ๋˜๋ฉด ๋ฐฐํฌ ํŠธ๋žœ์žญ์…˜์— ๋Œ€ํ•œ ํŠธ๋žœ์žญ์…˜ ๊ฒฐ๊ณผ๋ฅผ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

{
  "Result": {
    "transaction_hash": "0x1234...",
    "gas_used": 3540,
    "gas_unit_price": 100,
    "sender": "abc...90",
    "sequence_number": 0,
    "success": true,
    "timestamp_us": 1720593360929545,
    "version": 26759186,
    "vm_status": "Executed successfully"
  }
}

Nodit์—์„œ ์ œ๊ณตํ•˜๋Š” Aptos Node API ์ค‘ Get account module API๋ฅผ ์ด์šฉํ•˜๋ฉด ํŠน์ • Account๊ฐ€ ๋ฐฐํฌํ•œ Module์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.


๐Ÿ“˜

Nodit Aptos Node API๋Š” ์–ด๋–ป๊ฒŒ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‚˜์š”?

Nodit์€ Aptos Node API ์‚ฌ์šฉ ๊ฐ€์ด๋“œ๋ฅผ ์ œ๊ณตํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค! ์•„๋ž˜ ๋งํฌ๋ฅผ ํด๋ฆญํ•˜์—ฌ Get account module API๋ฅผ ๋”์šฑ ์ž์„ธํžˆ ์•Œ์•„๋ณด์„ธ์š”!


Get account module API๋Š” Query Params๋กœ Account Address์™€ moduleName์„ ์ด์šฉํ•ฉ๋‹ˆ๋‹ค. header๋กœ X-API-KEY๋ฅผ ์ถ”๊ฐ€ํ•˜๊ณ  Nodit์„ ํ†ตํ•ด ๋ฐœ๊ธ‰๋ฐ›์€ X-API-KEY๋ฅผ ์ž…๋ ฅํ•œ ํ›„ API๋ฅผ ํ˜ธ์ถœํ•ด ๋ณด์„ธ์š”!

curl --request GET \
     --url https://aptos-testnet.nodit.io/v1/accounts/<account_address>/module/<module_name> \
     --header 'X-API-KEY: <Your X-API-KEY>' \
     --header 'accept: application/json'

์•„๋ž˜์™€ ๊ฐ™์ด ๋ฐฐํฌํ•œ Module์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

{
  "bytecode": "0xa11ceb0b060000...",
  "abi": {
    "address": "0xabc...90",
    "name": "<your_module_name>",
		...
  }
}

์œ„์˜ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•˜์—ฌ Module์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‚˜์š”?


  • ํ™•์ธ์ด ๋˜์ง€ ์•Š๋Š”๋‹ค๋ฉด ์œ„์˜ ์ฝ”๋“œ์™€ ๋‹ค๋ฅธ ๋ถ€๋ถ„์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ด ๋ณด์„ธ์š”.
  • ์œ„์˜ ์ฝ”๋“œ์™€ ์ฐจ์ด๊ฐ€ ์—†๋Š”๋ฐ ๋˜์ง€ ์•Š๋‚˜์š”? ์—ฌ๊ธฐ[QnA ๋งํฌ]๋ฅผ ํด๋ฆญํ•˜์—ฌ QnA๋กœ ๋‚จ๊ฒจ์ฃผ์„ธ์š”!

๐Ÿ“˜

Aptos๋Š” ๋งค์šฐ ๋น ๋ฅด๊ฒŒ ์—…๋ฐ์ดํŠธ ๋˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค!

Aptos ์žฌ๋‹จ์—์„œ ๋ฐฐํฌํ•œ SDK ๋ฒ„์ „์— ๋”ฐ๋ผ ๋ณ€๊ฒฝ๋˜๋Š” ์ ์ด ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Nodit์€ ํ•ญ์ƒ ์ด๋ฅผ ํ™•์ธํ•˜๊ณ  ์žˆ์œผ๋‚˜ ์‹œ์ ์— ๋”ฐ๋ผ ์ฝ”๋“œ ๋ณ€๊ฒฝ์œผ๋กœ ์ธํ•œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.