3

What are the primary differences between subxt and substrate-api-client and how do they compare to polkadotjs?

I'm building a desktop application using Tauri which runs server side rust code and javascript client side, so I'm trying to figure out which of these 3 libraries to use, 2 of them being backend server side libraries and the other a frontend libary.

3 Answers 3

3

PolkadotJS is the library to interact with Substrate nodes in Javascript, if you are building your frontend app with JS is the one to go. If your code is in another language there are some alternatives like Python Substrate Interface or Kotlin Substrate Client, but PolkadotJS is the most used and therefore the one I would recommend now.

In your case that you have a server side it might makes more sense to perform all the queries and operations in the backend and if you have one in Rust the best alternatives are the ones you mentioned, subxt is a library to submit extrinsics to a substrate node via RPC and substrate-api-client connects to the substrate's RPC interface via WebSockets. There exist other alternatives for other languages too, take a look in this list.

Another tool that can be interesting for you is Sidecar, a REST service to interact with Substrate nodes.

1

If your using Tauri then it's your choice - personally I'd keep the UI light and have as much in rust as possible so that its strongly typed, but if your typescript skills are better than your rust skills then maybe you'd want it the other way around? Subxt btw is getting better at being able to run client side on the browser: it can now do most things in the browser but not sign stuff (that would need to be done by something else - maybe a browser extension? or alternately the Signer trait can be implemented).

0

Subxt is an RPC library officially managed by Parity for submitting extrinsics, while substrate-api-client is a program that received a grant from Parity but is not officially managed by them.

These two libraries have slightly different functions to support. Additionally, Polkadot-js is a website that utilizes APIs like subxt and substrate-api-client to perform blockchain exporter functions, but its version is outdated and lacks customization options.

Therefore, refer subxt or substrate-api-client for backend logics to query and send request, and polkadot.js for front logics!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.