1

Hello I am creating custom rpc call, I need metadata to be able to decode extrinsics call inside my calls.

But I don't know how to get substrate metadata inside my rpc call?

3
  • Could you explain a little bit what your RPC call would do? or what is the expected input/output
    – andresvsm
    Aug 11, 2022 at 9:06
  • Yes, sur in a custom rpc method, I am getting the extrinsics of a block, and I need to decode those extrinsics, but to do that I need to use Metadata. :-)
    – cibou
    Aug 11, 2022 at 11:11
  • I see, it's interesting, but I would keep decoding processes outside of the custom RPC calls. It will affect the node performance under heavy loads of requests, as it will have to decode each time an RPC call is made. As Iker mentioned, you can perform this decoding process off chain, but that's just a suggestion. I look forward to see if anyone can help here!
    – andresvsm
    Aug 12, 2022 at 6:41

1 Answer 1

3

Conveniently, you have the relevant RPC method to get the metadata from a Substrate chain as the first example of the custom RPC documentation on Substrate.

Additionally, if you are considering to use Polkadot.js, this is the relevant method to get the metadata.

Finally, this answer should cover how to do this in a custom RPC call.

5

Your Answer

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

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