-
Notifications
You must be signed in to change notification settings - Fork 258
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
Create subxt backend from a substrate backend #1888
Comments
Hey hey,
There is no way to connect to a substrate node besides the HTTP/WebSocket RPC interface. Or what do you want to accomplish? |
Instead of asking our end users to use subxt to interact with our blockchain, we want to make easier for them by providing custom RPCs on the substrate node itself that perform parameter validation, signing and submitting extrinsics, waiting until tx is in block, decoding events using metadata then replying with meaningful error messages. This is roughly what I envisage:
Currently, I found a way to interact directly to the |
Ok, I see what you mean. The Technically, it should be possible to implement the subxt::Backend for the sc_client_api::backend::Backend but that trait is sealed and can't be externally implemented. I don't think sc_client_api::backend::Backend impl is something that we would want to have in subxt directly because we have made efforts to not depend directly on polkadot-sdk libraries directly because it's so difficult with different crate versions with traits bounds etc.. but we could open the Backend trait so you could implement it yourself. What do you think about making Backend trait non-sealed/externally implementable (I don't remember why)? |
Thanks for your quick answer. I see what you mean, if I understood correctly the design principle of subxt is to operate via RPC to a substrate node. |
I'm not against unsealing it. The reason for it being sealed originally was because we were unsure of the design and wanted room to be ablke to tweak it without impacting users so much, but it has been pretty stable lately anyways!
Exactly; it's basically an API client to give a nice interface over interacting with the node RPCs at its core, which means we want it to be fairly independant from substrate code for the reasons Niklas mentioned! |
Hi, thanks for the valuable work you're doing with subxt.
I would like to create an
OnlineClient
for signing and submitting extrinsics. However I don't want to go through the network and websockets. Is there a way to create a subxtBackend
from a substrateChainHead
backend?My scenario is that we would like to offer some custom RPCs for our users and expose those as part of our substrate based node. As part of those RPC's we would like to use subxt to sign and submit some extrinsics. It doesn't sound optimal to go through the netrwork layer while we already have got access to the full substrate backends including ChainHead. I'm wondering is there a way to create subxt backend from a substrate backend.
Many thanks
The text was updated successfully, but these errors were encountered: