Open haydnv opened 1 year ago
Hi @ansarizafar this is coming up as a top priority soon (next 1-2 months). The current thinking is that the JavaScript client will use eager execution instead of deferred execution but otherwise will work like the Python client and will be packaged and distributed with npm. Do you have any specific needs you'd like to see addressed?
I am trying to understand what is TinyChain? Is it a database, a blockchain or an application platform? Is three any video introduction/tutorial on youtube? Discord link is also not working.
It's all of the above! TinyChain's Table
and Tensor
data structures support database and ML applications and you can implement a Service
to provide a REST API backed by these data structures, optionally wrapped by a Block
chain to provide a tamper-proof record of how your application's state changes over time (useful e.g. in finance or supply chain management where application state is shared between multiple counterparties).
You can see example implementations in the tests: https://github.com/haydnv/tinychain/tree/main/tests/tctest/services
I did make some tutorial videos here but are there other topics you would like to see covered?
Hi @Naveednyc, thank you again for volunteering to help out!
The JavaScript client should be installable a a node.js package and should provide the same general functionality as the Python client with the one major architectural difference that it should resolve references immediately rather than constructing a deferred-execution graph. This means that all Scalar
types should execute locally (e.g. Number(1) + Number(2)
should return Number(3)
without making a network request). In case it's impractical to implement a method locally, it's OK to raise an exception.
Probably the easiest order to work in is:
URI
: implement a JS equivalent of the Python client's URI
classMap
and Tuple
: implement classes based on object
and array
which support the TinyChain Map
and Tuple
function signaturesValue
implement Value
and its subclasses (e.g. Number
, String
can use handlebars to implement String.render
, Bytes
can be a UInt8Array
, etc)OpRef
: resolve a reference to an Op
by following the TinyChain protocol.Ref
: includes OpRef
as well as control flow operators like If
, While
, etc.Op
: should be a callable JavaScript function--consult the Rust implementation here: https://github.com/haydnv/tinychain/blob/main/host/scalar/src/op/executor.rsScalar
: the base class for all of these typesNote that implementing OpRef
will require parsing the response, which is not implemented in the Python client.
After implementing the Scalar
types it should be straightforward to stub out the remaining State
types so that they have callable methods (e.g. Collection(URI("/myservice/mycollection")).get("key")
should execute a GET request and return either None
or a Tuple
of values).
Ideally there should be some automated tests for core functionality.
Let me know if any of this is at all unclear and of course please reach out if you need help getting started or understanding implementation details, goals, etc.
Is there any progress on Javascript client?