Starting a blockchain application

This guide explains how to set up a new project that uses the lisk-sdk to bootstrap a preconfigured blockchain application.



  • Node.js v12

Project setup

Create a new folder for the blockchain application and navigate into it.

mkdir my_blockchain_app
cd my_blockchain_app

Create a package.json file.

npm init --yes

Install the lisk-sdk package.

npm i lisk-sdk

Creating a blockchain application

Create a new file index.js. We want to use this file to store the code that will start the blockchain application by using the Lisk SDK.

In index.js, import the Application, genesisBlockDevnet and configDevnet from the the lisk-sdk package.

const { Application, genesisBlockDevnet, configDevnet } = require('lisk-sdk');

Now use the objects to create a blockchain application:

const app = Application.defaultApplication(genesisBlockDevnet, configDevnet);

This will create a new blockchain application that uses genesisBlockDevnet as the genesis block for the blockchain, and `configDevnet`to configure the application with common default options to run a node in a development network.

The lisk-sdk package contains the sample objects genesisBlockDevnet and configDevnet which enable the user to quickly spin up a development blockchain network. genesisBlockDevnet includes a set of preconfigured genesis delegates, that will immediately start forging on a single node to stabilize the network. configDevnet includes the configuration for the Devnet.

Both objects can be customized before passing them to the Application instance, if desired.

Find out more in the guide about Configuring a blockchain application

Use to start the application:

	.then(() =>'App started...'))
	.catch(error => {
		console.error('Faced error in application', error);

After adding all of the above contents, save the file. Now it is possible to start a blockchain application with a default configuration, that will connect to a local devnet.

Starting the application

Start the application as shown below:

node index.js

To verify the application start, check the log messages in the terminal. If the start was successful, the application will enable forging for all genesis delegates and will start to add new blocks to the blockchain every 10 seconds.

After completing these steps, the default blockchain application of the Lisk SDK will now be running.

It is now be possible to customize your application by registering new modules and plugins, and also adjusting the genesis block and config to suit your specific use case.