• Public
  • Public/Protected
  • All

burstjs - The Burstcoin Reference Library


The BurstCoin Type/Javascript Reference Library

npm lerna Codacy Badge Build Status Known Vulnerabilities codecov jsDelivr

@burstjs is a modern library written in Typescript providing common functionalities for browsers and nodejs to interact with the BurstCoin blockchain, an advanced community-driven blockchain technology.


The library is separated in the following packages

  • @burstjs/core The main package providing an extense API for blockchain interaction
  • @burstjs/contracts A package providing BURST relevant functions for smart contracts
  • @burstjs/crypto A package providing BURST relevant crypto functions
  • @burstjs/util A package providing useful functions, e.g. common conversion functions
  • @burstjs/http A package providing a simplified Http layer, with consistent response types, and exception handling


@burstjs aims modern browsers and nodejs > v10, but can also be used as bundled JavaScript using <script>

Using with NodeJS and/or modern web frameworks

Install using npm:

npm install @burstjs/core
npm install @burstjs/contracts (optional)
npm install @burstjs/crypto (optional)
npm install @burstjs/util (optional)
npm install @burstjs/http (optional)

or using yarn:

yarn add @burstjs/core
yarn add @burstjs/contracts (optional)
yarn add @burstjs/crypto (optional)
yarn add @burstjs/util (optional)
yarn add @burstjs/http (optional)

Usually, you won't need to install other packages than @burstjs/core, which uses the other packages.

Using in classic <script>

Each package is available as bundled standalone library using IIFE. This way burstJS can be used also within <script>-Tags. This might be useful for Wordpress and/or other PHP applications.

Just import one of the packages using the HTML <script> tag.

<script src='https://cdn.jsdelivr.net/npm/@burstjs/core/dist/burstjs.min.js'></script>

<script src='https://cdn.jsdelivr.net/npm/@burstjs/contracts/dist/burstjs.contracts.min.js'></script>

<script src='https://cdn.jsdelivr.net/npm/@burstjs/crypto/dist/burstjs.crypto.min.js'></script>

<script src='https://cdn.jsdelivr.net/npm/@burstjs/http/dist/burstjs.http.min.js'></script>

<script src='https://cdn.jsdelivr.net/npm/@burstjs/util/dist/burstjs.util.min.js'></script>

Due to the way a package is imported following global variables are provided

Package Variable
core b$
crypto b$contracts
crypto b$crypto
http b$http
util b$util


// using core
const api = b$.composeApi({
  nodeHost: "http://at-testnet.burst-alliance.org:6876",
  apiRootUrl: "/burst"

// using contracts
const dataView = new b$contracts.ContractDataView(contract)
// using crypto
// using util
const value = b$util.convertNumberToNQTString(1000)
// using http
const client = new b$http.HttpImpl('https://jsonplaceholder.typicode.com/');


The following example shows how to interact with the blockchain, i.e. getting the balance of a specific account

ES6/NodeJS style

In a separate file, preferribly index.js or main.js write your entry point like this:

import {composeApi, ApiSettings} from '@burstjs/core'
import {convertNQTStringToNumber} from '@burstjs/util'

const apiSettings = new ApiSettings('http://at-testnet.burst-alliance.org:6876', 'burst');
const api = composeApi(apiSettings);

// this self-executing file makes turns this file into a starting point of your app

(async () => {
    const {balanceNQT} = await api.account.getAccountBalance('13036514135565182944')
    console.log(`Account Balance: ${convertNQTStringToNumber(balanceNQT)} BURST`)  
  catch(e){ // e is of type HttpError (as part of @burstjs/http)
    console.error(`Whooops, something went wrong: ${e.message}`)      

<script> style

const apiSettings = new b$.ApiSettings('http://at-testnet.burst-alliance.org:6876', 'burst');
const api = b$.composeApi(apiSettings);

    .then( balance => {
        console.log(`Account Balance: ${b$util.convertNQTStringToNumber(balance.balanceNQT)} BURST`)  

    .catch(e => { // e is of type HttpError (as part of @burstjs/http)
        console.error(`Whooops, something went wrong: ${e.message}`)