šŸ“Œ

šŸ¶Aptosć®ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć‚’čŖ­ć‚“恧ē°”ꘓDAppć‚’ä½œć£ć¦ćæ恟šŸ¶

2022/11/19ć«å…¬é–‹ćƒ»ē“„30,000字

ēš†ć•ć‚“态恓悓恫恔ćÆļ¼

今回ćÆć€å…ˆę—„ćƒ”ć‚¤ćƒ³ćƒćƒƒćƒˆćŒćƒ­ćƒ¼ćƒ³ćƒć—ćŸć°ć‹ć‚Šć®ćƒ–ćƒ­ćƒƒć‚Æćƒć‚§ćƒ¼ćƒ³ć§ć‚ć‚‹Aptosć®ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć‚’čŖ­ć‚“恧ē°”ꘓDappć‚’ä½œć£ć¦ćæćŸć®ć§ćć®čØ˜éŒ²ć‚’ć¾ćØć‚ć¦ć„ćć¾ć™ļ¼

Aptosć®ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æ惈ćÆ态Rustč؀čŖžćƒ©ć‚¤ć‚ÆćŖćƒ—ćƒ­ć‚°ćƒ©ćƒŸćƒ³ć‚°č؀čŖžć§ć‚ć‚‹Moveč؀čŖžć§é–‹ē™ŗć—ć¾ć™ļ¼

čˆˆå‘³ćŒć‚ć‚‹ę–¹ćÆćœć²čŖ­ćæé€²ć‚“ć§ćæć¦ćć ć•ć„ļ¼

ć‚½ćƒ¼ć‚¹ćÆäø‹čØ˜ć®ćƒŖ惝ć‚ø惈ćƒŖć«ć¾ćØć‚ć¦ć„ć¾ć™ļ¼

https://github.com/mashharuki/AptosRepo

ē›®ę¬”

  1. Aptos恫恤恄恦
  2. ä»Šå›žć‚„ć£ćŸćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć®ę¦‚č¦
  3. ä½œć£ćŸDApp恮ꦂ要
  4. ć‚½ćƒ¼ć‚¹ć‚³ćƒ¼ćƒ‰ćŖ恩
  5. ćć®ä»–AptosäøŠć«å±•é–‹ć•ć‚Œć¦ć„悋갗恫ćŖć£ćŸćƒ—ćƒ­ćƒ€ć‚Æ惈
  6. ęœ€å¾Œć«

1. Aptos恫恤恄恦

ć¾ćšćÆ态ē°”å˜ć«Aptosć«ć¤ć„ć¦ć¾ćØć‚ć¦ć„ćć¾ć™ļ¼

AptosćÆ态開ē™ŗäø­ć®L1(Layer 1)惖惭惃ć‚Æćƒć‚§ćƒ¼ćƒ³ć‚„ćć®ćƒ—ćƒ­ć‚ø悧ć‚Æ惈恮ē·ē§°ć§ć€é«˜å‡¦ē†čƒ½åŠ›ćƒ»ä½Žé…å»¶ć‚’å¼·ćæćØć—ć¦ć„ć¾ć™ć€‚

ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æćƒˆć‚’ę‰±ć†ć“ćØ悂恧恍悋恟悁态Avalanche悄SolanaćØć„ć£ćŸćƒć‚§ćƒ¼ćƒ³ćØē«¶åˆć™ć‚‹ćƒ—ćƒ­ć‚ø悧ć‚Æ惈恧恙怂AptosćÆ态Diemć®å…ƒćƒ”ćƒ³ćƒćƒ¼ć§ć‚ć‚‹Mo Shaikhę°ćƒ»Avery Ching갏恌äø­åæƒćØćŖć£ć¦é–‹ē™ŗćŒć‚¹ć‚æćƒ¼ćƒˆć—ć¦ć„ć¦ć€ćƒ©ć‚¤ćƒćƒ«ćƒ—ćƒ­ć‚ø悧ć‚Æ惈ćØ恗恦ćÆ态SuićŒęŒ™ć’ć‚‰ć‚Œć¾ć™ć€‚

googlećØć‚‚ćƒ‘ćƒ¼ćƒˆćƒŠćƒ¼ć‚·ćƒƒćƒ—ć‚’ęęŗ恗恦恊悊态Web3開ē™ŗē’°å¢ƒć®ę•“å‚™ć‚„ćƒćƒƒć‚«ć‚½ćƒ³ć®é–‹å‚¬ć‚‚ä¼ē”»ć•ć‚Œć¦ć„ć‚‹ćØ恄恆恓ćØć§ć“ć‚Œć¾ć§ć®ćƒ–ćƒ­ćƒƒć‚Æćƒć‚§ćƒ¼ćƒ³ćƒ—ćƒ­ć‚ø悧ć‚Æ惈ćØćÆć¾ćŸé•ć£ćŸć‚¢ćƒ—ćƒ­ćƒ¼ćƒć§äø–恮äø­ćøć®ę™®åŠć‚’å›³ć‚ć†ćØć—ć¦ć„ć¾ć™ć€‚

https://coinpost.jp/?p=406562

å…ˆę—„ćƒ”ć‚¤ćƒ³ćƒćƒƒćƒˆćŒćƒ­ćƒ¼ćƒ³ćƒć•ć‚Œć¾ć—ćŸćŒć€ćƒ†ć‚¹ćƒˆćƒćƒƒćƒˆå…¬é–‹ć®ę™‚ē‚¹ć§ć‚‚恙恧恫100仄äøŠć®ćƒ—ćƒ­ć‚ø悧ć‚Æ惈恌AptosäøŠć«å±•é–‹ć•ć‚Œć¦ć„ćŸćØ恄恆恓ćØ恧恋ćŖ悊ę³Øē›®åŗ¦ćŒé«˜ć‹ć£ćŸćƒ—ćƒ­ćƒƒć‚Æćƒć‚§ćƒ¼ćƒ³ć«ćŖć‚Šć¾ć™ć€‚

äø‹čØ˜ć‚µć‚¤ćƒˆć‹ć‚‰ćƒ—ćƒ­ć‚ø悧ć‚Æ惈恮äø€č¦§ćŒē¢ŗčŖć§ćć¾ć™ć€‚

https://movemarketcap.com/aptos/

開ē™ŗ恫ä½æē”Øć•ć‚Œć¦ć„ć‚‹ć®ćÆ态恂恮Diem恧悂ꎔē”Øć•ć‚Œć¦ć„ćŸćØ恄恆Moveč؀čŖžć«ćŖć‚Šć¾ć™ć€‚

Moveč؀čŖžćÆRustč؀čŖžć‚’ćƒ™ćƒ¼ć‚¹ć«ä½œć‚‰ć‚Œć¦ć„ć‚‹ć®ć§č¦‹ćŸē›®ćŒRustć«ä¼¼ć¦ć„ć¾ć™ļ¼ćć®ćŸć‚ć€č¤‡ę•°ć‚æć‚¹ć‚Æ悒äø¦åˆ—処ē†ć§ćć‚‹ć“ćØć‚„å®‰å…ØćŖćƒ”ćƒ¢ćƒŖē®”ē†ć®ä»•ēµ„ćæćŖ恩Rustč؀čŖžć®č‰Æ恄éƒØåˆ†ć‚‚ē¶™ę‰æć•ć‚Œć¦ć„ć¾ć™ć€‚

ć‚³ćƒ³ć‚»ćƒ³ć‚µć‚¹ć‚¢ćƒ«ć‚“ćƒŖć‚ŗ惠恫ćÆ态Bullshark /ćƒ–ćƒ«ćƒ¼ć‚·ćƒ£ćƒ¼ć‚ÆćØå‘¼ć°ć‚Œć‚‹ć‚‚ć®ćŒęŽ”ē”Øć•ć‚Œć¦ć„ć¾ć™ć€‚BullsharkćÆ态HotStuffćØć„ć†ć‚³ćƒ³ć‚»ćƒ³ć‚µć‚¹ć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ć‚’ćƒ™ćƒ¼ć‚¹ć«ä½œć‚‰ć‚Œć¦ćŠć‚Šć€é«˜é€Ÿę€§ć‚„å®‰å…Øę€§ć‚’ć•ć‚‰ć«ę”¹å–„ć—ćŸć‚‚ć®ćØćŖć£ć¦ć„ć¾ć™ć€‚

ć‚³ćƒ³ć‚»ćƒ³ć‚µć‚¹ć‚¢ćƒ«ć‚“ćƒŖć‚ŗćƒ ć«ć¤ć„ć¦ćÆć¾ć•ć«ä»Šć€äø–ē•Œäø­ć§ć‚ˆć‚Šč‰Æć„ć‚¢ćƒ«ć‚“ćƒŖć‚ŗ惠恌ē ”ē©¶ć•ć‚Œć¦ć„ć‚‹ēœŸć£ęœ€äø­ćŖć®ć§ä»Šå¾ŒćÆ恕悉恫č‰Æć„ć‚¢ćƒ«ć‚“ćƒŖć‚ŗ惠恌ē”Ÿćæå‡ŗć•ć‚Œć¦ćć‚‹åÆčƒ½ę€§ćŒć‚ć‚Šć¾ć™ļ¼ļ¼

恂ćØ态ē‰¹ē­†ć™ć¹ćē‚¹ćØ恗恦ćÆć‚»ć‚­ćƒ„ćƒŖćƒ†ć‚£é¢ć§ć‚‚é¢ē™½ć„試ćæć‚’ć—ć¦ć„ć¾ć™ć€‚å¾“ę„ć®ä»•ēµ„ćæ恧恂悌恰äø€åŗ¦ē“›å¤±ć—ćŸę—„ē§˜åƆ鍵ćÆć€ä½•ć‚‰ć‹ć®ćƒćƒƒć‚Æć‚¢ćƒƒćƒ—ćŒćŖć„å “åˆć«ćÆå¾©å…ƒć™ć‚‹ć“ćØ恌äøåÆčƒ½ć§ć—ćŸćŒć€Aptos恧ćÆ恝悌悒åÆčƒ½ć«ć™ć‚‹ćŸć‚ć®ä»•ēµ„ćæć‚’ä½œć‚ć†ćØć—ćŸć‚Šć—ć¦ć„ć‚‹ćØ恮恓ćØ恧恙怂

ē§˜åÆ†éµć®ē›—é›£é˜²ę­¢ć®ćŸć‚ć«ćƒ­ćƒ¼ćƒ†ćƒ¼ć‚·ćƒ§ćƒ³ę©Ÿčƒ½ćŖć©ć‚‚å‚™ćˆć‚‰ć‚Œć¦ćŠć‚Šå¾“ę„ć®ćƒ–ćƒ­ćƒƒć‚Æćƒć‚§ćƒ¼ćƒ³ćƒ—ćƒ­ć‚ø悧ć‚ÆćƒˆćŒęŠ±ćˆć¦ć„ćŸčŖ²é”Œć‚’č§£ę±ŗ恗悈恆ćØć—ć¦ć„ć¾ć™ć€‚

Aptos恫恤恄恦恮ē°”単ćŖꦂ要ćÆć“ć“ć¾ć§ćØ恗恟恄ćØę€ć„ć¾ć™ļ¼ļ¼

2. ä»Šå›žć‚„ć£ćŸćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć®ę¦‚č¦

ä»Šå›žćƒˆćƒ©ć‚¤ć—ćŸćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć§ć™ćŒć€äø‹čØ˜ć‚µć‚¤ćƒˆć‚’å‚č€ƒć«é †ē•Ŗć«å®Ÿę–½ć—ć¦ć„ćć¾ć—ćŸļ¼

https://aptos.dev/tutorials/aptos-quickstarts

CLIć®ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć«å§‹ć¾ć‚Šć€ćƒˆćƒ©ćƒ³ć‚¶ć‚Æć‚·ćƒ§ćƒ³ć®é€äæ”悄ē°”単ćŖć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æćƒˆć®å®Ÿč£…ć€dappć®å®Ÿč£…ćØć„ć£ćŸå…·åˆć§ć™ļ¼ļ¼

ć¾ćšćÆ态CLIć®ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć‹ć‚‰ć§ć™ļ¼

åŸŗęœ¬ēš„恫ćÆ開ē™ŗč€…å‘ć‘ćƒ‰ć‚­ćƒ„ćƒ”ćƒ³ćƒˆć®ęŒ‡ē¤ŗć«å¾“ć£ć¦é€²ć‚ć¦ć„ć‘ć°å•é”ŒćŖćć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć§ćć‚‹ćØę€ć„ć¾ć™ļ¼

https://aptos.dev/cli-tools/aptos-cli-tool/install-aptos-cli

ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ćŒć†ć¾ćć„ć‘ć°ć€ aptos -hćØå…„åŠ›ć™ć‚‹ćØę¬”ć®ć‚ˆć†ćŖå†…å®¹ćŒć‚æćƒ¼ćƒŸćƒŠćƒ«ć«å‡ŗåŠ›ć•ć‚Œć‚‹ćØę€ć„ć¾ć™!

Command Line Interface (CLI) for developing and interacting with the Aptos blockchain

USAGE:
    aptos <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -V, --version    Print version information

SUBCOMMANDS:
    account       Tool for interacting with accounts
    config        Tool for interacting with configuration of the Aptos CLI tool
    genesis       Tool for setting up an Aptos chain Genesis transaction
    governance    Tool for on-chain governance
    help          Print this message or the help of the given subcommand(s)
    info          Show build information about the CLI
    init          Tool to initialize current directory for the aptos tool
    key           Tool for generating, inspecting, and interacting with keys
    move          Tool for Move related operations
    node          Tool for operations related to nodes
    stake         Tool for manipulating stake

Aptos SDKć®ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ćÆć€ę¬”ć®ć‚³ćƒžćƒ³ćƒ‰ć§å®Ÿč”Œć§ćć¾ć™ļ¼

npm i aptos

ć•ć¦ć€ć¾ćšćÆćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć®ęœ€åˆć‹ć‚‰ć„ćć¾ć™ć€‚

Your Fisrt Transaction

https://github.com/aptos-labs/aptos-core.git恋悉git悒cloneć—ć¦ćć¾ć™ć€‚

ęœ€åˆć®ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć§å®Ÿč”Œć™ć‚‹ć®ćÆ态transfer_coin.tsćØć„ć†ć‚¹ć‚ÆćƒŖćƒ—ćƒˆć«ćŖć‚Šć¾ć™ć€‚

äø­čŗ«ć‚‚ē°”å˜ć«ęŽ²č¼‰ć—ć¾ć™ć€‚

transfer_coin
import dotenv from "dotenv";
dotenv.config();

import { 
    AptosClient, 
    AptosAccount, 
    CoinClient,
    FaucetClient 
} from "aptos";
import { 
    NODE_URL, 
    FAUCET_URL 
} from "./common";


(async () => {
    // Create API and faucet clients.
    const client = new AptosClient(NODE_URL);
    const faucetClient = new FaucetClient(NODE_URL, FAUCET_URL); 

    // Create client for working with the coin module.
    const coinClient = new CoinClient(client); 

    // Create accounts.
    const alice = new AptosAccount();
    const bob = new AptosAccount(); 

    // Print out account addresses.
    console.log("=== Addresses ===");
    console.log(`Alice: ${alice.address()}`);
    console.log(`Bob: ${bob.address()}`);
    console.log("");

    // Fund accounts.
    await faucetClient.fundAccount(alice.address(), 100_000_000);
    await faucetClient.fundAccount(bob.address(), 0); 

    // Print out initial balances.
    console.log("=== Initial Balances ===");
    console.log(`Alice: ${await coinClient.checkBalance(alice)}`);
    console.log(`Bob: ${await coinClient.checkBalance(bob)}`); 
    console.log("");

    // Have Alice send Bob some AptosCoins. (transfer)
    let txnHash = await coinClient.transfer(alice, bob, 1_000, { 
        gasUnitPrice: BigInt(100) 
    }); 
    // Waiting for transaction resolution
    await client.waitForTransaction(txnHash); 

    // Print out intermediate balances.
    console.log("=== Intermediate Balances ===");
    console.log(`Alice: ${await coinClient.checkBalance(alice)}`);
    console.log(`Bob: ${await coinClient.checkBalance(bob)}`);
    console.log("");

    // Have Alice send Bob some more AptosCoins.
    txnHash = await coinClient.transfer(alice, bob, 1_000, { 
        gasUnitPrice: BigInt(100) 
    });
    // Waiting for transaction resolution
    await client.waitForTransaction(txnHash, { checkSuccess: true });

    // Print out final balances.
    console.log("=== Final Balances ===");
    console.log(`Alice: ${await coinClient.checkBalance(alice)}`);
    console.log(`Bob: ${await coinClient.checkBalance(bob)}`);
    console.log("");
})();

ć“ć®ć‚¹ć‚ÆćƒŖćƒ—ćƒˆćŒć†ć¾ćå®Ÿč”Œć•ć‚Œć‚‹ćØę¬”ć®ć‚ˆć†ć«å‡ŗåŠ›ć•ć‚Œć¾ć™ć€‚

å®Ÿč”Œć—ć¦ć„ć‚‹å†…å®¹ćØ恗恦ćÆ态ć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆē”Øć®ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć‚’čŖ­ćæč¾¼ć‚“ć§ļ¼’ć¤ć®ć‚¢ć‚«ć‚¦ćƒ³ćƒˆć‚’ä½œęˆć—ć€ćƒˆćƒ¼ć‚Æćƒ³ć‚’ä»˜äøŽć—č»¢é€ć™ć‚‹ćØć„ć£ćŸć‚·ćƒ³ćƒ—ćƒ«ćŖ悂恮恧恙怂ethersćŖ恩悒ä½æć£ć¦ćƒˆćƒ©ćƒ³ć‚¶ć‚Æć‚·ćƒ§ćƒ³ć‚’å®Ÿč”Œć™ć‚‹å‡¦ē†ć‚’å®Ÿč£…ć—ćŸć“ćØ恌恂悋äŗŗ恧恂悌恰ćŖ悓ćØćŖćč¦‹č¦šćˆć®ć‚ć‚‹čؘčæ°ć«ćŖć£ć¦ć„ć‚‹ćØę€ć„ć¾ć™ć€‚

=== Addresses ===
Alice: 0x14b30e5b42a94247c1dd97d4f24d01449cc5e85b02ebcb7fc0281f915fefb963
Bob: 0x121ba4c14d9fba0bc89b201e467771a274547379c03b1bd082abba751c012994

=== Initial Balances ===
Alice: 100000000
Bob: 0

=== Intermediate Balances ===
Alice: 99972800
Bob: 1000

=== Final Balances ===
Alice: 99945600
Bob: 2000

ć†ć¾ććƒˆćƒ¼ć‚Æćƒ³ćŒč»¢é€ć•ć‚Œć¦ć„ć‚‹ć“ćØ恌ē¢ŗčŖć§ćć¾ć™ļ¼

Your First NFT

ꬔćÆć‚‚ć®ć™ć”ćć‚·ćƒ³ćƒ—ćƒ«ćŖNFTć‚’č»¢é€ć™ć‚‹ć‚¹ć‚ÆćƒŖ惗惈恧恙ļ¼
ć“ć”ć‚‰ć‚‚ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć®ęŒ‡ē¤ŗć«å¾“ć£ć¦č³‡ęć‚’å¼•ć£å¼µć£ć¦ćć¾ć—ć‚‡ć†ļ¼

恓恓恧ćÆ态NFTć®ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æ惈ćÆå®Ÿč£…ć›ćšć«Aptoså“ć§ē”Øę„ć—ć¦ćć‚Œć¦ć„ć‚‹ć‚‚ć®ć‚’åˆ©ē”Øć—ć¾ć™ļ¼
č©³ć—ć„äø­čŗ«ć‚’ēŸ„ć‚ŠćŸć„ę–¹ćÆäø‹čØ˜ćƒšćƒ¼ć‚øć‚’å‚ē…§ć—恦ćæć¦ćć ć•ć„ļ¼

https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/framework/aptos-token/sources/token.move

https://github.com/aptos-labs/aptos-core/tree/main/aptos-move/move-examples/mint_nft

å®Ÿč”Œć™ć‚‹ć‚µćƒ³ćƒ—ćƒ«ć‚¹ć‚ÆćƒŖ惗惈ćÆę¬”ć®ć‚ˆć†ćŖå†…å®¹ć§ć™ć€‚

simple_nft.ts
import dotenv from "dotenv";
dotenv.config();

import { 
    AptosClient, 
    AptosAccount, 
    FaucetClient, 
    TokenClient, 
    CoinClient 
} from "aptos";
import { 
    NODE_URL, 
    FAUCET_URL 
} from "./common";

(async () => {
    // Create API and faucet clients.
    const client = new AptosClient(NODE_URL);
    const faucetClient = new FaucetClient(NODE_URL, FAUCET_URL); 

    // Create client for working with the token module.
    const tokenClient = new TokenClient(client); 
    // Create a coin client for checking account balances.
    const coinClient = new CoinClient(client);

    // Create accounts.
    const alice = new AptosAccount();
    const bob = new AptosAccount(); 

    // Print out account addresses.
    console.log("=== Addresses ===");
    console.log(`Alice: ${alice.address()}`);
    console.log(`Bob: ${bob.address()}`);
    console.log("");

    // Fund accounts.
    await faucetClient.fundAccount(alice.address(), 100_000_000);
    await faucetClient.fundAccount(bob.address(), 100_000_000); 

    console.log("=== Initial Coin Balances ===");
    console.log(`Alice: ${await coinClient.checkBalance(alice)}`);
    console.log(`Bob: ${await coinClient.checkBalance(bob)}`);
    console.log("");

    console.log("=== Creating Collection and Token ===");

    const collectionName = "Alice's";
    const tokenName = "Alice's first token";
    const tokenPropertyVersion = 0;

    const tokenId = {
        token_data_id: {
            creator: alice.address().hex(),
            collection: collectionName,
            name: tokenName,
        },
        property_version: `${tokenPropertyVersion}`,
    };

    // Create the collection.
    const txnHash1 = await tokenClient.createCollection(
        alice,
        collectionName,
        "Alice's simple collection",
        "https://alice.com",
    ); 
    // Waiting for transaction resolution
    await client.waitForTransaction(txnHash1, { 
        checkSuccess: true 
    });

    // Create a token in that collection.
    const txnHash2 = await tokenClient.createToken(
        alice,
        collectionName,
        tokenName,
        "Alice's simple token",
        1,
        "https://aptos.dev/img/nyan.jpeg",
    ); 
    // Waiting for transaction resolution
    await client.waitForTransaction(txnHash2, { 
        checkSuccess: true 
    });

    // get the collection data.
    const collectionData = await tokenClient.getCollectionData(alice.address(), collectionName);
    console.log(`Alice's collection: ${JSON.stringify(collectionData, null, 4)}`);

    // Get the token balance.
    const aliceBalance1 = await tokenClient.getToken(
        alice.address(),
        collectionName,
        tokenName,
        `${tokenPropertyVersion}`,
    );
    console.log(`Alice's token balance: ${aliceBalance1["amount"]}`);

    // Get the token data.
    const tokenData = await tokenClient.getTokenData(
        alice.address(), 
        collectionName, 
        tokenName
    );
    console.log(`Alice's token data: ${JSON.stringify(tokenData, null, 4)}`); // <:!:section_8

    // Alice offers one token to Bob.
    console.log("\n=== Transferring the token to Bob ===");
    
    // transfer
    const txnHash3 = await tokenClient.offerToken(
        alice,
        bob.address(),
        alice.address(),
        collectionName,
        tokenName,
        1,
        tokenPropertyVersion,
    ); 
    // Waiting for transaction resolution
    await client.waitForTransaction(txnHash3, { 
        checkSuccess: true 
    });

    // Bob claims the token Alice offered him.
    const txnHash4 = await tokenClient.claimToken(
        bob,
        alice.address(),
        alice.address(),
        collectionName,
        tokenName,
        tokenPropertyVersion,
    ); 
    // Waiting for transaction resolution
    await client.waitForTransaction(txnHash4, { 
        checkSuccess: true 
    });

    // get token data
    const aliceBalance2 = await tokenClient.getToken(
        alice.address(),
        collectionName,
        tokenName,
        `${tokenPropertyVersion}`,
    );
    // get balance
    const bobBalance2 = await tokenClient.getTokenForAccount(bob.address(), tokenId);

    console.log(`Alice's token balance: ${aliceBalance2["amount"]}`);
    console.log(`Bob's token balance: ${bobBalance2["amount"]}`);

    console.log("\n=== Transferring the token back to Alice using MultiAgent ===");

    // transfer token
    let txnHash5 = await tokenClient.directTransferToken(
        bob,
        alice,
        alice.address(),
        collectionName,
        tokenName,
        1,
        tokenPropertyVersion,
    ); 
    // Waiting for transaction resolution
    await client.waitForTransaction(txnHash5, { 
        checkSuccess: true 
    });

    // get token data
    const aliceBalance3 = await tokenClient.getToken(
        alice.address(),
        collectionName,
        tokenName,
        `${tokenPropertyVersion}`,
    );
    // get balance
    const bobBalance3 = await tokenClient.getTokenForAccount(bob.address(), tokenId);

    console.log(`Alice's token balance: ${aliceBalance3["amount"]}`);
    console.log(`Bob's token balance: ${bobBalance3["amount"]}`);
})();

å…ˆć»ć©ćØåŒć˜ć§ęœ€åˆć«ćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć®ć‚¤ćƒ³ćƒćƒ¼ćƒˆć‚’č”Œć£ć¦ć€ć‚¢ć‚«ć‚¦ćƒ³ćƒˆć®ä½œęˆć€NFTć®ä½œęˆā†’č»¢é€ć€ę®‹é«˜ć‚’ćƒć‚§ćƒƒć‚ÆćØć„ć†ęµć‚Œć«ćŖć£ć¦ć„ć¾ć™ļ¼

ę³Øē›®ć™ć¹ććÆć€ęœ€åˆć«čŖ­ćæč¾¼ć‚“ć§ć„ć‚‹tokenClientćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć§ć“ć“ć§å®Ÿč£…ć•ć‚Œć¦ć„ć‚‹ćƒ”ć‚½ćƒƒćƒ‰ć‚’ä½æć£ć¦ć€NFTć®ä½œęˆć‚„ä»˜äøŽć€č»¢é€ć‚’č”Œć†ć“ćØ恌恧恍悋ē‚¹ć§ć™ļ¼

問锌ćŖćå®Ÿč”Œć§ćć‚‹ćØäø‹čØ˜ć®ć‚ˆć†ćŖå†…å®¹ćŒć‚æćƒ¼ćƒŸćƒŠćƒ«ć«å‡ŗåŠ›ć•ć‚Œć¾ć™ļ¼

=== Addresses ===
Alice: 0x979600b20654944c269abf3ba52d06dfae1d98c74bead66d5ad0d3561d26cd2c
Bob: 0xcfb65b98f4a3277d04e18f864219ae65e28e03c817754a72345ac6d8eaf9bdea

=== Initial Coin Balances ===
Alice: 100000000
Bob: 100000000

=== Creating Collection and Token ===
Alice's collection: {
    "description": "Alice's simple collection",
    "maximum": "18446744073709551615",
    "mutability_config": {
        "description": false,
        "maximum": false,
        "uri": false
    },
    "name": "Alice's",
    "supply": "1",
    "uri": "https://alice.com"
}
Alice's token balance: 1
Alice's token data: {
    "default_properties": {
        "map": {
            "data": []
        }
    },
    "description": "Alice's simple token",
    "largest_property_version": "0",
    "maximum": "18446744073709551615",
    "mutability_config": {
        "description": false,
        "maximum": false,
        "properties": false,
        "royalty": false,
        "uri": false
    },
    "name": "Alice's first token",
    "royalty": {
        "payee_address": "0x979600b20654944c269abf3ba52d06dfae1d98c74bead66d5ad0d3561d26cd2c",
        "royalty_points_denominator": "0",
        "royalty_points_numerator": "0"
    },
    "supply": "1",
    "uri": "https://aptos.dev/img/nyan.jpeg"
}

=== Transferring the token to Bob ===
Alice's token balance: 0
Bob's token balance: 1

=== Transferring the token back to Alice using MultiAgent ===
Alice's token balance: 1
Bob's token balance: 0

Your First Coin

ć”ć‚‡ć£ćØ順ē•ŖćŒå‰å¾Œć—ć¾ć™ćŒć€dappć ć‘é‡ć„ć®ć§ęœ€åˆć«ć“ć£ć”ć‹ć‚‰ć¾ćØć‚ć¦ć„ćć¾ć™ļ¼ļ¼

https://aptos.dev/tutorials/your-first-coin

ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć«å¾“ć£ć¦cloneć—ć¦ćć¾ć™ļ¼

å®Ÿč”Œć™ć‚‹ć‚¹ć‚ÆćƒŖ惗惈ćÆ态my_coin.tsćØ恄恆悂恮恧恙ļ¼

my_coin.ts
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
import assert from "assert";
import fs from "fs";
import path from "path";
import { 
    NODE_URL, 
    FAUCET_URL 
} from "./common";
import { 
    AptosAccount, 
    AptosClient, 
    TxnBuilderTypes, 
    MaybeHexString, 
    HexString, 
    FaucetClient 
} from "aptos";
import { unstable_deprecatedPropType } from "@mui/utils";

/**
 * This example depends on the MoonCoin.move module having already been published to the destination blockchain.
 * Open another terminal and `aptos move compile --package-dir ~/aptos-core/aptos-move/move-examples/moon_coin --save-metadata --named-addresses MoonCoin=<Alice address from above step>`.
 */

/**
 * readline function
 */
const readline = require("readline").createInterface({
    input: process.stdin,
    output: process.stdout,
});

/**
 * CoinClient class
 */
class CoinClient extends AptosClient {

    constructor() {
        super(NODE_URL);
    }

    /**
     * registerCoin function
     */
    async registerCoin(
        coinTypeAddress: HexString, 
        coinReceiver: AptosAccount
    ): Promise<string> {
        // create Tx data
        const rawTxn = await this.generateTransaction(coinReceiver.address(), {
            function: "0x1::managed_coin::register",
            type_arguments: [`${coinTypeAddress.hex()}::moon_coin::MoonCoin`],
            arguments: [],
        });
    
        // sign
        const bcsTxn = await this.signTransaction(coinReceiver, rawTxn);
        // submit
        const pendingTxn = await this.submitTransaction(bcsTxn);

        return pendingTxn.hash;
    }

    /**
     * Mint function
     */
    async mintCoin(
        minter: AptosAccount, 
        receiverAddress: HexString, 
        amount: number | bigint
    ): Promise<string> {
        // create Tx data
        const rawTxn = await this.generateTransaction(minter.address(), {
            function: "0x1::managed_coin::mint",
            type_arguments: [`${minter.address()}::moon_coin::MoonCoin`],
            arguments: [receiverAddress.hex(), amount],
        });

        // sign
        const bcsTxn = await this.signTransaction(minter, rawTxn);
        // submit
        const pendingTxn = await this.submitTransaction(bcsTxn);

        return pendingTxn.hash;
    }

    /** 
     * get balance function
     */
    async getBalance(
        accountAddress: MaybeHexString, 
        coinTypeAddress: HexString
    ): Promise<string | number> {
        try {
            // get balance
            const resource = await this.getAccountResource(
                accountAddress,
                `0x1::coin::CoinStore<${coinTypeAddress.hex()}::moon_coin::MoonCoin>`,
            );

            return parseInt((resource.data as any)["coin"]["value"]);
        } catch (_) {
            return 0;
        }
    }

    /**
     * transfer function
     */
    async transferCoin(
        minter: AptosAccount, 
        receiverAddress: HexString, 
        amount: number | bigint
    ): Promise<string> {
        // create Tx data
        const rawTxn = await this.generateTransaction(minter.address(), {
            function: "0x1::coin::transfer",
            type_arguments: [`${minter.address()}::moon_coin::MoonCoin`],
            arguments: [minter.address().hex(), receiverAddress.hex(), amount],
        });

        // sign
        const bcsTxn = await this.signTransaction(minter, rawTxn);
        // submit
        const pendingTxn = await this.submitTransaction(bcsTxn);

        return pendingTxn.hash;
    }
}

/**
 * main function
 */
async function main() {
    assert(process.argv.length == 3, "Expecting an argument that points to the moon_coin directory.");
    // create clinet instance
    const client = new CoinClient();
    const faucetClient = new FaucetClient(NODE_URL, FAUCET_URL);

    // Create two accounts
    const alice = new AptosAccount();
    const bob = new AptosAccount();

    console.log("\n=== Addresses ===");
    console.log(`Alice: ${alice.address()}`);
    console.log(`Bob: ${bob.address()}`);

    await faucetClient.fundAccount(alice.address(), 100_000_000);
    await faucetClient.fundAccount(bob.address(), 100_000_000);

    await new Promise<void>((resolve) => {
        readline.question("Update the module with Alice's address, compile, and press enter.", () => {
            resolve();
            readline.close();
        });
    });

    // module path (  ../move-example/moon_coin)
    const modulePath = process.argv[2];
    const packageMetadata = fs.readFileSync(path.join(modulePath, "build", "Examples", "package-metadata.bcs"));
    const moduleData = fs.readFileSync(path.join(modulePath, "build", "Examples", "bytecode_modules", "moon_coin.mv"));

    console.log("Publishing MoonCoin package.");

    // publish module by alice
    let txnHash = await client.publishPackage(
        alice, 
        new HexString(packageMetadata.toString("hex")).toUint8Array(), 
        [
            new TxnBuilderTypes.Module(new HexString(moduleData.toString("hex")).toUint8Array()),
        ]
    );
    // check transaction status
    await client.waitForTransaction(txnHash, { checkSuccess: true }); 

    console.log("Bob registers the newly created coin so he can receive it from Alice");
    // call register coin
    txnHash = await client.registerCoin(alice.address(), bob);
    await client.waitForTransaction(txnHash, { checkSuccess: true });
    console.log(`Bob's initial MoonCoin balance: ${await client.getBalance(bob.address(), alice.address())}.`);

    console.log("Alice mints Bob some of the new coin.");
    // mint coin
    txnHash = await client.mintCoin(alice, bob.address(), 100);
    await client.waitForTransaction(txnHash, { checkSuccess: true });
    console.log(`Bob's updated MoonCoin balance: ${await client.getBalance(bob.address(), alice.address())}.`);

    /*
    // transfer coin
    txnHash = await client.transferCoin(bob, alice.address(), 100);
    await client.waitForTransaction(txnHash, { checkSuccess: true });
    console.log(`alice's updated MoonCoin balance: ${await client.getBalance(alice.address(), bob.address())}.`);
    */
}

if (require.main === module) {
    main().then((resp) => console.log(resp));
}

ć‚³ć‚¤ćƒ³ć‚’å—ć‘å–ć‚‹ćƒ”ć‚½ćƒƒćƒ‰ć€mintć™ć‚‹ćƒ”ć‚½ćƒƒćƒ‰ć€ę®‹é«˜ć‚’ē¢ŗčŖć™ć‚‹ćƒ”ć‚½ćƒƒćƒ‰ć€č»¢é€ć™ć‚‹ćƒ”ć‚½ćƒƒćƒ‰ćŒå®Ÿč£…ć•ć‚Œć¦ćŠć‚Šć€ćć‚Œć‚‰ć‚’ä½æć£ć¦main()恮äø­ć§å®Ÿč”Œć—ć¦ć„ć¾ć™ć€‚

å®Ÿč”Œć™ć‚‹å†…å®¹ćØ恗恦ćÆć€ć‚¢ć‚«ć‚¦ćƒ³ćƒˆć®ä½œęˆā‡Ø ć‚¹ćƒžć‚³ćƒ³ć®ć‚³ćƒ³ćƒ‘ć‚¤ćƒ«ćƒ»ćƒ‡ćƒ—ćƒ­ć‚¤ā†’ ć‚³ć‚¤ćƒ³ć®ē™ŗč”Œ ā†’ ę®‹é«˜ē¢ŗčŖćØć„ć†ęµć‚Œć«ćŖć£ć¦ć„ć¾ć™ć€‚
ā€» transfer恮éƒØ分ćÆćƒć‚°ćŒć‚ć£ć¦ć¾ć å‹•ć‹ć›ć¦ć„ć¾ć›ć‚“ć€‚

ć¾ćšęœ€åˆć«ć‚¹ć‚ÆćƒŖćƒ—ćƒˆć‚’å®Ÿč”Œć™ć‚‹ćØę¬”ć®ć‚ˆć†ćŖå†…å®¹ćŒå‡ŗåŠ›ć•ć‚Œć¾ć™ć€‚

=== Addresses ===
Alice: 0x5cf018f581409a22b93036ba13e4c26a9c2be954f0194ad06b303e6413f4dc93
Bob: 0xe336bc5aa5c060538c5a89a2e039509dad7011be7de67ad1cc88d4dcb0233c17
Update the module with Alice's address, compile, and press enter.

ć“ć“ć¾ć§ććŸć‚‰åˆ„ć®ć‚æćƒ¼ćƒŸćƒŠćƒ«ć‚’ē«‹ć”äøŠć’ć¦ć‚¹ćƒžć‚³ćƒ³ć‚’ć‚³ćƒ³ćƒ‘ć‚¤ćƒ«ćƒ»ćƒ‡ćƒ—ćƒ­ć‚¤ć—ć¾ć™ļ¼

ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć®ęŒ‡ē¤ŗć«å¾“ć£ć¦ć€ä»Šå›žć‚³ćƒ³ćƒ‘ć‚¤ćƒ«ć™ć‚‹MoonCoin.movećƒ•ć‚”ć‚¤ćƒ«ćŒę ¼ē“ć•ć‚Œć¦ć„ć‚‹ćƒ•ć‚©ćƒ«ćƒ€ć«ē§»å‹•ć—态Move.tomlćƒ•ć‚”ć‚¤ćƒ«ćŒć‚ć‚‹ćƒ•ć‚©ćƒ«ćƒ€é…äø‹ć§ć€äø‹čØ˜ć‚³ćƒžćƒ³ćƒ‰ć‚’å®Ÿč”Œć—ć¾ć—ć‚‡ć†ļ¼ ć‚¢ćƒ‰ćƒ¬ć‚¹ć«ćÆ态äøŠć§å‡ŗåŠ›ć•ć‚Œć¦ć„ć‚‹Aliceć®ć‚¢ćƒ‰ćƒ¬ć‚¹ć‚’å…„ć‚Œć¦ćæć¦ćć ć•ć„ļ¼ļ¼

aptos move compile --named-addresses MoonCoin=<Alice's Address> --save-metadata

ć†ć¾ćå®Œäŗ†ć™ć‚‹ćØäø‹čØ˜ć®ć‚ˆć†ć«å‡ŗåŠ›ć•ć‚Œć¾ć™ļ¼

 {
   "Result": [
     "5cf018f581409a22b93036ba13e4c26a9c2be954f0194ad06b303e6413f4dc93::moon_coin"
   ]
 }
 āœØ  Done in 2.60s.

ć“ć‚ŒćŒå®Œäŗ†ć—ćŸć‚‰å…ƒć®ć‚æćƒ¼ćƒŸćƒŠćƒ«ć«ęˆ»ć£ć¦etnerć‚’ęŠ¼ć—ć¾ć—ć‚‡ć†ļ¼ļ¼ ćƒˆćƒ¼ć‚Æćƒ³ćŒē™ŗč”Œć•ć‚Œć€ę®‹é«˜ćŒå–å¾—ć§ćć‚‹ć‚ˆć†ć«ćŖ悋ćÆ恚恧恙ļ¼

Publishing MoonCoin package.
Bob registers the newly created coin so he can receive it from Alice
Bob's initial MoonCoin balance: 0.
Alice mints Bob some of the new coin.
Bob's updated MoonCoin balance: 100.
undefined
āœØ  Done in 166.96s.

ä»Šå›žć‚³ćƒ³ćƒ‘ć‚¤ćƒ«ć—ćŸMoonCoinćƒ¢ć‚øćƒ„ćƒ¼ćƒ«ć§ć™ćŒć€aptos_framework恮managed_coin悒ē¶™ę‰æ恗恦恊悊MintćŖć©ć®é–¢ę•°ć®å®Ÿę…‹ćÆć“ć£ć”ć«å®Ÿč£…ć•ć‚Œć¦ć„ć¾ć™ć€‚å®Ÿę…‹ćÆmanaged_coin.move悄coin.movećƒ•ć‚”ć‚¤ćƒ«ć‚’å‚ē…§ć—ć¦ćć ć•ć„ć€‚
ā€» ē§ć‚‚ēµ¶č³›å‹‰å¼·äø­ć§ć™ļ¼ļ¼

恔ćŖćæć«ć‚³ćƒ³ćƒ‘ć‚¤ćƒ«ć—ćŸMoveCoin.moveč‡Ŗ体ćÆaptos_framework ć‚’åˆ©ē”Øć—ć¦ć„ć‚‹ćŠć‹ć’ć§ć‚‚ć®ć™ć”ćć‚·ćƒ³ćƒ—ćƒ«ćŖć‚³ćƒ¼ćƒ‰ć«ćŖć£ć¦ć„ć¾ć™ć€‚

MoonCoin.move
/**
 * MoonCoin
 */
module MoonCoin::moon_coin {
    // Mooncoin
    struct MoonCoin {}

    /**
     * init function
     */
    fun init_module(sender: &signer) {
        aptos_framework::managed_coin::initialize<MoonCoin>(
            sender,
            b"Moon Coin",
            b"MOON",
            6,
            false,
        );
    }
}

Rust悒ę›ø恄恟恓ćØ恌恂悋äŗŗć§ć‚ć‚Œć°ć€č¦‹č¦šćˆć®ć‚ć‚‹ę§‹ęˆć«ćŖć£ć¦ć„ć‚‹ćØę€ć„ć¾ć™ļ¼

恔ćŖćæ恫čØ­å®šćƒ•ć‚”ć‚¤ćƒ«ćÆꬔ恮ćØ恊悊恧恙ļ¼

Move.toml
[package]
name = "Examples"
version = "0.0.0"

[addresses]
MoonCoin = "_"

[dependencies]
AptosFramework = { local = "../../framework/aptos-framework" }

3. ä½œć£ćŸDApp恮ꦂ要

ć•ćć€ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć®ęœ€å¾ŒćÆć€ć‚µćƒ³ćƒ—ćƒ«Dapp恮꧋ēÆ‰ć§ć™ļ¼ļ¼
ćƒćƒ„ćƒ¼ćƒˆćƒŖć‚¢ćƒ«ć«å¾“ć£ć¦ć¾ćšćÆWalletć‚’ćƒ–ćƒ©ć‚¦ć‚¶ć®ę‹”å¼µę©Ÿčƒ½ć«ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć—ć¾ć—ć‚‡ć†ļ¼ MetamaskćØåŒć˜ć‚ˆć†ćŖęµć‚Œć§ć™ļ¼

https://aptos.dev/guides/install-petra-wallet-extension

ćƒ†ćƒ³ćƒ—ćƒ¬ć‚’ä½œć£ć¦å‹•ćć“ćØ悒ē¢ŗčŖć—ć¾ć—ć‚‡ć†ļ¼

npx create-react-app first-dapp --template typescript
cd first-dapp
npm start

ć‚Æćƒ©ć‚¤ć‚¢ćƒ³ćƒˆć‹ć‚‰AptosäøŠć®ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æćƒˆć‚’ę“ä½œć™ć‚‹å “åˆć«ćÆ态window.aptosćØ恄恆ć‚Ŗ惖ć‚ø悧ć‚Æćƒˆć«å«ć¾ć‚Œć¦ć„ć‚‹ęƒ…å ±ć«å¾“ć£ć¦ę“ä½œć—ć¾ć™ć€‚

ę¬”ć«ć€ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æ惈悒惖惭惃ć‚Æćƒć‚§ćƒ¼ćƒ³äøŠć«ćƒ‡ćƒ—ćƒ­ć‚¤ć—ć¾ć—ć‚‡ć†ļ¼
ć¾ćšć€ć‚¢ć‚«ć‚¦ćƒ³ćƒˆć‚’ē”Ÿęˆć—ć¾ć™ć€‚

aptos init

ę¬”ć«ć€ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æćƒˆć‚’ć‚³ćƒ³ćƒ‘ć‚¤ćƒ«ć—ć¾ć™ć€‚ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æćƒˆć®ć‚ć‚‹ćƒ•ć‚©ćƒ«ćƒ€ć¾ć§ć®ćƒ‘ć‚¹ćØć‚¢ćƒ‰ćƒ¬ć‚¹ć®ęƒ…å ±ćÆ個äŗŗ恮ē’°å¢ƒć«åˆć†ć‚ˆć†ć«é©å®œå¤‰ę›“ć—ć¦ć„ć¾ć™ć€‚

aptos move compile --package-dir ./../move-example/hello_blockchain/ --named-addresses hello_blockchain=0xa7bea4f79092c5f315e4ddf40af2637ace9e0438d22e64587bd3bfcb5ea9c647

ć‚³ćƒ³ćƒ‘ć‚¤ćƒ«ēµęžœ

{
  "Result": [
    "a7bea4f79092c5f315e4ddf40af2637ace9e0438d22e64587bd3bfcb5ea9c647::message"
  ]
}

ę¬”ć«ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æćƒˆć®ćƒ†ć‚¹ćƒˆć‚’å®Ÿč”Œć—ć¾ć™ć€‚

aptos move test --package-dir ./../move-example/hello_blockchain/ --named-addresses hello_blockchain=0xa7bea4f79092c5f315e4ddf40af2637ace9e0438d22e64587bd3bfcb5ea9c647

ćƒ†ć‚¹ćƒˆēµęžœ

INCLUDING DEPENDENCY AptosFramework
INCLUDING DEPENDENCY AptosStdlib
INCLUDING DEPENDENCY MoveStdlib
BUILDING Examples
Running Move unit tests
[ PASS    ] 0xa7bea4f79092c5f315e4ddf40af2637ace9e0438d22e64587bd3bfcb5ea9c647::message_tests::sender_can_set_message
[ PASS    ] 0xa7bea4f79092c5f315e4ddf40af2637ace9e0438d22e64587bd3bfcb5ea9c647::message::sender_can_set_message
Test result: OK. Total tests: 2; passed: 2; failed: 0
{
  "Result": "Success"
}

ćć—ć¦ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æćƒˆć‚’ćƒ‡ćƒ—ćƒ­ć‚¤ć—ć¾ć™ć€‚

aptos move publish --package-dir ./../move-example/hello_blockchain/ --named-addresses hello_blockchain=0xa7bea4f79092c5f315e4ddf40af2637ace9e0438d22e64587bd3bfcb5ea9c647

ćƒ‡ćƒ—ćƒ­ć‚¤ćŒå®Œäŗ†ć—ćŸć‚‰ć€npm run startć§ćƒ•ćƒ­ćƒ³ćƒˆć‚Øćƒ³ćƒ‰å“ć®ć‚¢ćƒ—ćƒŖ悒ē«‹ć”äøŠć’ć¾ć—ć‚‡ć†ļ¼
内容ćØ恗恦ćÆč‡³ć£ć¦ć‚·ćƒ³ćƒ—ćƒ«ć§message恮settterćØgetterę©Ÿčƒ½ć‚’č©¦ć™ć“ćØćŒć§ćć¾ć™ļ¼ļ¼

ć‚¹ć‚ÆćƒŖćƒ¼ćƒ³ć‚·ćƒ§ćƒƒćƒˆ 2022-11-19 10.59.44.png

CSSć‚‚ęœ€ä½Žé™ć®ć‚‚ć®ć«ćŖć£ć¦ć„ć‚‹ć®ć§éžåøøć«ć‚·ćƒ³ćƒ—ćƒ«ć§ć™ļ¼ļ¼

4. ć‚½ćƒ¼ć‚¹ć‚³ćƒ¼ćƒ‰ćŖ恩

今回ä½æē”Øć—ćŸć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æ惈ćÆäø‹čØ˜ćƒ•ć‚©ćƒ«ćƒ€ć«å­˜åœØć—ć¾ć™ć€‚

https://github.com/aptos-labs/aptos-core/tree/main/aptos-move/move-examples/hello_blockchain

å®Ÿéš›ć®ć‚½ćƒ¼ć‚¹ć‚³ćƒ¼ćƒ‰ć§ć™ć€‚

module hello_blockchain::message {

    use std::error;
    use std::signer;
    use std::string;
    use aptos_framework::account;
    use aptos_std::event;

    // MessageHolder
    struct MessageHolder has key {
        message: string::String,
        message_change_events: event::EventHandle<MessageChangeEvent>,
    }

    // MessageChangeEvent
    struct MessageChangeEvent has drop, store {
        from_message: string::String,
        to_message: string::String,
    }

    /// There is no message present
    const ENO_MESSAGE: u64 = 0;

    /**
     * get_message function
     */ 
    public fun get_message(addr: address): string::String acquires MessageHolder {
        assert!(exists<MessageHolder>(addr), error::not_found(ENO_MESSAGE));
        *&borrow_global<MessageHolder>(addr).message
    }

    /**
     * set_message function
     */ 
    public entry fun set_message(account: signer, message: string::String)

    acquires MessageHolder {
        // get signer address 
        let account_addr = signer::address_of(&account);
        
        if (!exists<MessageHolder>(account_addr)) {
            move_to(&account, MessageHolder {
                message,
                message_change_events: account::new_event_handle<MessageChangeEvent>(&account),
            })
        } else {
            let old_message_holder = borrow_global_mut<MessageHolder>(account_addr);
            let from_message = *&old_message_holder.message;
            event::emit_event(&mut old_message_holder.message_change_events, MessageChangeEvent {
                from_message,
                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);
        aptos_framework::account::create_account_for_test(addr);
        set_message(account,  string::utf8(b"Hello, Blockchain"));

        assert!(
          get_message(addr) == string::utf8(b"Hello, Blockchain"),
          ENO_MESSAGE
        );
    }
}

ćƒ•ćƒ­ćƒ³ćƒˆå“ć§ćÆethereumć‚Ŗ惖ć‚ø悧ć‚Æ惈悒ä½æć£ć¦ć‚¢ć‚Æć‚»ć‚¹ć™ć‚‹ćØåŒć˜ć‚ˆć†ćŖę„Ÿč¦šć§ē¹‹ćŽć¾ć™ļ¼ļ¼

ć‚¢ćƒ‰ćƒ¬ć‚¹ęƒ…å ±ć‚’å–å¾—ć™ć‚‹ę–¹ę³•

/**
   * init function
   */
  const init = async() => {
    // connect
    await window.aptos.connect();
    const data = await window.aptos.account(); 
    // set address
    setAddress(data.address);
  }

ć‚¹ćƒžćƒ¼ćƒˆć‚³ćƒ³ćƒˆćƒ©ć‚Æ惈äøŠć®ćƒ”ć‚½ćƒƒćƒ‰ć‚’ę“ä½œć™ć‚‹éš›ć®ćƒ”ć‚½ćƒƒćƒ‰

const handleSubmit = async (e: any) => {
    e.preventDefault();
    if (!ref.current) return;
    // get value
    // const message = ref.current.value;

    // tx data
    const transaction = {
      type: "entry_function_payload",
      function: `${address}::message::set_message`,
      arguments: [stringToHex(text)],
      type_arguments: [],
    };

    try {
      setIsSaving(true);
      // call signAndSubmitTransaction function
      await window.aptos.signAndSubmitTransaction(transaction);
      alert('send success')
    } catch(e) {
      alert('send fail...');
    } finally {
      setIsSaving(false);
    }
  }

ć‚½ćƒ¼ć‚¹ć‚³ćƒ¼ćƒ‰ć®ē°”単ćŖå…±ęœ‰ćÆ仄äøŠć§ć™ļ¼
ä»–ć«ć‚‚ć‚¢ćƒ—ćƒŖć‚’ä½œć‚‹ćŸć‚ć«ćÆ态RustćØMoveć§ć‚‚ć£ćØčؓē·“恗ćŖ恄ćØ恄恑ćŖćć†ć§ć™ćƒ»ćƒ»ćƒ»ć€‚

5. ćć®ä»–AptosäøŠć«å±•é–‹ć•ć‚Œć¦ć„悋갗恫ćŖć£ćŸćƒ—ćƒ­ćƒ€ć‚Æ惈

代č”Øēš„ćŖ惗惭惀ć‚Æ惈ćØ恗恦ćÆäø‹čØ˜ć®3ē‚¹ćŒęŒ™ć’ć‚‰ć‚Œć‚‹ćØę€ć„ć¾ć™ļ¼

Bluemove

Ethereum恧čØ€ć†ćØ恓悍悂OpenseaćØčØ€ćˆć°åˆ†ć‹ć‚Šć‚„ć™ć„ć§ć—ć‚‡ć†ć‹ć€‚SuiäøŠć§å±•é–‹ć•ć‚Œć¦ć„ć‚‹NFTćŖ恩悂ćæ悋恓ćØćŒć§ćć¾ć™ļ¼ļ¼

https://sui.bluemove.net/

Aptos Name Service

ENS恮Aptosē‰ˆćØčØ€ćˆć°ć‚¤ćƒ”ćƒ¼ć‚ø恗悄恙恄ćØę€ć„ć¾ć™ļ¼!ć‚¢ćƒ‰ćƒ¬ć‚¹ćØä»»ę„ć®ćƒ‰ćƒ”ć‚¤ćƒ³ć‚’ē“ć„恑悋恓ćØćŒć§ćć¾ć™ļ¼ļ¼

https://www.aptosnames.com/

Aptos passport

恤恄꜀čæ‘ēŸ„ć£ćŸć®ć§ć™ćŒć“ć‚“ćŖ惗惭惀ć‚Æ惈悂å‡ŗć¦ć„ć‚‹ć‚ˆć†ć§ć™ļ¼ ćƒ‰ćƒ”ć‚¤ćƒ³ē™»éŒ²ę©Ÿčƒ½ć®ä»–ć€ćƒˆćƒ¼ć‚Æćƒ³ć®Rewardę©Ÿčƒ½ćŖć©ćŒć‚ć‚Šć¾ć™ļ¼

https://aptpp.com/#/dashboard

6. ęœ€å¾Œć«

ē§˜åÆ†éµć‚’ćƒ­ćƒ¼ćƒ†ćƒ¼ć‚·ćƒ§ćƒ³ć•ć›ć‚‹ę©Ÿčƒ½ć ć£ćŸć‚Šć€Moveč؀čŖžć ć£ćŸć‚Šč‰²ć€…ꊀ蔓ēš„ć«é¢ē™½ć„ćØ恓悍恌恂悋惖惭惃ć‚Æćƒć‚§ćƒ¼ćƒ³ćƒ—ćƒ­ć‚ø悧ć‚Æ惈恧ćÆć‚ć‚Šć¾ć™ćŒć€ćƒ”ć‚¤ćƒ³ćƒćƒƒćƒˆć®ćƒŖćƒŖćƒ¼ć‚¹ć«ć¤ć„ć¦ćÆPRćŒå¼±ć‹ć£ćŸćŸć‚ć‹ć€ć‚æć‚¤ćƒŸćƒ³ć‚°ć‚’ēŸ„悉ćŖć‹ć£ćŸę–¹ć‚‚å¤šć‹ć£ćŸć‚ˆć†ć§ćƒˆćƒ©ćƒ–ćƒ«ćŒć‚ć£ćŸć‚ˆć†ć§ć™ć€‚

äø‹čØ˜ć®čؘäŗ‹ć«ć‚‚ćƒć‚¬ćƒ†ć‚£ćƒ–ćŖå†…å®¹ćŒčØ˜č¼‰ć•ć‚Œć¦ć„ć‚‹ć®ć§å…ˆč”ŒććŒå°‘ć—äøå®‰ć§ć€ćƒ©ć‚¤ćƒćƒ«ć§ć‚ć‚‹Suić«ć©ć®ć‚ˆć†ć«å½±éŸæć—ć¦ćć‚‹ć‹ćÆć‚¦ć‚©ćƒƒćƒć™ć‚‹åæ…č¦ćŒć‚ć‚‹ćØę€ć„ć¾ć—ćŸļ¼

https://www.coindeskjapan.com/163621/

SuićÆć€ćƒ†ć‚¹ćƒˆćƒćƒƒćƒˆćŒćƒ­ćƒ¼ćƒ³ćƒć—ć¦ćŠć‚Šć€å°‚ē”Øć®ć‚¦ć‚©ćƒ¬ćƒƒćƒˆć‚’ć‚¤ćƒ³ć‚¹ćƒˆćƒ¼ćƒ«ć™ć‚Œć°ćƒ†ć‚¹ćƒˆćƒćƒƒćƒˆē”Øć®ćƒˆćƒ¼ć‚Æćƒ³ćŒć‚‚ć‚‰ćˆć‚‹ćØć„ć£ćŸēŠ¶ę…‹ć«ćŖć£ć¦ć„ć¾ć™ć€‚

今回ćÆć“ć“ć¾ć§ćØ恗恟恄ćØę€ć„ć¾ć™ļ¼
Aptos恫恤恄恦ćÆAptosJapanćØ恄恆ēµ„ē¹”ćŒć‚ć‚Šć€å‹‰å¼·ä¼šćŖć©ć‚‚é–‹å‚¬ć—ć¦ćć‚Œć¦ć„ć‚‹ć®ć§ć•ć‚‰ć«ēŸ„ć‚ŠćŸć„ę–¹ćÆconnpass恫ē™»éŒ²ć—ć¦ć‚¤ćƒ™ćƒ³ćƒˆćŖć©ć«å‚åŠ ć™ć‚‹ćØč‰Æ恄恋悂恧恙ļ¼

https://connpass.com/event/265633/

ęœ€å¾Œć¾ć§čŖ­ć‚“ć§ć„ćŸć ćć‚ć‚ŠćŒćØć†ć”ć–ć„ć¾ć—ćŸļ¼ļ¼

å‚č€ƒę–‡ēŒ®

  1. Aptos Developer Docs
  2. ć€ä»®ęƒ³é€šč²Ø怑Aptos(ć‚¢ćƒ—ćƒˆć‚¹)ćØćÆļ¼Ÿä»Šå¾Œć®č¦‹é€šć—ć‚„å°†ę„ę€§ć‚’å¾¹åŗ•č§£čŖ¬ļ¼
  3. Aptos OfficialSite
  4. Martian
  5. č©±é”Œć®L1ćƒć‚§ćƒ¼ćƒ³ć€ŒAptos怍ćØćÆļ¼Ÿę¦‚要悄ē‰¹å¾“ć‚’å¾¹åŗ•č§£čŖ¬ć€480億円čŖæ達ęøˆć€‘
  6. liquidswap
  7. liquidswap App
  8. Aptos Explorer
  9. White Paper
  10. Aptos Faucet
  11. install-aptos-cli
  12. 開ē™ŗå…ƒćŒęœŖē¢ŗčŖć®Macć‚¢ćƒ—ćƒŖć‚±ćƒ¼ć‚·ćƒ§ćƒ³ć‚’é–‹ć
  13. Discussion Forum
  14. aptos-core
  15. The Move Book
  16. Blue Wallet
  17. Aptosļ¼šęœŸå¾…å¤§ć‚†ćˆć«č½čƒ†ć‚‚å¤§ćć‹ć£ćŸćƒ–ćƒ­ćƒƒć‚Æćƒć‚§ćƒ¼ćƒ³ć®čŖ•ē”Ÿ
  18. movemarketcap
  19. č«–ę–‡ēæ»čس: HotStuff: BFT Consensus in the Lens of Blockchain

Discussion

ćƒ­ć‚°ć‚¤ćƒ³ć™ć‚‹ćØć‚³ćƒ”ćƒ³ćƒˆć§ćć¾ć™