Configure a blockchain application

Modify default values

To view the pre-defined default config values, please see the list of configuration options.

Overwrite specific values

Example of how to override the default config values:
const { Application, genesisBlockDevnet} = require('lisk-sdk'); (1)

const app = new Application(genesisBlockDevnet, {
    app: {
        label: 'my-label' (2)
    },
    components: {
        logger: {
            consoleLogLevel: "info" (3)
        }
    }});
1 Require the lisk-sdk package.
2 How to override the default Label of the application.
3 How to set the consoleLogLevel to info.

Use the devnet example config

Click here to view the configDevnet file on Github.
Import the example config from lisk-sdk:
const { Application, genesisBlockDevnet, configDevnet} = require('lisk-sdk'); (1)

const app = new Application(genesisBlockDevnet, configDevnet); (2)
1 Require the lisk-sdk package.
2 Passes the config json configDevnet as config object for the new application instance. This will start the node with a fully functioning Devnet.

Overwrite the devnet example config

The configuration object configDevnet possesses the structure as shown in the list of configuration options. It can be modified accordingly, before passing the config to the Application instance as shown below:

Example how to override the example config object:
const { Application, genesisBlockDevnet, configDevnet} = require('lisk-sdk'); (1)

configDevnet.components.storage.database = 'my-custom-db' (2)
configDevnet.modules.http_api.access.public = true; (3)


const app = new Application(genesisBlockDevnet, configDevnet);
1 Require the lisk-sdk package.
2 Example how to change the db name to my-custom-db.
3 How to make the API accessible from everywhere.

List of configuration options

Check the reference for a complete list of all the available configuration options of the Lisk SDK.

Constants

Inside app.genesisConfig specific constants for the blockchain application are set.

In the alpha version of the Lisk SDK, not all available constants are configurable by the user. In future versions of the Lisk SDK, more constants will become configurable.

To see a full list of all constants and their predefined values, please see the file https://github.com/LiskHQ/lisk-sdk/blob/development/framework/src/application/schema/constants_schema.js.

The Genesis block

The genesis block describes the very first block in the blockchain. It defines the initial state of the blockchain on start of the network.

The genesis block is not forged by a delegate, such as all of the other blocks which come after the genesis block. Instead it is defined by the blockchain application developer, when creating the Application instance of the blockchain app, (see section Modify default values).

Go to Github, to see the full file genesis_block_devnet.json

A genesis block generator to create genesis blocks will be included in the Lisk SDK eventually. For Lisk Alpha SDK, the exposed genesisBlockDevnet can be used as a template, and customized to your requirements.

It’s possible and recommended to customize the genesis block to suit the use case of your blockchain application. The following template shown below describes all available options for the genesis block:

{
    "version": 0, (1)
    "totalAmount": "10000000000000000", (2)
    "totalFee": "0", (3)
    "reward": "0", (4)
    "payloadHash": "198f2b61a8eb95fbeed58b8216780b68f697f26b849acf00c8c93bb9b24f783d", (5)
    "timestamp": 0, (6)
    "numberOfTransactions": 103, (7)
    "payloadLength": 19619, (8)
    "previousBlock": null, (9)
    "generatorPublicKey": "c96dec3595ff6041c3bd28b76b8cf75dce8225173d1bd00241624ee89b50f2a8", (10)
    "transactions": [], (11)
    "height": 1, (12)
    "blockSignature": "c81204bf67474827fd98584e7787084957f42ce8041e713843dd2bb352b73e81143f68bd74b06da8372c43f5e26406c4e7250bbd790396d85dea50d448d62606", (13)
    "id": "6524861224470851795" (14)
}
1 Block version.
2 The total amount of tokens that are transferred in this block.
3 The total amount of fees associated with the block.
4 Reward for forging the block.
5 Hashes of the combined transactional data blocks.
6 Epoch timestamp of when the block was created.
7 Number of transactions processed in the block.
8 Sum of data blocks of all transactions in this block in bytes.
9 Null, because the genesis block has no previous block by definition.
10 Public key of the delegate who forged the block.
11 List of transactions in the genesis block.
12 Current height of the blockchain, always equals 1 for the genesis block.
13 Signature of the block, signed by the delegate.
14 Block id.