The token module

The token module handles all logic related to balance. Specifically:

  • Validating and subtracting fees for all transactions

  • Checking the minimum remaining balance requirement

  • Giving block rewards to the block generator

  • Transferring account balances

Name Property

Name

token

ID

2

Assets

  • TransferAsset

    • AssetID: 0

Reducers

  • credit()

  • debit()

  • getBalance()

  • getMinRemainingBalance()

Actions

none

Events

none

Account schema

The token module adds a new property balance under the key token to every account in the network as follows:

{
    type: 'object',
    properties: {
        balance: {
            fieldNumber: 1,
            dataType: 'uint64',
        },
    },
    default: {
        balance: BigInt(0),
    },
}

Transactions

The following transaction assets are provided by the token module.

TransferAsset

Allows to send a transfer transaction, which transfers token from one account to another.

Schema
{
    $id: 'lisk/transfer-asset',
    title: 'Transfer transaction asset',
    type: 'object',
    required: ['amount', 'recipientAddress', 'data'],
    properties: {
        amount: {
            dataType: 'uint64',
            fieldNumber: 1,
        },
        recipientAddress: {
            dataType: 'bytes',
            fieldNumber: 2,
            minLength: 20,
            maxLength: 20,
        },
        data: {
            dataType: 'string',
            fieldNumber: 3,
            minLength: 0,
            maxLength: 64,
        },
    },
}