What is Lisk Elements?

Logo

Lisk Elements is a collection of JavaScript libraries, each tackling a certain topic of blockchain and Lisk-related functionalities.

Package list

Used in frontend

Name NPM Specification

Client

@liskhq/lisk-client

lisk-client

The lisk-client package is specifically designed to be used in the browser and other frontends. It is a collection of the following packages:

lisk-api-client, lisk-codec, lisk-cryptography, lisk-passphrase, lisk-transactions, lisk-utils, lisk-tree, and lisk-validator.

Setup

Dependencies

The following dependencies need to be installed to run the Lisk SDK:

Dependencies Version

Node.js

v18 (latest LTS)

Pre-installation

Lisk Elements requires Node.js as the underlying engine for code execution. The following section describes how to install dependencies such as Node.js and NPM.

Install node

Follow the instructions for your operating system on the Node.js downloads page.

NPM is automatically installed along with Node.js.

Verify installation

Confirm that Node.js and NPM have been successfully installed by running the following commands:

node --version
npm --version

Installation

This section details how to install Lisk Elements for a given distribution.

As all packages in Lisk Elements are independent to each other, they can be installed separately.

Installation via NPM

To install the latest version of Lisk Elements for use as a dependency in a Node.js project, please proceed with the following:

Complete library

Complete Lisk SDK
npm install lisk-sdk
Lisk Elements packages only
npm install lisk-elements
Frontend related packages only
npm install @liskhq/lisk-client
Specific package
npm install @liskhq/<package-name>

<package-name> can be any of the packages in Lisk Elements.

Upon successful completion, NPM will add the Lisk Elements package to your package.json file.

Load via CDN (Content Delivery Network)

Include the script below using the following HTML. The lisk variable will be exposed.

Client library
<script src="https://js.lisk.com/lisk-client-6.0.0.js"></script>
Minified client library:
<script src="https://js.lisk.com/lisk-client-6.0.0.min.js"></script>

To include other packages of Lisk Elements, replace lisk-client with any of the packages of Lisk Elements.

Usage

Node.js

Simply import, (or require) the package and access its functionality according to the relevant namespace.

Example with the client package:

import lisk from '@liskhq/lisk-client';
//or
const lisk = require('@liskhq/lisk-client');

Browser

Load the Lisk Elements script via the CDN. For example, to load the minified version 6.0.0 of Lisk Elements, include the following script which will then expose the lisk variable:

<script src="https://js.lisk.com/lisk-client-6.0.0.min.js"></script>
<script>
    const api = lisk.apiClient.createWSClient('ws://localhost:7887/rpc-ws');
</script>

Update

To update your installation to the latest version of Lisk Elements, simply run the following command:

Complete library
npm update lisk-elements
Specific package
npm update @liskhq/<package-name>