Token (Asset)#

Token is a digital asset on the blockchain. A token can be used:

  • As a cryptocurrency to pay for goods and services within a project, as well as for crowdfunding;

  • As an object or resource in games etc.

A token can represent a physical or an intangible object. The words “token” and “asset” are used interchangeably in the DecentralChain ecosystem. DecentralCoin is the native token on the DecentralChain blockchain. More about DecentralCoin.

All other tokens are custom tokens issued on behalf of some account. Any account that has enough DecentralCoins to pay the fee can issue its own token. The new token is immediately available:

Token Issue#

You can use Decentral.Exchange online to create an asset.

  • On the main screen make sure you are logged into your account, then click on Create Token.

  • On the next screen specify the token parameters:

    • Name: The name of the created asset can not be shorter than \(4\) characters.

    • Description: A short description where you can include website links that can be particularly useful.

    • Quantity: Define the total supply of your asset. The total supply can either be fixed at the issuance or increased later by making the asset re-issuable.

    • Reissuable: Defines if the asset total supply can be increased later. If set to reissuable, the issuer can increase the supply at any time (If reissuable is selected when the asset is created, it can be changed to not reissuable at a later stage).

    • Decimals: Specify how many decimals your asset will have. For example, if you specify \(8\) decimals, as in Bitcoin, your asset can be divided down to \(0.00000001\).

    • Smart asset: A smart asset is an asset with an attached script that places conditions on every transaction made for the asset in question.

    • Script (for issuing a smart asset).

  • Before creating a new asset, carefully read the creation conditions. If necessary, change the name of the asset according to the conditions, then select the I understand… checkbox and click Generate.

  • On the next screen double-check the entered data and if everything is correct click Send to finish the creation or click Go Back to make corrections..

The transaction fee is \(1\) DecentralCoin for a regular token or \(0.001\) DecentralCoins for a non-fungible token (NFT). Moreover, the token can be issued by the dApp script as a result of the invoke script transaction when the callable function result contains the Issue action. The minimum fee for invoke script transaction is increased by \(1\) DecentralCoin for each non-NFT token issued.

Token ID#

Token ID is a byte array calculated as follows:

  • If the token is issued by issue transaction, the token ID is the same as the transaction ID.

  • If the token is issued by invoke script transaction when the callable function of dApp script performed the Issue action, the token ID is calculated as the BLAKE2b-256 hash of the byte array containing transaction ID and the fields of the Issue structure.

In the Node REST API, the token identifier is encoded in base58. For example:

"assetId": "8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS"

The DecentralCoin token has no identifier. The Node REST API uses null for DecentralCoin.

Token Operations#

  • Transfer to another account

Can be done via a transfer transaction or a mass transfer transaction. A dApp script can transfer the token via a ScriptTransfer script action as a result of an invoke script transaction.

  • Exchange (trade deal)

Three accounts can participate in the exchange: one user creates an order to buy a token, the other creates an order to sell a token. The matcher combines buy and sell orders with suitable parameters and creates an exchange transaction.

  • Burning

Decreases the amount of token on the account and thereby the total amount of the token on the blockchain. Any token owner can burn it, not only the issuer. It is impossible to burn DecentralCoin. Can be done via a burn transaction. A dApp script can burn the token via a Burn script action as a result of the Invoke script transaction.

An invoke script transaction can contain up to two payments to the dApp. Payment amount and token are available to the callable function.

Operations Available Only to Issuer#

The following token operations can only be performed by the account that issued the token:

  • Sponsorship setup

The token issuer can enable sponsorship which allows all users to pay fees in this token (instead of DecentralCoins) for invoke script transactions and transfer transactions. More about sponsorship. Enabling or disabling sponsorship can be done via a sponsor fee transaction. A dApp script can set up sponsorship using a SponsorFee as a result of the invoke script transaction.

  • Reissue

Increases the amount of token on the blockchain. The reissuable field of token determines whether the token can be reissued. Can be done via a reissue transaction. A dApp script can reissue the token via a Reissue script action as a result of the invoke script transaction.

  • Replacing the asset script

Can be done via a set asset script transaction. If the token is not a smart asset, that is, the script was not attached when the token was issued, then it is impossible to attach the script later.

  • Modifying the token name and / or description

Can be done via an update asset info transaction.

Token Types#

Non-Fungible Token#

Non-fungible token or NFT is a special type of a token that is issued with the following parameters:

  • “quantity”: \(1\)

  • “decimals”: \(0\)

  • “reissuable”: false

NFT is a singular entity that has a unique ID. This contrasts with a regular token, two coins of which (for example, two WBTC) cannot be distinguished from each other. NFTs can be used as in-game items, collectibles, certificates, or unique coupons.

Issue of NFT#

NFT can be issued in the same ways as a regular token, see token issue. The minimum fee for an NFT issue is \(0.001\) DecentralCoins, \(1000\) times less than for a regular token.

Smart Asset#

Smart asset is a token that has an asset script assigned to it. By default, tokens on the DecentralChain blockchain are not smart contracts, and any transactions with them are allowed. The script endows a token with functionality that sets the rules for its circulation. Each transaction involving a smart asset is automatically checked against the conditions specified in the script. If the asset’s script allows the transaction, it will be executed; if the script denies the transaction, it is either not put onto the blockchain at all or saved as failed (for details, see the transaction validation article).

Using smart assets, you can implement various financial instruments on the blockchain (options, interval trading, taxation), game mechanics (allowing transactions only between characters with certain properties). Please note:

  • If a token is issued without a script, then the script cannot be added later.

  • The script cannot be removed, so it is impossible to turn a smart asset into a regular one.

  • The asset script can be changed using the set asset script transaction, unless prohibited by the asset script itself (as well as by the dApp or account script assigned to the issuer account).

  • The minimum fee for transaction is increased by \(0.004\) DecentralCoins for each smart asset involved, except for:

Tokens of Other Blockchains#

A token issued on another blockchain cannot be used directly on the DecentralChain blockchain. A new token representing the original one can be issued on the DecentralChain blockchain, and a gateway that pegs the two tokens \(1:1\) can be deployed.

DecentralCoin#

DecentralCoin is the native token of the DecentralChain blockchain. Block generators receive transaction fees and block rewards in DecentralCoins, which encourages generators to maintain and develop the blockchain network infrastructure. The more DecentralCoins the generator holds (by ownership or lease), the greater its chance to add the next block is.

DecentralCoin Parameters#

DecentralCoins are present on the blockchain since inception, there is no issue transaction for it, therefore the DecentralCoin token does not have an ID. The REST API uses null for DecentralCoins. The number of decimal places (decimals) for DecentralCoins is \(8\). The atomic unit called Decentralite is \(\frac{1}{100,000,000}\) DecentralCoins.

Leasing#

The owner of DecentralCoins can lease them via a lease transaction. DecentralCoins received on lease are included in the generating balance. Block generators send back different percentages as rewards to lessors. A lessor can cancel the lease at any time via a lease cancel transaction. More about leasing.

How to Get DecentralCoin#

You can buy DecentralCoins tokens at Decentral.Exchange, or at one of the centralized exchanges. In addition, cryptocurrency gateways can be used to transfer external cryptocurrencies such as Bitcoin, Ethereum etc. from the external blockchain to the DecentralChain blockchain and vice versa. The gateway provides the user with the address on the external blockchain. After receiving a confirmation of transfer to this external address, the gateway transfers the corresponding asset (minus the fee) to the user’s DecentralChain address.

Token Custom Parameters#

Below is an example of JSON representation returned by the GET /assets/details/{assetId} method of Node REST API:

{
  "assetId": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p",
  "issueHeight": 1806810,
  "issueTimestamp": 1574429393962,
  "issuer": "3PC9BfRwJWWiw9AREE2B3eWzCks3CYtg4yo",
  "issuerPublicKey": "BRnVwSVctnV8pge5vRpsJdWnkjWEJspFb6QvrmZvu3Ht",
  "name": "USD-N",
  "description": "Neutrino USD",
  "decimals": 6,
  "reissuable": false,
  "quantity": 999999999471258900,
  "scripted": false,
  "minSponsoredAssetFee": 7420,
  "originTransactionId": "DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p"
}
Token Custom Parameters#

Field

Description

assetId

Token ID: base58 encoded byte array. The token ID is calculated as a hash of the token parameters upon issue. See also the token ID article.

issueHeight

Blockchain height (the sequence number of the block) at which the token is issued.

issueTimestamp

Token issue timestamp: Unix time in milliseconds.

issuer

address of issuer account: base58 encoded byte array.

issuerPublicKey

Public key of issuer account: base58 encoded byte array.

name

Token name. From \(4\) to \(16\) bytes (\(1\) character can take up to \(4\) bytes).

description

Token description. From \(0\) to \(1000\) bytes.

decimals

Number of decimal places, from \(0\) to \(8\).

reissuable

Reissue availability flag.

quantity

Total supply of token on the blockchain specified in atomic units. From \(1\) to \(9,223,372,036,854,775,807\). Total supply can change as a result of reissue or burning, see token operations below.

scripted

There being a script: true for smart asset, false for regular token. More about smart assets.

minSponsoredAssetFee

For sponsored asset only: an amount of asset that is equivalent to \(0.001\) DecentralCoins. More about sponsorship.

originTransactionId

ID of the transaction that issued the token: base58 encoded byte array.

scriptDetails

For smart asset only: asset script and its attributes.

Atomic Unit#

The amount of token is displayed differently in UIs and in the JSON representation used by the Node REST API. In API requests and responses, amount values are integers indicated in atomic units to avoid precision issues in floating-point calculations. An atomic unit is the minimum fraction (“cent”) of a token, it is equal to \(10^{-decimals}\). The amount of token in JSON is the real quantity multiplied by \(10^{decimals}\).

For USD-N in the example above:

  • decimals = \(6\),

  • atomic unit is \(\frac{1}{1,000,000}\) USD-N.

  • “quantity”: \(999999999471258900\) corresponds to \(999,999,999,471.258900\) USD-N in UIs, “minSponsoredAssetFee”: \(7420\) corresponds to \(0.007420\) USD-N.