arrow-left

All pages
gitbookPowered by GitBook
1 of 6

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Deploy Your dApps

Bluzelle currently supports multiple languages including JS, Go, Python, Ruby & Java. We are also releasing client libraries for C# and PHP soon.

hashtag
Select a client library to get started👇

JSchevron-rightGochevron-rightPythonchevron-rightRubychevron-rightJavachevron-right

Python

hashtag
Getting started

Ensure you have a recent version of installed.

Grab the package from github:

Use:

hashtag
Examples

Copy .env.sample to .env and configure if needed.

Then run the example:

hashtag
Tests

The tests/ can best be run in a pipenvarrow-up-right environment. To do so, initialize one with:

Install requirements:

Then run the tests:

hashtag
User Acceptance Testing

Please checkout the UAT.mdarrow-up-right document for more details.

hashtag
Licence

MIT

Python 3arrow-up-right

Java

arrow-up-right

blzjava is a Java/Android library that can be used to access the Bluzelle database service.

  • Build and API docsarrow-up-right

  • Java docsarrow-up-right

  • Android

hashtag
Quickstart

Make sure that Java is installed and has a version at least 8 (JDK 1.8).

If Java is not installed, install it.

Download bluzelle.jar from or using terminal.

Create file "Quickstart.java".

Compile.

Run.

JS

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

hashtag
Installation

There are two versions of the bluzelle library. bluzelle-node.js and

pipenv install git+https://github.com/bluzelle/blzpy.git#egg=bluzelle
import bluzelle

client = bluzelle.new_client({
  'address':  '...',
  'mnemonic': '...',
})

gas_info = {
  'max_fee': 4000001,
}

key = 'foo'

client.create(key, 'bar', gas_info)
value = client.read(key)
client.update(key, 'baz', gas_info)
client.delete(key, gas_info)
cp .env.sample .env
DEBUG=false python examples/crud.py
pipenv --python 3
pipenv install
make test
bluzelle-js.js
. By default the NodeJS version will be used.

hashtag
To use the NodeJS version

hashtag
To use the pure JS version

hashtag
To load additional Typescript definitions

  • API docsarrow-up-right

  • Download browser version for <script> tagarrow-up-right

  • Examplesarrow-up-right

hashtag
Quckstart

hashtag
Javascript

hashtag
Typescript

arrow-up-right
arrow-up-right
Examplesarrow-up-right
examplearrow-up-right
Testsarrow-up-right
releasesarrow-up-right

Ruby

hashtag
Getting started

Ensure you have a recent version of Rubyarrow-up-right installed.

  1. Install libsecp256k1 as described .

  2. Add the gem to your Gemfile:

  1. Then install:

  1. Use:

hashtag
Examples

Copy .env.sample to .env and configure if needed.

Then run the example:

hashtag
Tests

Configure env as described in the examples section above.

hashtag
User Acceptance Testing

Please checkout the document for more details.

hashtag
Abort 6 error

If you encounter this error, you either might have to:

  • Add a new entry to if using a newer OpenSSL version

  • Specify where your libsecp256k1.dylib is located with the .

hashtag
Licence

MIT

yarn add bluzelle
or
npm install bluzelle
import { bluzele } from 'bluzelle';
or
const { bluzelle } = require('bluzelle');
import { bluzele } from 'bluzelle/lib/bluzelle-js';
or
const { bluzelle } = require('bluzelle/lib/bluzelle-js');
import {bluzelle, API, BluzelleConfig} from 'bluzelle'
import {bluzelle, API, BluzelleConfig} from 'bluzelle/lib/bluzelle-js'
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"))
})();
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"))
})();
$ java -version
$ javac -version
$ sudo apt-get update
$ sudo apt-get install default-jdk
$ wget https://github.com/bluzelle/blzjava/releases/download/0.0.1/bluzelle.jar
import com.bluzelle.*;

public class Quickstart {

    public static void main(String[] args) {
        Bluzelle bluzelle = Bluzelle.connect(
                "around buzz diagram captain obtain detail salon mango muffin brother morning jeans display attend knife carry green dwarf vendor hungry fan route pumpkin car",
                "http://dev.testnet.public.bluzelle.com:1317",
                null,
                null
        );

        GasInfo gasInfo = new GasInfo(10, 0, 0);
        LeaseInfo leaseInfo = new LeaseInfo(1, 0, 0, 0);

        bluzelle.create("key", "value", gasInfo, leaseInfo);
        System.out.println("created");
        bluzelle.update("key", "new value", gasInfo, leaseInfo);
        System.out.println("updated");
        System.out.println("'key': " + bluzelle.read("key", false));
        bluzelle.delete("key", gasInfo);
        System.out.println("deleted");
    }
}
$ javac -cp ./bluzelle.jar Quickstart.java
$ java -cp .:./bluzelle.jar Quickstart
herearrow-up-right
UAT.mdarrow-up-right
ffi_lib in money-tree/lib/openssl_extensions.rbarrow-up-right
LIBSECP256K1 environment variablearrow-up-right
REPL (interactive console)arrow-up-right
gem 'money-tree', git: 'https://github.com/bluzelle/money-tree'
gem 'bitcoin-secp256k1', git: '[email protected]:cryptape/ruby-bitcoin-secp256k1'
gem 'bluzelle', git: 'https://github.com/bluzelle/blzrb'
bundle install
require "bluzelle"

client = Bluzelle::new_client({
  "address" =>  "...",
  "mnemonic" => "...",
  "uuid" => "bluzelle",
  "endpoint" => "http://dev.testnet.public.bluzelle.com:1317",
})

key = 'foo'
gas_info = {
  'max_fee' => 4000001,
}

client.create key, 'bar', gas_info
value = client.read key
client.update key, 'baz', gas_info
client.delete key, gas_info
cp .env.sample .env
DEBUG=false LIBRESSL_REDIRECT_STUB_ABORT=0 bundle exec ruby examples/crud.rb
bundle exec rspec --format documentation
Build Status
Coverage Status

Go

hashtag
Getting started

Ensure you have a recent version of Goarrow-up-right installed.

Grab the package from github:

Use:

hashtag
Examples

You can test out the examples/ included by following these steps:

  1. Copy .env.sample to .env and configure if needed.

  1. Install dependencies:

  1. Run an example as defined in the Makefile, for example, to read the value of an existing key, foo, run:

This will run the examples/crud/read.go.

hashtag
Integration Tests

hashtag
User Acceptance Testing

Please checkout the document for more details.

hashtag
Licence

MIT

go get github.com/bluzelle/blzgo
package main

import (
  "github.com/bluzelle/blzgo"
  "log"
)

func main() {
  // create client
  options := &bluzelle.Options{
    Mnemonic: "...",
    Endpoint: "http://dev.testnet.public.bluzelle.com:1317",
    UUID: "...",
  }
  client, err := bluzelle.NewClient(options)
  if err != nil {
    log.Fatalf("%s", err)
  }

  key := "foo"
  value := "bar"

  gasInfo := bluzelle.GasInfo{
    MaxFee: 4000001,
  }
  leaseInfo := bluzelle.LeaseInfo{
    Days: 1,
  }

  // create key
  if err := client.Create(key, value, gasInfo, leaseInfo); err != nil {
    log.Fatalf("%s", err)
  } else {
    log.Printf("create key success: true\n")
  }

  // read key
  if v, err := client.Read(key); err != nil {
    log.Fatalf("%s", err)
  } else {
    log.Printf("read key success: %t\n", v == value)
  }

  // update key
  if err := client.Create(key, value, gasInfo, nil); err != nil {
    log.Fatalf("%s", err)
  } else {
    log.Printf("create key success: true\n")
  }

  // delete key
  if err := client.Delete(key, gasInfo); err != nil {
    log.Fatalf("%s", err)
  } else {
    log.Printf("delete key success: true\n")
  }
}
UAT.mdarrow-up-right
cp .env.sample .env
go get ./...
make read key=foo
make test