What is the difference between Metadata and Metadata Type Definitions in Substrate?

Also, when I do the state_getMetadata RPC call I get the metadata. It is rather long. Is there a way to cache this locally and on subsequent state_getMetadata RPC calls, compare the hash of my local version with the hash of the latest metadata and if they're equal than use my locally cached metadata rather than have to pull the entire metadata again?

  • It is hard to follow what you are actually asking? The title of your question doesn't really fit the description.
    – bkchr
    Commented Feb 18, 2022 at 12:32
  • Updated title/content for clarity.
    – Bruno
    Commented Feb 21, 2022 at 20:49

1 Answer 1


The metadata provides essential information regarding the substrate blockchain you are connecting to.

It is unique to that chain's runtime.

The chain's runtime metadata includes information such as storage items, extrinsic calls, events, constants, and errors that are exposed by that chain's runtime via the various pallets that were used to construct it.

The metadata most likely will change if the runtime gets upgraded. Therefore you need to make sure you always get the latest metadata.

The frame-metadata repo defines the metadata. Substrate chains implement that type definition. Frame-metadata type definitions are versioned e.g. v12, v13, ...

You can see a nicely formatted example of a metadata here.

Reference: https://docs.substrate.io/build/application-development/#exposing-runtime-information-as-metadata

I do see your logic though. There could be a way of caching the metadata on the client side so that subsequent requests only check the metadata's version number/hash with the one you have cached. If the version is the same, no need to get the full metadata. If the version you have is out-of-date, then pull the full metadata from the chain.

  • that was helpful! Thanks @Bruno
    – Arjun
    Commented Mar 27, 2022 at 5:18

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.