---
# System prepended metadata

title: CheckMetadataHash Signed Extension

---

### What to update
- Submit a PR in the [polkadot wiki](https://github.com/w3f/polkadot-wiki) repo in order to update this page https://wiki.polkadot.network/docs/build-transaction-construction#transaction-format
- Add a section explaining the optional parameter and how it is used.

### Transaction Format
- Address: The SS58-encoded address of the sending account.
...
...
- Nonce: The nonce for this transaction.*
- **Mode: The flag indicating whether to verify the metadata hash or not.**
- Spec Version: The current spec version for the runtime.
...
...
- Era Period: Optional, the number of blocks after the checkpoint for which a transaction is valid. If zero, the transaction is immortal
- **MetadataHash: The metadata hash which should match the `RUNTIME_METADATA_HASH` environment variable.**


### Mode and MetadataHash 
The `mode` and `metadataHash` fields were introduced in transaction construction to support the optional `CheckMetadataHash` Signed Extension. This enables trustless metadata verification by allowing the chain to verify the correctness of the metadata used without the need of a trusted party. This change was included in [v1.2.5](https://github.com/polkadot-fellows/runtimes/issues/316) release.

#### How to set Mode and MetadataHash
In the signing payload you need to add:
- the `mode` before the `Spec Version` and
- the `MetadataHash` at the end

#### Not using the optional `CheckMetadataHash`
If you do not wish to include the optional signed extension, then set the `mode` to `00`. When `mode` is `00`, the `metadataHash` field is empty/`None`. 

In this case, the signing payload will have:
- `mode`: `00`
- `metadataHash`: `00`

However, in the signed extrinsic, only the mode will be included:
- `mode`: `00`


More information about this can be found:
- in the original [specs](https://github.com/polkadot-fellows/RFCs/blob/main/text/0078-merkleized-metadata.md)
- in the metadata hash extension [code](https://github.com/paritytech/polkadot-sdk/blob/7f7f5fa857502b6e3649081abb6b53c3512bfedb/substrate/frame/metadata-hash-extension/src/lib.rs#L93L97)

