Modifying the mosaic supply

If a mosaic was created with the “Supply Mutable” property, you can make more tokens or reduce the total supply.

Prerequisites

Method #01: Using the Desktop Wallet

  1. Click on the “Mosaic” tab on the left-side menu.
../../_images/modify-mosaic-supply-1.gif

2. Click on the edit icon (represented by a pen) on the right side of the mosaic that you desire to edit. Click “modify supply”. Note:

../../_images/modify-mosaic-supply-2.gif
  1. Select the “Supply Change Direction” to indicate whether you desire to increase or decrease the supply. Then enter the amount by you wish to edit the relative supply. Click “Send”. Verify the information on the next page and enter your wallet password. Click “Confirm”.

In our example, the relative supply is increased by 1,000,000. Since the divisibility property of the mosaic is 0, the change in absolute supply is identical.

Note

If you enter a negative number, it will do the inverse of the indicated “Supply Change Direction”. For example, if you choose to increase by -100, the relative supply will decrease by 100. To decrease the supply, the mosaic owner must have at least the number of units to be removed.

../../_images/modify-mosaic-supply-3.gif
  1. You can verify the change in supply on the “Mosaics” page. If you still see the old supply, try clicking on the update icon on the top right.
../../_images/modify-mosaic-supply-4.gif

Method #02: Using the SDK

1. Define a MosaicSupplyChangeTransaction as in the next code snippet. Then, replace the mosaicId and divisibility with the current mosaic properties. Edit delta with the relative amount of mosaics you want to increase.

// replace with network type
const networkType = NetworkType.TEST_NET;
// replace with private key
const privateKey = '1111111111111111111111111111111111111111111111111111111111111111';
const account = Account.createFromPrivateKey(privateKey, networkType);
// replace with mosaic id
const mosaicIdHex = '7cdf3b117a3c40cc';
const mosaicId = new MosaicId(mosaicIdHex);
// replace with mosaic divisibility
const divisibility = 0;
// replace with mosaic units to increase
const delta = 1000000;

const mosaicSupplyChangeTransaction = MosaicSupplyChangeTransaction.create(
    Deadline.create(),
    mosaicId,
    MosaicSupplyChangeAction.Increase,
    UInt64.fromUint(delta * Math.pow(10, divisibility)),
    networkType,
    UInt64.fromUint(2000000));
// replace with network type
const networkType = symbol_sdk_1.NetworkType.TEST_NET;
// replace with private key
const privateKey = '1111111111111111111111111111111111111111111111111111111111111111';
const account = symbol_sdk_1.Account.createFromPrivateKey(privateKey, networkType);
// replace with mosaic id
const mosaicIdHex = '7cdf3b117a3c40cc';
const mosaicId = new symbol_sdk_1.MosaicId(mosaicIdHex);
// replace with mosaic divisibility
const divisibility = 0;
// replace with mosaic units to increase
const delta = 1000000;
const mosaicSupplyChangeTransaction = symbol_sdk_1.MosaicSupplyChangeTransaction.create(symbol_sdk_1.Deadline.create(), mosaicId, symbol_sdk_1.MosaicSupplyChangeAction.Increase, symbol_sdk_1.UInt64.fromUint(delta * Math.pow(10, divisibility)), networkType, symbol_sdk_1.UInt64.fromUint(2000000));
        // replace with node endpoint
        try (final RepositoryFactory repositoryFactory = new RepositoryFactoryVertxImpl(
                "http://api-01.ap-northeast-1.testnet-0951-v1.symboldev.network:3000")) {
            final NetworkType networkType = repositoryFactory.getNetworkType().toFuture().get();
            // replace with private key
            final String privateKey = "1111111111111111111111111111111111111111111111111111111111111111";
            final Account account = Account
                    .createFromPrivateKey(privateKey, networkType);
            // replace with mosaic id
            final String mosaicIdHex = "7cdf3b117a3c40cc";
            final MosaicId mosaicId = new MosaicId(mosaicIdHex);
            // replace with mosaic divisibility
            final int divisibility = 0;
            // replace with mosaic units to increase
            final int delta = 1000000;

            final MosaicSupplyChangeTransaction mosaicSupplyChangeTransaction = MosaicSupplyChangeTransactionFactory
                    .create(
                            networkType,
                            mosaicId,
                            MosaicSupplyChangeActionType.INCREASE,
                            BigDecimal.valueOf(delta * Math.pow(10, divisibility)).toBigInteger())
                    .maxFee(BigInteger.valueOf(2000000)).build();

Note

Symbol works with absolute amounts. To get an absolute amount, multiply the number of assets you want to increase/decrease by 10divisibility. For example, if the mosaic has divisibility 2, to increase 10 units (relative) you should define 1000 (absolute) instead.

  1. Sign the transaction with the mosaic creator account and announce it to the network.
// replace with meta.networkGenerationHash (nodeUrl + '/node/info')
const networkGenerationHash = '4009619EB7A9F824C5D0EE0E164E0F99CCD7906A475D7768FD60B452204BD0A2';
const signedTransaction = account.sign(mosaicSupplyChangeTransaction, networkGenerationHash);
// replace with node endpoint
const nodeUrl = 'http://api-01.ap-northeast-1.testnet-0951-v1.symboldev.network:3000';
const repositoryFactory = new RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();

transactionHttp
    .announce(signedTransaction)
    .subscribe((x) => console.log(x), (err) => console.error(err));
// replace with meta.networkGenerationHash (nodeUrl + '/node/info')
const networkGenerationHash = '4009619EB7A9F824C5D0EE0E164E0F99CCD7906A475D7768FD60B452204BD0A2';
const signedTransaction = account.sign(mosaicSupplyChangeTransaction, networkGenerationHash);
// replace with node endpoint
const nodeUrl = 'http://api-01.ap-northeast-1.testnet-0951-v1.symboldev.network:3000';
const repositoryFactory = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const transactionHttp = repositoryFactory.createTransactionRepository();
transactionHttp
    .announce(signedTransaction)
    .subscribe((x) => console.log(x), (err) => console.error(err));
            final String generationHash = repositoryFactory.getGenerationHash().toFuture().get();

            final SignedTransaction signedTransaction = account
                    .sign(mosaicSupplyChangeTransaction, generationHash);


            final TransactionRepository transactionRepository = repositoryFactory
                    .createTransactionRepository();
            transactionRepository.announce(signedTransaction).toFuture().get();
        }

Otherwise, you can decrease a mosaic supply by changing MosaicSupplyChangeAction.Increase to MosaicSupplyChangeAction.Decrease. In this second case, the mosaic creator account must own at least delta units to decrease the mosaic supply.

Method #03: Using the CLI

To alter the mosaic supply, open a terminal window and run the following command. Replace 7cdf3b117a3c40cc with the mosaic identifier and 1000000 with the absolute units to be increased.

symbol-cli transaction mosaicsupplychange --action Increase --mosaic-id 7cdf3b117a3c40cc --delta 1000000