Skip to main content
9 votes
Accepted

How do I check what metadata version a chain is running?

I believe your confusion stems from "metadata version" and "runtime version" and what the metadata contains at a specific point of the chain. Metadata exposes all the constants, ...
Jaco's user avatar
  • 5,865
8 votes
Accepted

What are type bundles and versioned metadata?

First the good news - for any chain using metadata v14, specifying custom types are not needed. The metadata itself supplies all the types required. This means that when a call is defined in the ...
Jaco's user avatar
  • 5,865
7 votes
Accepted

Migrate keytype of StorageMap without breakin API

First of all, there's a misunderstanding here. Defining something like #[pallet::storage] pub type MyMap = StorageMap<_, Blake2_128Concat, KeyTypeOld, V>; #[pallet::storage] pub type MyMapNew = ...
kianenigma's user avatar
  • 2,799
7 votes

How do I check what metadata version a chain is running?

I believe Jaco and Sacha explained the "content" concept quite nicely. If you wish to only use the JS UI to query, you can do the following making RPC calls (the lazy version of cli tools) - ...
RosaryBeads's user avatar
6 votes
Accepted

Can the metadata of Polkadot change?

From the Substrate docs Since the runtime of a Substrate blockchain is an evolving part of the blockchain's state, blockchain metadata is stored on a per-block basis. Be aware that querying the ...
olanod's user avatar
  • 531
5 votes

How do I check what metadata version a chain is running?

The metadata version is specified as an enum variant in the frame_metadata crate, which all runtime pallets use. When a runtime gets compiled to Wasm, the most reliable way to know its metadata ...
Sacha Lansky's user avatar
  • 2,640
5 votes

How to migrate to metadataV14

To migrate your chain to the V14 metadata system, follow these steps (from this upgrade guide): Remove any #[pallet::metadata(..)] attributes from your pallet's Event definition. Add scale-info as a ...
Sacha Lansky's user avatar
  • 2,640
5 votes
Accepted

How does typegen work with metadata v14?

You are correct in that the actual definitions are basically deprecated. However, it does still play a (small) role in that the RPC types are not carried in the metadata. (This will change in the ...
Jaco's user avatar
  • 5,865
4 votes
Accepted

What is the difference between Metadata and FRAME-Metadata?

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 ...
Bruno's user avatar
  • 8,315
3 votes

How can i update polkadot js metadata from inside my app?

So generally speaking Polkadot-js exposes two important Classes here that can be expanded upon for metadata: TypeRegistry, and Metadata. So the simple answer is yes: If you are using the ApiPromise (...
Tarik Gul's user avatar
  • 1,131
3 votes
Accepted

Is there a way to reconstruct the rust types from the runtime metadata?

In Rust, it is not possible to create a struct at runtime due to the absence of a reflection system. Currently, the most convenient approach is employed in subxt. It involves fetching the metadata ...
AurevoirXavier's user avatar
  • 10.7k
3 votes
Accepted

Metadata(PalletNotFound) with subxt

First of all, thanks for asking about this topic Any metadata on the disk can be further inspected with the use of subxt-cli, we've also added some new features that allows users to quickly explore ...
Alexandru Vasile's user avatar
3 votes

Get Metadata inside custom rpc call

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 ...
Iker's user avatar
  • 1,356
3 votes

Why this metadata.json is not valid

I played around a bit with your example. The JS API doesn't seem to like the fact that the path for the composite has no entries and fails on trying to extract values from that. (It uses these to ...
Ben Travers's user avatar
3 votes
Accepted

RPC full type specification from metadata

This is definitely a feature we have in mind, however at the moment there are no plans to implement it in the immediate future. I have created an issue for it in Substrate: https://github.com/...
Andrew Jones's user avatar
2 votes

At this point in time will one version of the metadata decode all blocks from genesis to the latest on a single parachain?

You need to decode events/extrinsics/errors/etc. with the metadata at that point in the runtime. With different upgrades types change, indexes move around, pallets are added, etc. There is no one-size-...
Jaco's user avatar
  • 5,865
2 votes
Accepted

Custom Metadata Command Returnning Incorrect Data

Found one fix: https://github.com/LibertyDSNP/frequency/pull/987 This uses impl CliConfiguration to force the base_path to a temp directory. Feels like it shouldn't need this, but it works. impl ...
Wil W's user avatar
  • 433
2 votes
Accepted

Stable scale encoded events from ink contract

Currently there is no way to make the encoding independent of the ordering. As you say a internal enum is generated with the event structs as variants and they are just added in the order they appear. ...
Andrew Jones's user avatar
2 votes
Accepted

Tool to generate human readable JSON of Substrate node metadata from a file?

Subwasm works on a whole runtime block. It could probably be changed, but I rather created submeta. You can use it with a stored encoded metadata from an RPC like this: curl -H "Content-Type: ...
Oliver Tale-Yazdi's user avatar
2 votes

How to get Runtime types and Runtime (PalletCustomOrigins) from subxt metadata.scale

This can be accessed using the following syntax #[subxt::subxt(runtime_metadata_path = "testmetadata.scale")] pub mod runtime {} Then access runtime types, Note: use subxt-cli to generate ...
Mrisho Lukamba's user avatar
2 votes
Accepted

How to encode an extrinsic for RPC from a web client?

I believe this is the library you want to use txwrapper-core, is a set of tools to quickly create, test, and maintain a library of helper functions for offline transaction generation with your chain. ...
Alex Bean's user avatar
  • 5,757
1 vote

No metadata hash in transaction

The change is not yet implemented. It is coming up in #4274. From what i understood: The metadata hash can be optionally appended at the end. This keeps backwards compatibility with existing signers ...
Oliver Tale-Yazdi's user avatar
1 vote
Accepted

What is the purpose of the `contracts_runtime.scale` file in the `cargo-contracts` repository?

The metadata was downloaded from a running substrate-contracts-node and is used to generate the APIs and types required for constructing contract extrinsics and querying storage from a compatible node....
Andrew Jones's user avatar
1 vote

In a FRAME runtime, where is the metadata actually constructed?

It follows this path. construct_runtime! expand_runtime_metadata expand each item For more detail about the items, check the pallet macro. E.G. pallet calls metadata
AurevoirXavier's user avatar
  • 10.7k
1 vote

TwoX128 hash for rpc.state.metadata pallet names not being a prefix for storage key

After some inspection for the api.rpc.state.getMetadata(..) in the latest version of the MetadataV* type (currently MetadataV14) you can get the string used for the prefix from metadata.asLatest....
mr_bovo's user avatar
  • 171
1 vote
Accepted

How to generate augmented types from V14 metadata generated with subwasm

The latest release of subwasm contains a flag --format=json+scale which will return exactly the {"result": "<scale and hex encoded metadata>"} that is needed.
Tino Rusch's user avatar
1 vote

When the blockchain upgrades the runtime, the upgraded height uses which metadata?

If you do the upgrade at block 1000, aka setting the :code storage item, the new runtime will be used for building block 1001. There is actually an open issue about this topic, as the block that sets ...
bkchr's user avatar
  • 11.6k
1 vote

How use Metadata deocde Vec::<EventRecord<Event, H256>>

Here are some very detailed examples. subscribe_all_event subscribe_one_event subscribe_some_event
AurevoirXavier's user avatar
  • 10.7k
1 vote

Getting more call metadata from a generic call

You can filter the call in runtime. Here is how proxy do: Provide a filter configuration here https://github.com/paritytech/substrate/blob/master/frame/proxy/src/lib.rs#L124-L134. Configure it here ...
AurevoirXavier's user avatar
  • 10.7k
1 vote

How to parse the data returned by the HTTP request RPC (state_getmetadata)?

The library that you are using seems to be outdated. For what I have seen there is an open issue for this, I would just suggest you to track it there - https://github.com/emeraldpay/polkaj/issues/88
Alejandro Martínez's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible