-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cross-language support #2
Comments
Hello @KrishnaPG, thanks for the comments, I believe we are aligned in the same direction. @rodoufu do you know CBOR?
Regarding this point, we are using gRPC... so, it works over HTTP, although "not pure". Is that the point? |
Thank you @igormcoelho The gRPC should be good enough to interact from other languages. But it was not directly apparent from the ReadMe how to use that gRPC API. It would be great if you could kindly add an example or two in the ReadMe, or some docs, showcasing how to use the libBFT's gRPC (preferably from JS or some simple language), so that it becomes easy for us to start using/testing it. For example, I would love to invoke the gRPC API from browser (through JavaScript) and start using this library for sharing some state data across multiple NodeJS and browser instances. (If you can run from a browser, then you are already mobile-ready). JS is the low-hanging fruit. If it can be used from JS, then using it from other languages, such as Go, Rust is pretty straightforward. For P2P, ZeroMQ is good, but it has some serious restriction of native sockets, which means browser-based clients are out of question. There were some efforts to use ZMQ with WebSockets earlier, but not much progress there. The best option out there currently is libP2P
Monitoring is the easy part. You might be already aware of below, which are the best options out there currently:
The rather difficult part, however, is making the distributed state management easy for programmers. When you say "WorldModel" I believe you are referring to the app-specific state data that is being shared by nodes. My request would be to make such "app-state" data API robust with cross-language compatibility so that applications from any language can seamlessly use the same data-model across diverse machines / networks (including browser-instances).
A couple of examples that illustrate how to achieve such above tasks easily from simple languages, such as JS could immensely attract many developers to start using this project rapidly. The Tendermint ABCI is a good model to study for inspiration. It is a consensus engine, and the ABCI spec is good. But its implementation still needs much more refinement. For example, multi-tenancy etc. Here are some of my thoughts tendermint/tendermint#4058
Since libBFT is still in the developments, there is great scope to make it easy for programmers to adopt and get started easily. |
I haven't used CBOR yet, but I started to look about it once I read this issue from @KrishnaPG, we are using Protobuf because it's the default for gRPC and it's also well known and has good performance. |
That's a good suggestion @KrishnaPG, I was going to cite libp2p as well.
|
Thank you @rodoufu
The main distinction between them is the schema-lockin. Protobuf is schema-driven:
A decade back when everyone was building applications inside an organization, documeting and sharing their interfaces / schemas, protobuf was a super-hit, because you can consume RPC created in one language from another. These were the days XML was a super-hero (and C/C++ guys usually hated XML), so protobuf became a natural alternative. Fast-forward few years, where web and mobile became standard, and Javascript emerged as one of the main languages (thanks to the Node.Js and full-stack), which completely destroyed the XML reign, with its super simple JSON. (XML namespaces were a nightmare)
CBOR is just a binary packing of JSON. One can think of Protobuf vs CBOR as
If one looks at the extensibility of CBOR, for example the tags here, one can discover the provision for IPLD, IOT and other emerging technology tags, which are "semantic markups" of data that are very important for Blockchain frameworks such as this. For example, consider a simple practical scenaro:
in the above scenario, Now, one may ask, without knowing the other party's schema how can CBOR be beneficial either? Since at the end of the day, you have to know the fields in the object to make anything useful out of it. There are two aspects to it:
|
BTW, on the downside, using CBOR requires you to have your own RPC network mechanism. gRPC was one of the reasons for the success of Protobuf. You get both the RPC framework + serialization (protobuf) nicely working together. CBOR is a good option only if you already have a separate RPC mechanism, such as ZMQ / DHT-RPC / Websockets or least a HTTP server, such as H2O or SeaStar. |
This looks good work.
For cross-language support, it would be good to go deep into one language with runtime support, rather than going wide and providing compile-time linking options for many languages.
For example, once C/C++ implementation is done, please:
That would save lot of implementation redundancy, as well as reaches larger target audience (e.g. Python, R what not)
Also, for serialization, please use
cbor
rather than depending on protobufs. A good design does not force a rebuild of the code whenever there is a change in the wire/serialization format. All modern languages support CBOR and it is extensible.The text was updated successfully, but these errors were encountered: