I'm trying to figure out where in the runtime's codebase the metadata that describes it is constructed.

I've read all about the different versions of metadata and explored how they represent runtimes in the frame metadata crate. I've also looked at how scale-info is used to attach compile-time type information. I believe I have a decent understanding of those aspects.

In the runtime code I see the metadata runtime api implemented like this:

impl sp_api::Metadata<Block> for Runtime {
    fn metadata() -> OpaqueMetadata {

But where is this mysterious metadata method defined? The rustdocs don't give too many clues.

Ultimately, I want to understand how the runtime synthesizes all the information from the pallets into a single piece of metadata.

1 Answer 1


It follows this path.

For more detail about the items, check the pallet macro.

E.G. pallet calls metadata

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.