GithubHelp home page GithubHelp logo

bluzelle / blzjs Goto Github PK

View Code? Open in Web Editor NEW
18.0 18.0 13.0 14.86 MB

Javascript client library for Bluzelle Service

License: Apache License 2.0

TypeScript 96.51% HTML 1.18% CSS 0.64% JavaScript 1.68%

blzjs's People

Contributors

devonsangha avatar ebruck avatar jyclam avatar kelonye avatar matteyu avatar montythibault avatar njmurarka avatar paularchard avatar pavelbains avatar scottburch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

blzjs's Issues

keyValues() doesnt return all entries

I have a DB (UUID: 26542be2-b69f-4177-96a8-f97818a3b37f) which contains BlizelleHQ tweets.
When I invoke keyValues() function it returns 110 KV pairs, however db has 510 ones.

It seems that the problem with amount of information which could be transferred from blockchain in one transaction

Can't save value with quotes

Hello team!

Problem
Using a value with quotes in the create or update methods returns "Invalid chain id"
This is happening with any type of quotes, escaped or not

Code to reproduce
This is the smallest code to reproduce, using crud.js in the samples directory.

const { bluzelle } = require('../src/main.js');

const main = async () => {
  var bz = await bluzelle({
      address: 'bluzelle1upsfjftremwgxz3gfy0wf3xgvwpymqx754ssu9',
      mnemonic: 'around buzz diagram captain obtain detail salon mango muffin brother morning jeans display attend knife carry green dwarf vendor hungry fan route pumpkin car',
      endpoint: "http://testnet.public.bluzelle.com:1317",
      chain_id: "bluzelle"
  });

  // Any of these doesn't work
  var res = await bz.update('test', '"', {'max_gas': '', 'max_fee': '', 'gas_price': '20'});
  //var res = await bz.update('test', '\"', {'max_gas': '', 'max_fee': '', 'gas_price': '20'});
  //var res = await bz.update('test', '{"test": "test"}', {'max_gas': '', 'max_fee': '', 'gas_price': '20'});
  console.log(typeof res != 'undefined' ? res : "success");
}

Any other info
I've already troubleshot a bit this with @njmurarka via email

Batch reading from DB

As I mentioned in #34, there is a problem in reading all key-value pairs from DB.

As possible solution it could stream reading (like ReadableStream) or getting values by sending a list of keys like that:

const values = bluzelle.read(keys: string[]);

Smaller pure js library?

Is it possible to have a smaller sized library for the pure js implementation? 871kb is a bit too big. How can I reduce the size of the library?

DB Batch transaction suggestion

Working on hackahon project I profiled your testnet library in case of performance.
It takes 3500-5500 ms for writing operation for the moment. From my opinion it depends on blockchain latency.

My suggestion is to add the following functions:

const tx = bluzelle.startTransaction() // returns pointer to batch transaction
tx.set("key", "value") // add an operation to batch transaction
const gasLeft = tx.gasLeft() // provides estimation of gas left for current batch transaction
const neededGas = tx.estimate.set("key2", "value2"); // provides estimated qty of gas for this operation

// The following code adds another operation if it's enough gas for that
if (gasLeft > neededGas) {
  tx.set("key2", "value2");
}
tx.submit(); // submit transaction to DB

With this functionality, as a developer I would be able make very efficient request programmatically and improve the performance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.