What is Klayr Elements?


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

Package list

Used in frontend

Name NPM Specification




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

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



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

Dependencies Version


v18 (latest LTS)


Klayr 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


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

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

Installation via NPM

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

Complete library

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

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

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

Load via CDN (Content Delivery Network)

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

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

To include other packages of Klayr Elements, replace @klayr/client with any of the packages of Klayr Elements.



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

Example with the client package:

import klayr from '@klayr/client';
const klayr = require('@klayr/client');


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

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


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

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