kauri

3 min read - Posted 06 Jun 19

Bluzelle - A decentralized data cache

Bluzelle is a decentralized data cache with servers available in data centers across multiple regions, and auto-replication.

Quick Start

1. Create an NPM Project

With NodeJS and NPM installed creating a project is a straight forward process:

$ mkdir my-bluzelle-project
$ cd my-bluzelle-project
$ npm init
2. Install the bluzelle NPM package

Run npm install bluzelle to get the latest and greatest Bluzelle sdk (see installation for more details).

3. Run a simple program

Create a file, my-program.js, and paste the following starter code. (Click the copy button in the top-right corner of the code window to preserve line endings)

Run the program with node my-program. The expected output is The value of myKey is: myValue. If you run the program multiple times on the same uuid, it will fail with DATABASE_EXISTS . Change the uuid to get a fresh database.

Explore the rest of the API on the API page and read about cryptographic permissioning.

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

const bz = bluzelle({
    entry: 'ws://testnet.bluzelle.com:51010',

    // This UUID identifies your database and may be changed.
    uuid: '5f493479–2447–47g6–1c36-efa5d251a283',

    // This is the private key used for signing off database operations
    private_pem: 'MHQCAQEEIFNmJHEiGpgITlRwao/CDki4OS7BYeI7nyz+CM8NW3xToAcGBSuBBAAKoUQDQgAEndHOcS6bE1P9xjS/U+SM2a1GbQpPuH9sWNWtNYxZr0JcF+sCS2zsD+xlCcbrRXDZtfeDmgD9tHdWhcZKIy8ejQ=='
});

const main = async () => {
    await bz.createDB();
    await bz.create('myKey', 'myValue');
    console.log('The value of myKey is: ', await bz.read('myKey'));
    bz.close();
};

main().catch(e => { 
    bz.close();
    throw e;
});

Troubleshooting

{% hint style="info" %} Sometimes running a "hello world" program does not produce expected results. Common problems are listed below. {% endhint %}

Your NodeJS installation is out of date

Make sure that your NodeJS installation is modern. Running node -v will print your current version. As of the time of writing, the current version is 11.4.0. Some operating systems ship with outdated versions of node. Follow this guide to update your installation.

The testnet is down

While we are consistently improving the system's stability and reliability, sometimes requests cannot be fulfilled due to problems in the distributed network. If you suspect this to be the case, contact us on Gitter.

It is possible to launch your own swarm locally using docker by following the instructions here.

Insecure WebSockets connections over HTTPS

Bluzelle does not currently implement secure WebSockets (WSS). If you try to create a connection in an https page, you may get an error message along the lines of "the operation is insecure." To fix, host your page over HTTP, or change your browser settings. In Firefox navigate to "about:config" in the url bar, scroll down and set the network.websocket.allowInsecureFromHTTPS flag to true.

Created with Sketch.Content is"CC-BY-SA 4.0" licensed
Article On-chain
Article Author

Kauri Team

113

15

1

0 Comments
Related Articles
Sia: Decentralized Cloud Storage

Sia is a decentralized cloud storage platform and data storage marketplace. Sia encrypts and distributes your files across its network, keeping your data private. This article originally appeared in the Sia docs This guide will walk you through uploading a file to Sia using the API. Complete API reference documentation can be found here . Examples are given in Curl and Sia.js If you have questions, reach out to us on the #app-dev channel on Discord . Setup and Configuration If you haven’t alread

Kauri Team

14 May 19

Getting started with Mahuta - A Search engine for the IPFS

Mahuta (formerly known as IPFS-Store) is a convenient library and API to aggregate and consolidate files or documents stored by your application on the IPFS network. It provides a solution to collect, store, index and search data used. Features Indexation: Mahuta stores documents or files on IPFS and index the hash with optional metadata. Discovery: Documents and files indexed can be searched using complex logical queries or fuzzy/full text search) Scalable: Optimised for large scale application