bluzelle / blzjs Goto Github PK
View Code? Open in Web Editor NEWJavascript client library for Bluzelle Service
License: Apache License 2.0
Javascript client library for Bluzelle Service
License: Apache License 2.0
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
Applies to both query and tx calls.
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
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[]);
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?
Ignore
Since it already can be derived from the mnemonic unless there's a reason to do this validation https://github.com/bluzelle/blzjs/blob/devel/src/swarmClient/cosmos.js#L393-L397?
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.