MultiChain allows the creation and tracking of assets at the network level

Assets in MultiChain

MultiChain supports assets natively at the blockchain level. The identifiers and quantities of assets are encoded within each transaction output, alongside the quantity of the blockchain’s native currency (which may be zero if it is not being used). Every MultiChain node tracks and verifies the quantity of assets in transactions, just as it is does with the native currency. Specifically, it checks that the total quantities of all assets in a transaction’s outputs are exactly matched by the total in its inputs. MultiChain allows each transaction output can contain any number of different assets.

In MultiChain, assets can be referred to in any of three ways:

  • An optional asset name, chosen at the time of issuance. If used, the name must be unique on a blockchain, between both assets and streams. Asset names are stored as UTF-8 encoded strings up to 32 bytes in size and are case insensitive.
  • An issuetxid, containing the txid of the transaction in which the asset was issued.
  • An assetref which encodes the block number and byte offset of the issuance transaction, along with the first two bytes of its txid.

Note that apart from MultiChain’s native asset support, it is also possible to run "Bitcoin 2.0"-style asset protocols directly over MultiChain, such as CoinSpark, Colu, Counterparty, EPOBC, Omni Layer and Open Assets (see instructions). However in this case you will not enjoy the advantages of native asset support at the blockchain level. Instead, just as on the bitcoin network, the presence or otherwise of a tokenized asset can only be calculated by examining the full history of all transactions affecting that token since the transaction which created it.

For more background, please see the MultiChain White Paper.

Assets in transaction data

For regular use of MultiChain, you can ignore the technical details below, which describe MultiChain protocol 10007 or later (see deprecated protocols for details of earlier versions). They are only relevant if you want to work with the raw data within MultiChain transactions. Note that you can also use the raw transactions APIs to encode and decode this information.

Asset new issue metadata

A transaction represents an issuance of a new asset if: (a) one of its regular outputs contains a new issuance quantity, and/or (b) the transaction has a special output with new issuance metadata.

New issuance quantity

A new issuance quantity is represented by the following metadata at the end of a regular output script, followed by an OP_DROP (0x75):

Field Size Description
Identifier 4 bytes spkg or 0x73 0x70 0x6b 0x67
Raw quantity 8 bytes Number of raw integer asset units created up to 263-1, as a 64-bit integer in small-endian order.

If multiple outputs of a single transaction contain this type of metadata, a single asset will be created, and each output will receive the quantity of that asset specified within its metadata. The maximum total raw quantity of an asset issued is 263-1.

New issuance metadata

Information can be given about a new asset in a separate output as below, followed by an OP_DROP (0x75) and OP_RETURN (0x6a):

Field Size Description
Identifier 4 bytes spkn or 0x73 0x70 0x6b 0x6e
Type 1 byte 0x01 to indicate a new asset
Repeat the below for each asset property
Property key Variable If the first byte of this key is 0x00, it denotes a property with special meaning to MultiChain, and the second byte gives the property type. Supported special keys are 0x00 0x01 (asset name), 0x00 0x41 (quantity multiple) and 0x00 0x02 (open flag). The asset name uses UTF-8 encoding. The quantity multiple maps raw asset units in transaction OP_DROPs to display units used in API calls, and is encoded as an unsigned 32-bit integer in small-endian order. The open flag is a single 0x00 or 0x01 byte indicating whether the asset permits further issuances. If the first byte of the property key is not 0x00, it contains the null-delimited name of a user-defined custom field, e.g. 0x75 0x72 0x6c 0x00 for url.
Length 1-9 bytes Bitcoin-style variable-length integer indicating the length of the property value in bytes.
Value Variable The property’s value as raw binary.

If new issuance metadata is not present, the asset is not open for reissuance, has a quantity multiple of 1 and no name, but can still be referred to in the APIs using its asset reference or issuance txid.

Per-output asset metadata

The presence of assets in an output (excluding the transaction which created those units) is represented by the following metadata at the end of its script, followed by an OP_DROP (0x75):

Field Size Description
Identifier 4 bytes spkq or 0x73 0x70 0x6b 0x71
Repeat the below for each asset
Asset 16 bytes First 16 bytes of asset’s first issuance txid in reverse order.
Raw quantity 8 bytes Number of raw integer asset units up to 263-1, as a 64-bit integer in small-endian order.
Asset follow-on issuance metadata

A transaction represents a follow-on issuance of an existing asset if (a) one of its regular outputs contains a follow-on issuance quantity, and/or (b) the transaction has a special output with follow-on issuance metadata. If multiple outputs of a single transaction indicate a follow-on issuance, they must all relate to the same asset, and a single follow-on issuance will take place. It is not possible to mix a new asset issuance with an asset reissuance in a single transaction. However it is possible to combine one new asset issuance or reissuance with regular transfers of pre-existing assets.

Follow-on issuance quantity

A follow-on issuance quantity is represented by the following metadata at the end of a regular output script, followed by an OP_DROP (0x75):

Field Size Description
Identifier 4 bytes spko or 0x73 0x70 0x6b 0x6f
Asset 16 bytes First 16 bytes of asset’s first issuance txid in reverse order.
Raw quantity 8 bytes Number of raw integer asset units created up to 263-1, as a 64-bit integer in small-endian order.

The maximum total raw quantity of an asset issued is 263-1.

Follow-on issuance metadata

Information can be given about a follow-on issuance in a separate output in the format below:

asset-identifier OP_DROP issue-details OP_DROP OP_RETURN

The asset-identifier has the following structure:

Field Size Description
Prefix 4 bytes spke or 0x73 0x70 0x6b 0x65
Asset 16 bytes First 16 bytes of asset’s first issuance txid in reverse order.

The issue-details has the following structure:

Field Size Description
Identifier 4 bytes spku or 0x73 0x70 0x6b 0x75
Type 1 byte 0x01 to indicate an asset
Repeat the below for each asset property
Property key Variable If the first byte of this key is 0x00, it denotes a property with special meaning to MultiChain, and the second byte gives the property type. However no special keys are currently supported in this case. If the first byte of the property key is not 0x00, it contains the null-delimited name of a user-defined custom field, e.g. 0x75 0x72 0x6c 0x00 for url.
Length 1-9 bytes Bitcoin-style variable-length integer indicating the length of the property value in bytes.
Value Variable The property’s value as raw binary.