コンテンツにスキップ

モザイクの供給量を変更する⚓︎

中級

供給量が可変 として作成された モザイク は、作成後に総供給量を増減できます。

供給量を変更できるのはモザイクの作成者だけです。 供給量の変更が影響するのは作成者の残高だけです。追加発行したモザイクは追加され、焼却したモザイクは削除されます。 モザイクを保有する他のアカウントの残高は変わりません。

このチュートリアルでは、モザイクの追加発行と焼却によってモザイクの供給量を変更する方法を説明します。

前提条件⚓︎

始める前に、次の準備をしてください。

完全なコード⚓︎

import json
import os
import time
import urllib.request

from symbolchain.CryptoTypes import PrivateKey
from symbolchain.facade.NemFacade import NemFacade
from symbolchain.nc import Amount
from symbolchain.nem.FeeCalculator import calculate_transaction_fee
from symbolchain.nem.Network import NetworkTimestamp

NODE_URL = os.getenv('NODE_URL', 'http://libertalia.nemtest.net:7890')
print(f'Using node {NODE_URL}')


# Helper function to announce a transaction
def announce_transaction(payload, label):
    announce_path = '/transaction/announce'
    print(f'Announcing {label} to {announce_path}')
    request = urllib.request.Request(
        f'{NODE_URL}{announce_path}',
        data=payload.encode(),
        headers={'Content-Type': 'application/json'},
        method='POST'
    )
    with urllib.request.urlopen(request) as announce_response:
        result = json.loads(announce_response.read().decode())
    print(f'  Result: {result["message"]}')
    return result['message']


# Helper function to fetch the current mosaic supply
def fetch_supply(mosaic):
    supply_path = f'/mosaic/supply?mosaicId={mosaic}'
    with urllib.request.urlopen(
        f'{NODE_URL}{supply_path}'
    ) as supply_response:
        supply_info = json.loads(supply_response.read().decode())
    return supply_info['supply']


# Helper function to wait for transaction confirmation
def wait_for_confirmation(tx_hash, label):
    status_path = f'/transaction/get?hash={tx_hash}'
    print(f'Waiting for {label} confirmation from {status_path}')
    is_confirmed = False
    for _ in range(120):
        try:
            with urllib.request.urlopen(
                f'{NODE_URL}{status_path}'
            ) as status_response:
                confirmed = json.loads(status_response.read().decode())
                height = confirmed['meta']['height']
                print(f'{label} confirmed in block {height}')
                is_confirmed = True
                break
        except urllib.error.HTTPError:
            print('  Transaction status: pending')
        time.sleep(1)
    if not is_confirmed:
        print(f'{label} confirmation took too long.')


SIGNER_PRIVATE_KEY = os.getenv(
    'SIGNER_PRIVATE_KEY',
    '0000000000000000000000000000000000000000000000000000000000000000')
signer_key_pair = NemFacade.KeyPair(PrivateKey(SIGNER_PRIVATE_KEY))

facade = NemFacade('testnet')
signer_address = facade.network.public_key_to_address(
    signer_key_pair.public_key)
print(f'Signer address: {signer_address}')

namespace_name = os.getenv('NAMESPACE', 'my_namespace')
mosaic_name = os.getenv('MOSAIC', 'token')
mosaic_id = f'{namespace_name}:{mosaic_name}'
print(f'Mosaic ID: {mosaic_id}')

try:
    # Fetch current network time
    time_path = '/time-sync/network-time'
    print(f'Fetching current network time from {time_path}')
    with urllib.request.urlopen(f'{NODE_URL}{time_path}') as response:
        response_json = json.loads(response.read().decode())
        network_time = response_json['receiveTimeStamp'] // 1000
        print(f'  Network time: {network_time} s since the nemesis block')

    # Derived fields from network time
    timestamp = NetworkTimestamp(network_time)
    deadline = timestamp.add_hours(2)

    # --- INCREASING SUPPLY (MINTING) ---
    print('\n--- Increasing supply (minting) ---')

    print(f'Supply before minting: {fetch_supply(mosaic_id)}')

    increase_tx = facade.transaction_factory.create({
        'type': 'mosaic_supply_change_transaction_v1',
        'signer_public_key': signer_key_pair.public_key,
        'timestamp': timestamp.timestamp,
        'deadline': deadline.timestamp,
        'mosaic_id': {
            'namespace_id': {'name': namespace_name},
            'name': mosaic_name
        },
        'action': 'increase',
        'delta': 500
    })
    increase_tx.fee = Amount(calculate_transaction_fee(increase_tx))

    signature = facade.sign_transaction(signer_key_pair, increase_tx)
    json_payload = facade.transaction_factory.attach_signature(
        increase_tx, signature)
    print('Built supply increase transaction:')
    print(json.dumps(increase_tx.to_json(), indent=2))
    if 'SUCCESS' == announce_transaction(json_payload, 'supply increase'):
        wait_for_confirmation(
            facade.hash_transaction(increase_tx), 'supply increase')
        print(f'Supply after minting: {fetch_supply(mosaic_id)}')
    else:
        print('Supply increase rejected')

    # --- DECREASING SUPPLY (BURNING) ---
    print('\n--- Decreasing supply (burning) ---')

    decrease_tx = facade.transaction_factory.create({
        'type': 'mosaic_supply_change_transaction_v1',
        'signer_public_key': signer_key_pair.public_key,
        'timestamp': timestamp.timestamp,
        'deadline': deadline.timestamp,
        'mosaic_id': {
            'namespace_id': {'name': namespace_name},
            'name': mosaic_name
        },
        'action': 'decrease',
        'delta': 500
    })
    decrease_tx.fee = Amount(calculate_transaction_fee(decrease_tx))

    signature = facade.sign_transaction(signer_key_pair, decrease_tx)
    json_payload = facade.transaction_factory.attach_signature(
        decrease_tx, signature)
    print('Built supply decrease transaction:')
    print(json.dumps(decrease_tx.to_json(), indent=2))
    if 'SUCCESS' == announce_transaction(json_payload, 'supply decrease'):
        wait_for_confirmation(
            facade.hash_transaction(decrease_tx), 'supply decrease')
        print(f'Supply after burning: {fetch_supply(mosaic_id)}')
    else:
        print('Supply decrease rejected')

except urllib.error.URLError as e:
    print(e.reason)

Download source

import { PrivateKey } from 'symbol-sdk';
import {
    NemFacade,
    NetworkTimestamp,
    calculateTransactionFee,
    models
} from 'symbol-sdk/nem';

const NODE_URL = process.env.NODE_URL ||
    'http://libertalia.nemtest.net:7890';
console.log('Using node', NODE_URL);

// Helper function to announce a transaction
async function announceTransaction(payload, label) {
    const announcePath = '/transaction/announce';
    console.log(`Announcing ${label} to ${announcePath}`);
    const announceResponse = await fetch(`${NODE_URL}${announcePath}`, {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: payload
    });
    const result = await announceResponse.json();
    console.log('  Result:', result.message);
    return result.message;
}

// Helper function to fetch the current mosaic supply
async function fetchSupply(mosaic) {
    const supplyPath = `/mosaic/supply?mosaicId=${mosaic}`;
    const supplyResponse = await fetch(`${NODE_URL}${supplyPath}`);
    const supplyInfo = await supplyResponse.json();
    return supplyInfo.supply;
}

// Helper function to wait for transaction confirmation
async function waitForConfirmation(transactionHash, label) {
    const statusPath = `/transaction/get?hash=${transactionHash}`;
    console.log(`Waiting for ${label} confirmation from`, statusPath);
    let isConfirmed = false;
    for (let attempt = 1; 120 >= attempt; ++attempt) {
        const response = await fetch(`${NODE_URL}${statusPath}`);
        if (response.ok) {
            const confirmed = await response.json();
            console.log(`${label} confirmed in block`,
                confirmed.meta.height);
            isConfirmed = true;
            break;
        }
        console.log('  Transaction status: pending');
        await new Promise(resolve => { setTimeout(resolve, 1000); });
    }
    if (!isConfirmed)
        console.warn(`${label} confirmation took too long.`);
}

const SIGNER_PRIVATE_KEY = process.env.SIGNER_PRIVATE_KEY ||
    '0000000000000000000000000000000000000000000000000000000000000000';
const signerKeyPair = new NemFacade.KeyPair(
    new PrivateKey(SIGNER_PRIVATE_KEY));

const facade = new NemFacade('testnet');
const signerAddress = facade.network.publicKeyToAddress(
    signerKeyPair.publicKey);
console.log('Signer address:', signerAddress.toString());

const namespaceName = process.env.NAMESPACE || 'my_namespace';
const mosaicName = process.env.MOSAIC || 'token';
const mosaicId = `${namespaceName}:${mosaicName}`;
console.log('Mosaic ID:', mosaicId);

try {
    // Fetch current network time
    const timePath = '/time-sync/network-time';
    console.log('Fetching current network time from', timePath);
    const timeResponse = await fetch(`${NODE_URL}${timePath}`);
    const timeJSON = await timeResponse.json();
    const networkTime = Math.floor(timeJSON.receiveTimeStamp / 1000);
    console.log('  Network time:', networkTime,
        's since the nemesis block');

    // Derived fields from network time
    const timestamp = new NetworkTimestamp(networkTime);
    const deadline = timestamp.addHours(2);

    // --- INCREASING SUPPLY (MINTING) ---
    console.log('\n--- Increasing supply (minting) ---');

    console.log('Supply before minting:', await fetchSupply(mosaicId));

    const increaseTx = facade.transactionFactory.create({
        type: 'mosaic_supply_change_transaction_v1',
        signerPublicKey: signerKeyPair.publicKey.toString(),
        timestamp: timestamp.timestamp,
        deadline: deadline.timestamp,
        mosaicId: {
            namespaceId: { name: namespaceName },
            name: mosaicName
        },
        action: 'increase',
        delta: 500n
    });
    increaseTx.fee = new models.Amount(
        calculateTransactionFee(increaseTx));

    const increaseSignature = facade.signTransaction(
        signerKeyPair, increaseTx);
    const increasePayload = facade.transactionFactory.static
        .attachSignature(increaseTx, increaseSignature);
    console.log('Built supply increase transaction:');
    console.dir(increaseTx.toJson(), { colors: true });
    const increaseResult = await announceTransaction(
        increasePayload, 'supply increase');
    if ('SUCCESS' === increaseResult) {
        await waitForConfirmation(
            facade.hashTransaction(increaseTx).toString(),
            'supply increase');
        console.log('Supply after minting:', await fetchSupply(mosaicId));
    } else {
        console.log('Supply increase rejected');
    }

    // --- DECREASING SUPPLY (BURNING) ---
    console.log('\n--- Decreasing supply (burning) ---');

    const decreaseTx = facade.transactionFactory.create({
        type: 'mosaic_supply_change_transaction_v1',
        signerPublicKey: signerKeyPair.publicKey.toString(),
        timestamp: timestamp.timestamp,
        deadline: deadline.timestamp,
        mosaicId: {
            namespaceId: { name: namespaceName },
            name: mosaicName
        },
        action: 'decrease',
        delta: 500n
    });
    decreaseTx.fee = new models.Amount(
        calculateTransactionFee(decreaseTx));

    const decreaseSignature = facade.signTransaction(
        signerKeyPair, decreaseTx);
    const decreasePayload = facade.transactionFactory.static
        .attachSignature(decreaseTx, decreaseSignature);
    console.log('Built supply decrease transaction:');
    console.dir(decreaseTx.toJson(), { colors: true });
    const decreaseResult = await announceTransaction(
        decreasePayload, 'supply decrease');
    if ('SUCCESS' === decreaseResult) {
        await waitForConfirmation(
            facade.hashTransaction(decreaseTx).toString(),
            'supply decrease');
        console.log('Supply after burning:', await fetchSupply(mosaicId));
    } else {
        console.log('Supply decrease rejected');
    }

} catch (e) {
    console.error(e.message, '| Cause:', e.cause?.code ?? 'unknown');
}

Download source

コードの説明⚓︎

モザイクの供給量を変更するには、MosaicSupplyChangeTransactionV1 トランザクションを使います。 このチュートリアルでは、モザイクを追加発行するものと焼却するものの 2 つをアナウンスします。

どちらのトランザクションも同じ方法で送信するため、スニペットでは の 2 つのヘルパーを定義します。これらはトランザクションをアナウンスし、ブロックに含まれるまでネットワークをポーリングします。

3 つ目のヘルパー は、/mosaic/supply GET からモザイクの現在の供給量を読み取り、各トランザクションの効果を確認できるようにします。

アカウントとモザイクをセットアップする⚓︎

SIGNER_PRIVATE_KEY = os.getenv(
    'SIGNER_PRIVATE_KEY',
    '0000000000000000000000000000000000000000000000000000000000000000')
signer_key_pair = NemFacade.KeyPair(PrivateKey(SIGNER_PRIVATE_KEY))

facade = NemFacade('testnet')
signer_address = facade.network.public_key_to_address(
    signer_key_pair.public_key)
print(f'Signer address: {signer_address}')

namespace_name = os.getenv('NAMESPACE', 'my_namespace')
mosaic_name = os.getenv('MOSAIC', 'token')
mosaic_id = f'{namespace_name}:{mosaic_name}'
print(f'Mosaic ID: {mosaic_id}')
const SIGNER_PRIVATE_KEY = process.env.SIGNER_PRIVATE_KEY ||
    '0000000000000000000000000000000000000000000000000000000000000000';
const signerKeyPair = new NemFacade.KeyPair(
    new PrivateKey(SIGNER_PRIVATE_KEY));

const facade = new NemFacade('testnet');
const signerAddress = facade.network.publicKeyToAddress(
    signerKeyPair.publicKey);
console.log('Signer address:', signerAddress.toString());

const namespaceName = process.env.NAMESPACE || 'my_namespace';
const mosaicName = process.env.MOSAIC || 'token';
const mosaicId = `${namespaceName}:${mosaicName}`;
console.log('Mosaic ID:', mosaicId);

スニペットは、署名者の秘密鍵を SIGNER_PRIVATE_KEY 環境変数から読み込みます。 設定されていない場合は、テスト用のデフォルトキーを使用します。 署名者はモザイクの作成者でなければなりません。

更新するモザイクは、NAMESPACEMOSAIC 環境変数から読み込みます。デフォルト値は my_namespace:token です。

署名者が作成したモザイクを使用してください

デフォルトでは、コードは SIGNER_PRIVATE_KEY が参照するテストアカウントと、my_namespace:token という名前のモザイクを使用します。

モザイクを作成する チュートリアルから続けている場合は、SIGNER_PRIVATE_KEYNAMESPACEMOSAIC 環境変数を、そこで作成したアカウントとモザイク、または署名者が所有する別のモザイクに合わせて設定してください。

ネットワーク時刻を取得する⚓︎

    # Fetch current network time
    time_path = '/time-sync/network-time'
    print(f'Fetching current network time from {time_path}')
    with urllib.request.urlopen(f'{NODE_URL}{time_path}') as response:
        response_json = json.loads(response.read().decode())
        network_time = response_json['receiveTimeStamp'] // 1000
        print(f'  Network time: {network_time} s since the nemesis block')

    # Derived fields from network time
    timestamp = NetworkTimestamp(network_time)
    deadline = timestamp.add_hours(2)
    // Fetch current network time
    const timePath = '/time-sync/network-time';
    console.log('Fetching current network time from', timePath);
    const timeResponse = await fetch(`${NODE_URL}${timePath}`);
    const timeJSON = await timeResponse.json();
    const networkTime = Math.floor(timeJSON.receiveTimeStamp / 1000);
    console.log('  Network time:', networkTime,
        's since the nemesis block');

    // Derived fields from network time
    const timestamp = new NetworkTimestamp(networkTime);
    const deadline = timestamp.addHours(2);

ネットワーク時刻は /time-sync/network-time GET から取得し、XEM を送信する チュートリアルで説明されている手順に従って、トランザクションの timestampdeadline フィールドを導出します。

供給量を増やす(追加発行)⚓︎

    print(f'Supply before minting: {fetch_supply(mosaic_id)}')

    increase_tx = facade.transaction_factory.create({
        'type': 'mosaic_supply_change_transaction_v1',
        'signer_public_key': signer_key_pair.public_key,
        'timestamp': timestamp.timestamp,
        'deadline': deadline.timestamp,
        'mosaic_id': {
            'namespace_id': {'name': namespace_name},
            'name': mosaic_name
        },
        'action': 'increase',
        'delta': 500
    })
    increase_tx.fee = Amount(calculate_transaction_fee(increase_tx))

    signature = facade.sign_transaction(signer_key_pair, increase_tx)
    json_payload = facade.transaction_factory.attach_signature(
        increase_tx, signature)
    print('Built supply increase transaction:')
    print(json.dumps(increase_tx.to_json(), indent=2))
    if 'SUCCESS' == announce_transaction(json_payload, 'supply increase'):
        wait_for_confirmation(
            facade.hash_transaction(increase_tx), 'supply increase')
        print(f'Supply after minting: {fetch_supply(mosaic_id)}')
    else:
        print('Supply increase rejected')
    console.log('Supply before minting:', await fetchSupply(mosaicId));

    const increaseTx = facade.transactionFactory.create({
        type: 'mosaic_supply_change_transaction_v1',
        signerPublicKey: signerKeyPair.publicKey.toString(),
        timestamp: timestamp.timestamp,
        deadline: deadline.timestamp,
        mosaicId: {
            namespaceId: { name: namespaceName },
            name: mosaicName
        },
        action: 'increase',
        delta: 500n
    });
    increaseTx.fee = new models.Amount(
        calculateTransactionFee(increaseTx));

    const increaseSignature = facade.signTransaction(
        signerKeyPair, increaseTx);
    const increasePayload = facade.transactionFactory.static
        .attachSignature(increaseTx, increaseSignature);
    console.log('Built supply increase transaction:');
    console.dir(increaseTx.toJson(), { colors: true });
    const increaseResult = await announceTransaction(
        increasePayload, 'supply increase');
    if ('SUCCESS' === increaseResult) {
        await waitForConfirmation(
            facade.hashTransaction(increaseTx).toString(),
            'supply increase');
        console.log('Supply after minting:', await fetchSupply(mosaicId));
    } else {
        console.log('Supply increase rejected');
    }

スニペットはまずモザイクの供給量を読み取り、トランザクションが承認されたときに新しく発行されたモザイク数量を確認できるようにします。

追加発行するには、トランザクションに次の値を設定します。

  • : モザイク供給量変更トランザクションでは、タイプ MosaicSupplyChangeTransactionV1 を使用します。

  • : トランザクションに署名して手数料を支払うアカウント。モザイクの作成者でなければなりません。

  • : ネットワーク時刻の手順で計算した値。

  • : 更新するモザイクの 完全修飾名

  • : increase の値は、モザイクを追加発行します。

  • : 追加する 全体単位 の数。 結果として得られる総供給量は 最大供給量 を超えられません。

    上限は原子単位で表されます

    最大供給量は \(9 \cdot 10^{15}\) 原子単位で固定されていますが、全体単位で表されます。

    したがって、 の最大値はモザイクの 可分性 によって異なります。

    \[ \text{max\_whole\_units} = \frac{9 \cdot 10^{15}}{10^{\text{divisibility}}} \]

    このチュートリアルのモザイクの可分性は 2 なので、1 全体単位は \(100\) 原子単位に相当し、供給量は最大 \(9 \cdot 10^{13}\) 全体単位まで増やせます。

その後、XEM を送信する チュートリアルと同じ手順で、トランザクション手数料を計算し、トランザクションに署名して、アナウンスし、承認を待ちます。

モザイク供給量変更トランザクションの固定手数料は 0.15 XEM で、手数料表 に示されています。

承認されたら、供給量をもう一度読み取り、結果の供給量を表示します。 追加発行されたモザイクは作成者のアカウントに加算されます。

供給量を減らす(焼却)⚓︎

    decrease_tx = facade.transaction_factory.create({
        'type': 'mosaic_supply_change_transaction_v1',
        'signer_public_key': signer_key_pair.public_key,
        'timestamp': timestamp.timestamp,
        'deadline': deadline.timestamp,
        'mosaic_id': {
            'namespace_id': {'name': namespace_name},
            'name': mosaic_name
        },
        'action': 'decrease',
        'delta': 500
    })
    decrease_tx.fee = Amount(calculate_transaction_fee(decrease_tx))

    signature = facade.sign_transaction(signer_key_pair, decrease_tx)
    json_payload = facade.transaction_factory.attach_signature(
        decrease_tx, signature)
    print('Built supply decrease transaction:')
    print(json.dumps(decrease_tx.to_json(), indent=2))
    if 'SUCCESS' == announce_transaction(json_payload, 'supply decrease'):
        wait_for_confirmation(
            facade.hash_transaction(decrease_tx), 'supply decrease')
        print(f'Supply after burning: {fetch_supply(mosaic_id)}')
    else:
        print('Supply decrease rejected')
    const decreaseTx = facade.transactionFactory.create({
        type: 'mosaic_supply_change_transaction_v1',
        signerPublicKey: signerKeyPair.publicKey.toString(),
        timestamp: timestamp.timestamp,
        deadline: deadline.timestamp,
        mosaicId: {
            namespaceId: { name: namespaceName },
            name: mosaicName
        },
        action: 'decrease',
        delta: 500n
    });
    decreaseTx.fee = new models.Amount(
        calculateTransactionFee(decreaseTx));

    const decreaseSignature = facade.signTransaction(
        signerKeyPair, decreaseTx);
    const decreasePayload = facade.transactionFactory.static
        .attachSignature(decreaseTx, decreaseSignature);
    console.log('Built supply decrease transaction:');
    console.dir(decreaseTx.toJson(), { colors: true });
    const decreaseResult = await announceTransaction(
        decreasePayload, 'supply decrease');
    if ('SUCCESS' === decreaseResult) {
        await waitForConfirmation(
            facade.hashTransaction(decreaseTx).toString(),
            'supply decrease');
        console.log('Supply after burning:', await fetchSupply(mosaicId));
    } else {
        console.log('Supply decrease rejected');
    }

既存のモザイクを焼却するには、同じトランザクションタイプを使い、decrease に、 を削除する全体単位数に設定します。

焼却するモザイクは作成者のアカウントから取得されるため、作成者がまだ保有している量だけを焼却できます。 他のアカウントにすでに配布されたモザイクは、そのアカウントの残高に残り、作成者自身の残高が をカバーできない場合はトランザクションが失敗します。

承認されたら、供給量をもう一度読み取り、焼却された量を表示します。 このチュートリアルでは供給量を同じ量だけ増やしてから減らすため、最終的な供給量は変更前の値と一致します。

出力⚓︎

以下は、プログラムの実行時の出力例です。

Using node http://libertalia.nemtest.net:7890
Signer address: TBONKWCOWBZYZB2I5JD3LSDBQVBYHB757VN3SKPP
Mosaic ID: my_namespace:token
Fetching current network time from /time-sync/network-time
  Network time: 356366691 s since the nemesis block

--- Increasing supply (minting) ---
Supply before minting: 1000
Built supply increase transaction:
{
  "type": 16386,
  "version": 1,
  "network": 152,
  "timestamp": 356366691,
  "signer_public_key": "462EE976890916E54FA825D26BDD0235F5EB5B6A143C199AB0AE5EE9328E08CE",
  "signature": "47A61EFCFFBF72C84F4BC06D45422F62CF4A1173D2F58820A3A9EE7B1EECD85641E3EAAC6260F3D3B90FBD5EB167921F4FFF5952BF17DF583BED6C9355D4ED08",
  "fee": "150000",
  "deadline": 356373891,
  "mosaic_id": {
    "namespace_id": {
      "name": "6d795f6e616d657370616365"
    },
    "name": "746f6b656e"
  },
  "action": 1,
  "delta": "500"
}
Announcing supply increase to /transaction/announce
  Result: SUCCESS
Waiting for supply increase confirmation from /transaction/get?hash=7D9EAF91CF91F699E2BD50F16F3F21872319570D64BECA35F24742F6C8F03993
  Transaction status: pending
  Transaction status: pending
  Transaction status: pending
supply increase confirmed in block 699605
Supply after minting: 1500

--- Decreasing supply (burning) ---
Built supply decrease transaction:
{
  "type": 16386,
  "version": 1,
  "network": 152,
  "timestamp": 356366691,
  "signer_public_key": "462EE976890916E54FA825D26BDD0235F5EB5B6A143C199AB0AE5EE9328E08CE",
  "signature": "F3383125C6849AD2C4AFC020331B44F489F0A62302DF76AD15363350C2E99507CD04F6AD3F4026157FF42719EBFC6A7B49122AAC5696338DBCFE07E56A25E509",
  "fee": "150000",
  "deadline": 356373891,
  "mosaic_id": {
    "namespace_id": {
      "name": "6d795f6e616d657370616365"
    },
    "name": "746f6b656e"
  },
  "action": 2,
  "delta": "500"
}
Announcing supply decrease to /transaction/announce
  Result: SUCCESS
Waiting for supply decrease confirmation from /transaction/get?hash=2E5F803F30B941671C86481B6646B8AD252D05CBF41F77B438D508F1232E99B5
  Transaction status: pending
  Transaction status: pending
  Transaction status: pending
supply decrease confirmed in block 699606
Supply after burning: 1000

出力の要点は次のとおりです。

  • 発行前の供給量(8 行目): モザイクは 1000 全体単位の供給量で始まります。

  • 供給量の増加(25~26 行目): デルタが 500increase アクションにより、500 全体単位が作成者の残高に追加されます。

  • 発行後の供給量(35 行目): 供給量が 1500 全体単位に増えます。

  • 供給量の減少(54~55 行目): 同じデルタの decrease アクションによって、それらの単位が焼却されます。

  • 焼却後の供給量(64 行目): 増加と減少が相殺されるため、供給量は 1000 に戻ります。

まとめ⚓︎

このチュートリアルでは、次の方法を説明しました。

手順 関連ドキュメント
モザイクの供給量を増やす(追加発行) MosaicSupplyChangeTransactionV1
モザイクの供給量を減らす(焼却) MosaicSupplyChangeTransactionV1
トランザクション手数料を計算する
モザイクの供給量を読み取る /mosaic/supply GET

次のステップ⚓︎

モザイクの供給量を変更できるようになったので、次のことを行えます。