Application commands

This section covers how to work with an Application installation of Lisk Core. Further information can be found by referring to the following commands reference list.

Basic commands

The available basic commands which can be used to manage your Lisk node are displayed here below:

Status

Check the status of the Lisk Core node.

bash lisk.sh status

Start

Start Lisk Core and PostgreSQL.

bash lisk.sh start

Stop

Stop Lisk Core and PostgreSQL.

bash lisk.sh stop

Reload

Reload Lisk Core and pick up changes to config.json.

bash lisk.sh reload

Reset / Coldstart

Initializes the PostgreSQL database and starts Lisk Core.

bash lisk.sh coldstart

Logs

Monitor,(tail) the log file of Lisk.

bash lisk.sh logs

Help

Display all available commands.

bash lisk.sh help

Management tools

Update PATH environment variable

If Lisk Core has been installed with the Application package and you wish to use additional tools such as pm2 and psql, the corresponding PATH variables need to be set by executing the following command:

source env.sh

pm2

PM2 is bundled with the Lisk Core application distribution and will be available after updating the PATH environment. For more information, how to manage your node with PM2, please see the Source code commands page.

psql

The interactive terminal for postgreSQL is bundled with the Lisk Core Application distribution and will be available after updating the PATH environment. For more information regarding the available commands, see the official PostgreSQL documentation.

Utility scripts

There are some command line scripts available that will assist the Lisk user, by performing certain helpful and convenient operations.

All of the scripts required are located under the ./scripts/ directory and can be executed directly by node scripts/<file_name>.

Generate config

The following script shown below will help to generate a unified version of the configuration file for any network:

Usage: node scripts/generate_config.js [options]

Options:

-h, --help               output usage information
-V, --version            output the version number
-c, --config [config]    custom config file
-n, --network [network]  specify the network or use LISK_NETWORK

Argument network is required and can by devnet, testnet, mainnet or any other network folder available under ./config directory.

Update config

This next script is designed to keep track of all changes introduced in Lisk over time in different versions. If you have one config file existing in any specific version, and you wish to make it compatible with other versions of Lisk, then execute this update config script shown below:

Usage: node scripts/update_config.js [options] <input_file> <from_version> [to_version]

Options:

-h, --help               output usage information
-V, --version            output the version number
-n, --network [network]  specify the network or use LISK_NETWORK
-o, --output [output]    output file path

As can be seen from the usage guide above, input_file and from_version are required. If you skip to_version argument, changes in config.json will be applied up to the latest version of Lisk Core. If you do not specify --output path, the final config.json will be printed to stdout. If you do not specify --network argument it will have to be loaded from LISK_NETWORK env variable.

Advanced commands

The advanced commands which can be used to manage your Lisk node, can be seen in the commands reference list below:

Create snapshot

The snapshot script is used to take a backup of the whole blockchain. A snapshot can be used to speed up the synchronization process, instead of having to validate all of the transactions starting from block height 0 to the current block height. Lisk provides official snapshots of the blockchain, which can be seen here: https://snapshots.lisk.io.

In case you wish to create your own snapshot, the following script listed below can be executed which will perform the following:

  1. The creation of a full database dump of the Lisk blockchain.

  2. The validation of the correctness of the blockchain.

  3. Finally, this script will compress and save the results.

This process may take some time depending on the size of the snapshot.
bash lisk_snapshot.sh

Rebuild from snapshot

To replace the blockchain with a new snapshot from the Lisk foundation, execute the following:

bash lisk.sh rebuild

Rebuild from a local snapshot

bash lisk.sh rebuild -f blockchain.db.gz

Rebuild from a remote hosts snapshot

If the file is named blockchain.db.gz, please execute the following command:

bash lisk.sh rebuild -u https://hostname/

To use a remote host snapshot with a different name, execute the following command instead:

bash lisk.sh rebuild -u https://hostname/ -f filename.db.gz

Rebuild from the genesis block

bash lisk.sh rebuild -0

Start node only

This command is used to start individual Node.js processes apart from the database. It is designed to be used with customized config.json files to manage vertically stacked Lisk processes on one node.

bash lisk.sh start_node -c <config.json>

Stop node only

This command is used to stop individual Node.js processes apart from the database. It is designed to be used with customized config.json files to manage vertically stacked Lisk processes on one node.

bash lisk.sh stop_node -c <config.json>

Start database

This command is used to start database instances apart from the Lisk process. It is designed to be used with customized config.json files to target specific instances.

bash lisk.sh start_db -c <config.json>

Stop database only

This command is used to stop all database instances apart from the Lisk process.

bash lisk.sh stop_db