LogoLogo
  • Bluzelle GameFi Overview
  • Problem
  • The Solution
  • The BLZ Token
  • Careers
  • BLZ Staking
    • Bluzelle Staking Economics
    • Gas & Tax
    • Validator
      • Technical Requirements
      • Building a Public Validator + Sentry
      • Useful Commands
    • Delegator
  • GAMMA 4
    • Overview
    • The Story
    • Game Lite Paper
  • Bluzelle R2 - Decentralized Storage
    • Features
    • Architecture
    • Bluzelle Versus Filecoin
    • Deploy Your dApps
      • JS
      • Python
      • Go
      • Ruby
      • Java
    • CRUD Queries
  • Guide & Resources
    • Bridging between ERC20-BLZ and L1-BLZ
    • Create a Bluzelle Wallet
    • OS Setup for Curium
    • Development Environment Setup
    • Build the Curium Project
  • Useful Links
    • Bluzelle Website
    • Discord Developer and Validator Community
    • Twitter
Powered by GitBook
On this page
  • Installation
  • Quckstart
  • Javascript
  • Typescript
Export as PDF
  1. Bluzelle R2 - Decentralized Storage
  2. Deploy Your dApps

JS

PreviousDeploy Your dAppsNextPython

Last updated 4 years ago

blzjs is a Typescript/JavaScript library that can be used to access the Bluzelle database service.

Installation

yarn add bluzelle
or
npm install bluzelle

There are two versions of the bluzelle library. bluzelle-node.js and bluzelle-js.js. By default the NodeJS version will be used.

To use the NodeJS version

import { bluzele } from 'bluzelle';
or
const { bluzelle } = require('bluzelle');

To use the pure JS version

import { bluzele } from 'bluzelle/lib/bluzelle-js';
or
const { bluzelle } = require('bluzelle/lib/bluzelle-js');

To load additional Typescript definitions

import {bluzelle, API, BluzelleConfig} from 'bluzelle'
import {bluzelle, API, BluzelleConfig} from 'bluzelle/lib/bluzelle-js'

Quckstart

Javascript

const {bluzelle} = require('bluzelle');

const config = {
    mnemonic: "apology antique such ancient spend narrow twin banner coral book iron summer west extend toddler walnut left genius exchange globe satisfy shield case rose",
    endpoint: "http://testnet.public.bluzelle.com:1317",
    chain_id: 'bluzelle',
    uuid: Date.now().toString()
};

(async () => {
    const bz = await bluzelle(config);

    await bz.create("somekey", "somevalue", {'gas_price': 10})
    console.log(await bz.read("somekey"))
})();

Typescript

import {bluzelle, API, BluzelleConfig} from 'bluzelle';

const config: BluzelleConfig = {
    mnemonic: "apology antique such ancient spend narrow twin banner coral book iron summer west extend toddler walnut left genius exchange globe satisfy shield case rose",
    endpoint: "http://testnet.public.bluzelle.com:1317",
    chain_id: 'bluzelle',
    uuid: Date.now().toString()
};

(async () => {
    const bz: API = await bluzelle(config);

    await bz.create("somekey", "somevalue", {'gas_price': 10})
    console.log(await bz.read("somekey"))
})();

API docs
Download browser version for <script> tag
Examples
REPL (interactive console)
Build Status
Coverage Status