Lisk SDK Configuration

Modify default values

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

Overwrite specific values

Example 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 jump to 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:

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

Below is a complete list of all the available configuration options of the Lisk SDK.

The values below are the default values. They will be used automatically when starting the application without specifying a specific configuration. To change them, override the specific default values with custom values when initializing the application, as described in the Modify default values.

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. Only the configurable constants are listed below. In future versions of the Lisk SDK, more constants will become configurable.

To see a full list of all constants and their predefined values, check out the file framework/src/controller/schema/constants_schema.js.

Structure

{
    app:{
        label: "alpha-sdk-app", (1)
        version: "0.0.0", (2)
        minVersion: "0.0.0", (3)
        protocolVersion: "1.1", (4)
        tempPath: "/tmp/lisk", (5)
        ipc: { enabled: false}, (6)
        genesisConfig: { (7)
            EPOCH_TIME: new Date(Date.UTC(2016, 4, 24, 17, 0, 0, 0)).toISOString(), (8)
            BLOCK_TIME: 10, (9)
            MAX_TRANSACTIONS_PER_BLOCK: 25, (10)
            REWARDS: {
                MILESTONES: [ (11)
                    "500000000", (12)
                    "400000000", (13)
                    "300000000", (14)
                    "200000000", (15)
                    "100000000", (16)
                ],
                OFFSET: 2160, (17)
                DISTANCE: 3000000, (18)
            },
        },
    },
    components: {
        logger: {
            fileLogLevel: "info", (19)
            logFileName: "logs/lisk.log", (20)
            consoleLogLevel: "none" (21)
        },
        storage: {
            database: "lisk_dev", (22)
            host: "localhost", (23)
            port: 5432, (24)
            user: "lisk", (25)
            password: "password", (26)
            min: 10, (27)
            max: 25, (28)
            poolIdleTimeout: 30000, (29)
            reapIntervalMillis: 1000, (30)
            logEvents: ["error"], (31)
            logFileName: "logs/lisk_db.log" (32)
        },
        cache: { (33)
            db: 0, (34)
            enabled: false, (35)
            host: "127.0.0.1", (36)
            port: 6380 (37)
        }
    },
    modules: { (38)
        http_api: { (39)
            httpPort: 4000, (40)
            address: "0.0.0.0", (41)
            enabled: true, (42)
            trustProxy: false, (43)
            access: { (44)
                public: false, (45)
                whiteList: ["127.0.0.1"], (46)
            },
            ssl: { (47)
                enabled: false, (48)
                options: {
                    port: 443, (49)
                    address: "0.0.0.0", (50)
                    key: "./ssl/lisk.key", (51)
                    cert: "./ssl/lisk.crt", (52)
                },
            },
            options: {
                limits: { (53)
                    max: 0, (54)
                    delayMs: 0, (55)
                    delayAfter: 0, (56)
                    windowMs: 60000, (57)
                    headersTimeout: 5000, (58)
                    serverSetTimeout: 20000, (59)
                },
                cors: { (60)
                    origin: "*", (61)
                    methods: ["GET", "POST", "PUT"], (62)
                },
            },
            forging: {
                access: { (63)
                    whiteList: ["127.0.0.1"], (64)
                },
            },
        },
        chain: { (65)
            broadcasts: { (66)
                active: true, (67)
                broadcastInterval: 5000, (68)
                parallelLimit: 20, (69)
                releaseLimit: 25, (70)
                relayLimit: 3, (71)
            },
            transactions: {
                maxTransactionsPerQueue: 1000, (72)
            },
            forging: { (73)
                force: false, (74)
                delegates: [ (75)
                    {
                        encryptedPassphrase: "iterations=1&salt=476d4299531718af8c88156aab0bb7d6&cipherText=663dde611776d87029ec188dc616d96d813ecabcef62ed0ad05ffe30528f5462c8d499db943ba2ded55c3b7c506815d8db1c2d4c35121e1d27e740dc41f6c405ce8ab8e3120b23f546d8b35823a30639&iv=1a83940b72adc57ec060a648&tag=b5b1e6c6e225c428a4473735bc8f1fc9&version=1",
                        publicKey: "9d3058175acab969f41ad9b86f7a2926c74258670fe56b37c429c01fca9f2f0f"
                    }
                ],
                defaultPassword: "elephant tree paris dragon chair galaxy" (76)
            },
            syncing: {
                active: true, (77)
            },
            loading: {
                loadPerIteration: 5000, (78)
                rebuildUpToRound: null, (79)
            },
        },
        network: { (80)
            wsPort: 5000, (81)
            address: "0.0.0.0", (82)
            seedPeers: [ (83)
                {
                    ip: "1.2.3.4", (84)
                    wsPort: 4000 (85)
                }
            ],
            blacklistedPeers: [ (86)
                {ip: "9.8.7.6"} (87)
            ],
            fixedPeers: [ (88)
                {ip: "11.22.33.44"} (89)
            ],
            whitelistedPeers: [ (90)
                {ip: "66.77.88.99"} (91)
            ],
            discoveryInterval: 30000, (92)
            maxInboundConnections: 20, (93)
            maxOutboundConnections: 20, (94)
            peerBanTime: 86400, (95)
            populatorInterval: 10000, (96)
            emitPeerLimit: 25, (97)
            peerDiscoveryResponseLength: 1000, (98)
            maxPeerDiscoveryResponseLength: 1000, (99)
            maxPeerInfoSize: 20480, (100)
            wsMaxPayload: 3048576, (101)
            ackTimeout: 20000, (102)
            connectTimeout: 5000, (103)
            wsEngine: "ws", (104)
        }
    }
}
1 Label of the application.
2 Version of the application, (required).
3 Minimal compatible version, (required).
4 Protocol Version of the application, (required).
5 Root path for storing temporary pid and socket file.
6 If true, it allows modules to communicate over IPCs, (inter-process-channels).
7 Network specific constants.
8 Timestamp indicating the initial network start, (Date.toISOString()).
9 Slot time interval in seconds.
10 Maximum number of transactions allowed per block.
11 Initial 5 LSK, and decreasing until 1 LSK.
12 Initial Reward.
13 Milestone 1.
14 Milestone 2.
15 Milestone 3.
16 Milestone 4.
17 Start rewards at first block of the second round.
18 Distance between each milestone.
19 Minimum loglevel, that should be logged in the log file.
20 Define name and path of the log file. Default: logs/lisk.log
21 Minimum loglevel, that should be logged in the console when starting the node.
22 The name of the database to use.
23 The host address of the database.
24 The port of the database.
25 Name of the database user.
26 Password of the database user.
27 Specifies the minimum amount of database handles.
28 Specifies the maximum amount of database handles.
29 This parameter sets how long to hold connection handles open.
30 Closes & removes clients which have been idle > 1 second.
31 Specify the minimal log level for database logs.
32 Relative path of the database log file.
33 Contains options for the cache component.
34 Set the number of databases for Redis to use. Min: 0 (default), Max: 15.
35 If true, enables cache. Default: false
36 Redis host IP. Default: 127.0.0.1
37 Redis host port. Default: 6380
38 Contains configurations related to modules.
39 Contains options for the API module.
40 HTTP port which the node listens on.
41 Address of the API of the node.
42 Controls the API’s availability. If disabled, no API access is possible.
43 For nodes that sit behind a proxy. If true, the client IP addresses are understood as the left-most entry in the X-Forwarded-* header.
44 Contains the API access options.
45 If true, the API endpoints of the node are available to public.
46 This parameter allows connections to the API by IP. Defaults to only allow local host.
47 Options for enabling SSL with Lisk HTTP API, (alternative to enabling SSL through a Webserver).
48 Enables SSL for HTTP requests.
49 Port to host the Lisk Wallet on, default is 443 but is recommended to use a port above 1024 with IP tables.
50 Interface to listen on for the Lisk Wallet.
51 Required private key to decrypt and verify the SSL Certificate.
52 SSL certificate to use with the Lisk Wallet.
53 Limits for API connections.
54 Maximum of API connections.
55 Minimum delay between API calls in ms.
56 Minimum delay after an API call in ms.
57 Minimum delay between API calls from the same window.
58 Indicating the minimum amount of time an idle connection has to be kept opened, (in seconds).
59 Time to wait for response from server before timing out.
60 Options for cross-origin resource sharing.
61 Defines the domains that the resource can be accessed by in a cross-site manner. Defaults to all domains.
62 Defines the allowed methods for CORS.
63 Defines who can access the forging related API endpoints of the node.
64 This parameter allows connections to the forging API by IP. Defaults to allow only local connections.
65 Contains options for the chain module.
66 Options for broadcasting events to the network.
67 If true, enables broadcasts.
68 Specifies how often the node will broadcast transaction bundles.
69 Specifies how many parallel threads will be used to broadcast transactions.
70 Specifies how many transactions can be included in a single bundle.
71 Specifies how many times a transaction broadcast from the node will be relayed.
72 Sets the maximum size of each transaction queue.
73 Contains forging options for delegates.
74 Forces forging to be on, only used on local development networks.
75 List of delegates, who are allowed to forge on this node. To successfully enable forging for a delegate, the publickey and the encrypted passphrase need to be deposited here as a JSON object.
76 Default password for dummy delegates, only used on local development networks.
77 If true, enables syncing, (fallback for broadcasts).
78 How many blocks to load from a peer or the database during verification.
79 Integer. If this value is defined, the node will start and rebuild up to the defined round, (set to 0 to rebuild until current round). Otherwise, the application continues normal execution.
80 Contains network options for the node.
81 Websocket port of the node.
82 The host IP which the P2P server should listen on for inbound connections. This value is passed directly to the underlying Node.js server. The listen function is documented here: https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback
83 A list of peers to use as seeds when starting the node for the first time. This should be an array of objects in the following form: [{ip: '123.123.123.123', wsPort: 7000}, {ip: '111.111.111.111', wsPort: 8000}]
84 IP or address of the seed peer.
85 Port of the seed peer.
86 A list of peers to blacklist. This should be an array of objects in the followingform: [{ip: '123.123.123.123'}, {ip: '111.111.111.111'}]
87 IP or address of the blacklisted peer.
88 A list of peers to stay constantly connected to. This should be an array of objects in the following form: [{ip: '123.123.123.123'}, {ip: '111.111.111.111'}]
89 IP or address of the blacklisted peer.
90 A list of peers which should never be banned. This should be an array of objects in the following form: [{ip: '123.123.123.123'}, {ip: '111.111.111.111'}]
91 IP or address of the blacklisted peer.
92 Time interval(ms), the time that it takes the nodes to perform peer discovery.
93 The maximum number of inbound peers/connections which the node should have. This should be an integer. Peers which initiate the connection to the node will be added to the node’s inbound list.
94 The maximum number of outbound peers/connections which the node should have. This should be an integer. The node will keep trying to connect to new peers until it reaches maxOutboundConnections.
95 The amount of milliseconds a peer can be banned for; in the case whereby it’s reputation score falls below 0.
96 How frequently, (in milliseconds) it takes to check and re-populate the outbound list, (as peers may drop out over time).
97 When broadcasting a message such as a block or transaction to peers, this number determines how many peers the message will be to sent to at any one time.
98 This number indicates the amount of peer information which the node will send back to a peer; once that peer requests the node’s peer list.
99 This number indicates the maximum amount of peer information which can be received from a single peer, in order to populate our peer directory during the discovery.
100 The maximum size in bytes, (integer) of a single peer information object. A peer information object has a flexible schema, and can contain custom properties/data about the node.
101 The maximum size in bytes, (integer) of any kind of message from a peer. If the peer tries to send a message greater than this value, it will be immediately disconnected.
102 When a node tries to make an RPC against a peer, (and expects a response), this value determines the maximum amount of time, (in milliseconds) that the node will wait to receive a response from the peer. If the peer does not respond in time, then the RPC will fail with an error.
103 When a node tries to connect to a peer, this value determines the maximum amount of time, (in milliseconds) that the node will wait to complete the handshake with the peer. If the peer does not complete the handshake in time then the connection will be closed.
104 This represents the low-level WebSocket engine which the node should use, (this is for advanced users). Possible values are "ws", (default and recommended value),and "uws" (for increased performance, however this is not compatible with all systems).

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 conveniently will be included in the Lisk SDK eventually. For Lisk Alpha SDK, you can use the exposed genesisBlockDevnet as a template, and customize it to your needs.

It’s possible and recommended to customize the genesis block to suit the use case of your blockchain application. The following template 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.