Mosaics are fixed assets that represent a set of multiple identical things that do not change.
A mosaic can be what is conventionally called a token, but it can also be a collection of more specialized assets such as reward points, shares of stock, signatures, status flags, votes or other currencies, for example.
Mosaic specialization is achieved through its properties, which are set during mosaic creation.
Once created, each mosaic has a unique identifier represented as a 64-bit unsigned integer. For example, Symbol's native currency, XYM, has the mosaic ID 0x6BED913FA20223F8
.
注釈
If you create a mosaic which should be used by other users, it is very convenient to use a ネームスペース to alias the mosaic ID to a human-readable string. XYM use the symbol.xym
alias, for example.
Determines the number of decimal places to which the mosaic can be divided. A divisibility of 3 means that the smallest fraction a mosaic can be divided into is 0.001.
When decimals are used units are called relative, and when no decimals are used units are called absolute. I.e., with a divisibility of 3, 1 absolute unit corresponds to 0.001 relative units. To convert from relative to absolute units multiply by 10divisibility.
Divisibility must be in the 0 to 6 range (included).
Indicates the amount of mosaics initially in circulation, in absolute units.
This amount can be later changed by a MosaicSupplyChangeTransaction if the Supply mutable flag (see below) of the mosaic is set to true.
The total supply must be in the 0 to 9,000,000,000,000,000 range in absolute units.
Specifies the number of confirmed blocks the mosaic is rented for.
Expiring mosaics are allowed to lie in Symbol's public network up to 3650 days (10 years), being this maximum parameter editable per network.
Non-expiring mosaics can be created by setting this property to 0.
注釈
Mosaic duration cannot be extended after its creation. Before creating one, consider if your use case requires the mosaic to expire or not. Note that this behavior is different for Namespaces.
次の式を使用して、日数をおよそのブロック数に変換します:
By default, blockGenerationTargetTimeInSeconds
is 30 seconds.
true の場合、モザイクの供給量は後から変更できます。モザイク作成者は MosaicSupplyChangeTransaction を使用して、モザイクの総供給量を再定義できます。トランザクションはモザイクの供給量を delta
単位で増減します。
モザイクの供給を減らすにはモザイク作成者アカウントが少なくとも delta
単位を所有している必要があります。供給量可変プロパティが有効になっていても、モザイク作成者が他のアカウントの残高からモザイクを削除できるわけではありません。
If Supply mutable set to false, the mosaic supply cannot be changed. However, if the mosaic creator owns all the mosaic supply, this is modifiable even if the mosaic is defined as not mutable.
An account willing to create a mosaic has to pay a rental fee in addition to the transaction fee. Both fees will be deducted from the account's balance after the announcement of a valid MosaicDefinitionTransaction.
REST ゲートウェイ はモザイクの作成に必要なネットワーク通貨の概算を取得するためのエンドポイントを提供します。
const nodeUrl = 'NODE_URL';
const repositoryHttp = new RepositoryFactoryHttp(nodeUrl);
const networkHttp = repositoryHttp.createNetworkRepository();
networkHttp.getRentalFees().subscribe((rentalFees) => {
console.log(rentalFees.effectiveMosaicRentalFee.compact());
});
const nodeUrl = 'NODE_URL';
const repositoryHttp = new symbol_sdk_1.RepositoryFactoryHttp(nodeUrl);
const networkHttp = repositoryHttp.createNetworkRepository();
networkHttp.getRentalFees().subscribe((rentalFees) => {
console.log(rentalFees.effectiveMosaicRentalFee.compact());
});
By default, creating a mosaic in Symbol's public network has an initial cost of 0.5 symbol.xym
(configurable per network by the mosaicRentalFee
property).
However, the network dynamically adjusts the mosaic rental fee over time.
有効レンタル料金を計算するために、ネットワークは構成で設定されたデフォルト値にネットワークの 動的手数料乗数 を掛けます。