Source code setup

The installation from source code is designed for anyone wishing to develop on the Lisk Core codebase. It also comes with an extensive test-suite which is described in the README.md. An installation performed from the source code enables a developer to work on the latest codebase of Lisk Core, which may not have been tagged for a release yet.

Pre-Install

To complete the installation certain prerequisites need to be fulfilled. If you have already performed these, then please proceed to the Installation chapter.

Requirements

Supported Platforms
  • Ubuntu 18.04 (LTS) x86_64

  • Ubuntu 20.04 (LTS) x86_64

  • MacOS x86_64

Node.js
  • 18

Toolchain components

These are used for compiling dependencies.

  • Ubuntu

  • MacOS

sudo apt update
sudo apt install -y libtool automake autoconf curl build-essential python2-minimal

Ensure that both XCode and Homebrew are installed.

brew install autoconf automake libtool python2

Create a new user

To run and manage a Lisk Core node in the future, please create a separate lisk user as described below:

  • Ubuntu

  • MacOS

The lisk user itself does not need any sudo rights to run the Lisk Core.

sudo adduser lisk (1)
1 Create a new user.

It is not necessarily required to set up a lisk user, especially when you are running a local instance for development purposes.

However, if it is required then it is recommended to create the user using the MacOS GUI.

Git

Git is used for cloning and updating Lisk as displayed below:

  • Ubuntu

  • MacOS

sudo apt install git
brew install git

Node.js

Node.js serves as the underlying engine for code execution.

The correct version for NPM v9 is installed automatically with version 18 of Node.js.
  • Option A - Node version manager

  • Option B - Node.js package

It is recommended to use a Node version manager such as NVM. NVM is a bash script that enables the management of multiple active Node.js versions.

  1. Install NVM and follow the official instructions here.

  2. Install the latest LTS version of Node.js using NVM with the following command shown below:

nvm install 18

If NVM or other package managers are not required, it is possible to install the Node package globally as shown in the following commands below:

Ubuntu

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

MacOS

For MacOS, please execute the following command below:

brew install node@18

PM2 (optional)

Install PM2 for managing the start and stop of the application process in the background as shown below:

npm install pm2 -g

Installation

This section details how to install Lisk Core from Source code. When completed, a functioning node on the Lisk network will exist.

git clone https://github.com/LiskHQ/lisk-core.git (1)
cd lisk-core                                      (2)
git checkout v3.1.1                               (3)
npm install --global                              (4)
1 Clone the repository.
2 Navigate into the lisk-core root folder.
3 Check out the latest release tag.
4 Install dependencies.
Please check for the latest release in core releases.

To test that Lisk Core is built and configured correctly, execute the following command below to connect to the network:

lisk-core start --network devnet

# From other terminal
lisk-core node:info

If the process is running correctly, no errors are thrown in the logs.

Post-installation (optional)

Use pm2 to run Lisk Core in the background

It is recommended to use a process manager such as PM2 to run Lisk Core in the background.

Check the guide Process management with pm2 for more information.

Enable IPC in the config

To make use of all the Lisk Core commands Command line interface, enable IPC in the config.

Example: Enable IPC via config.json
"rpc": {
    // enabled creates IPC or WS socket if true
    "enable": true,
    // enabled communication through 'ipc' or 'ws'
    "mode": "ipc",
    // In case of `mode` is set to `ws`, this port used
    "port": 8080,
    // Change to 0.0.0.0 to connect from a remote server
    "host": "127.0.0.1"
},

Alternatively, start Lisk Core with the flag --api-ipc to enable ipc:

Example: Enable IPC via flag
lisk-core start --api-ipc

Log rotation

It is recommended to set up a log rotation, as the log of the Lisk Core files can grow very large over time.

Check the guide Managing logs in the SDK docs for more information.