Skip to main content

state_getMetadata

Description#

Returns the latest runtime metadata as a SCALE-encoded blob. Decode this (or use scale-info aware libraries) to understand pallets, storage layouts, and custom RPC types introduced by Bifrost upgrades.

Parameters#

ParameterTypeRequiredDescription
blockHashstringNoBlock hash to fetch historical metadata

Returns#

SCALE-encoded metadata blob (hex string).

Request Example#

{
"jsonrpc": "2.0",
"method": "state_getMetadata",
"params": [],
"id": 1
}

Response Example#

{
"jsonrpc": "2.0",
"result": "0x6d6574610c010000000100...",
"id": 1
}

Code Examples#

metadata_scale = substrate.rpc_request('state_getMetadata', [])["result"]
with open('bifrost_metadata.scale', 'w') as f:
f.write(metadata_scale)

Usage Notes#

  • After runtime upgrades (e.g., specVersion 21001), refresh metadata to decode new pallets like Hyperbridge, FlexibleFee, or omnipool updates.
  • Tools such as subxt or polkadot-js/api automatically refresh metadata when the runtime version increases.